This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Commit 667240a
committed
Enhance AI sidekick with file context support 📁
This commit introduces the ability for the AI sidekick to use the contents of specified files as context during its session. This is achieved by adding a new function `generate_files_context` which reads the contents of the provided files and formats them into a string that can be used as context.
The `sidekick` function in `cli.py` has been updated to accept a list of files as arguments, generate the file context, and pass it along with the user's request to the `generate_sidekick_prompt` function. The token size calculations and model selection have also been adjusted to account for the additional context.
The `generate_sidekick_prompt` function now accepts an additional `files` parameter and includes the generated file context in the prompt template. The prompt template itself has been updated to include a placeholder for the file context.
The import statements in `cli.py` and `__init__.py` have been updated to include the new `generate_files_context` function.
This enhancement provides the AI sidekick with more context, potentially improving its ability to assist the user.1 parent da39811 commit 667240a
3 files changed
Lines changed: 50 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
272 | 277 | | |
273 | 278 | | |
274 | 279 | | |
275 | 280 | | |
276 | | - | |
277 | | - | |
278 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
279 | 293 | | |
280 | 294 | | |
281 | 295 | | |
| |||
286 | 300 | | |
287 | 301 | | |
288 | 302 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
| 303 | + | |
| 304 | + | |
294 | 305 | | |
| 306 | + | |
295 | 307 | | |
296 | 308 | | |
297 | 309 | | |
298 | | - | |
| 310 | + | |
299 | 311 | | |
300 | 312 | | |
301 | | - | |
| 313 | + | |
302 | 314 | | |
303 | 315 | | |
304 | 316 | | |
305 | | - | |
| 317 | + | |
306 | 318 | | |
307 | | - | |
308 | | - | |
| 319 | + | |
| 320 | + | |
309 | 321 | | |
310 | 322 | | |
311 | 323 | | |
312 | 324 | | |
313 | 325 | | |
314 | | - | |
| 326 | + | |
315 | 327 | | |
316 | 328 | | |
317 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
16 | 29 | | |
17 | 30 | | |
18 | | - | |
| 31 | + | |
0 commit comments