[FeatReq] Ask the user to remove some files or to clear the chat history when the AI context is full instead of giving error
Issue
Ask the user to remove some files or to clear the chat history when the AI context is full instead of giving error.
Version and model info
No response
Thanks for trying aider and filing this issue.
I'm not sure what you mean by "when the AI context is full" and "giving an error". Can you share output of the problem you are having.
Aider does make suggestions about how to reduce tokens when it hits token limits:
https://aider.chat/docs/troubleshooting/token-limits.html
When reporting problems, it is very helpful if you can provide:
- Aider version
- LLM model you are using
- Any stack traces or error messages
- A description of what you were doing when the error happened.
Including the โannouncementโ lines that aider prints at startup is an easy way to share some of this helpful info.
Aider v0.37.1-dev
Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo
Git repo: .git with 243 files
Repo-map: using 1024 tokens
The current output when the context limit is reached is just an error message. The output I would like to see would be like this:
The context space is full and to continue you need to drop some resources from the chat.
Choose from of the following:
| Index | Resource | Tokens |
|---|---|---|
| 1 | ๐ workspace/myproject/src/main.py | 1523 tokens |
| 2 | ๐ https://docs.github.com/en/actions/learn-github-actions/expressions | 4987 tokens |
| 3 | ๐ workspace/myproject/project.toml | 7345 tokens |
| 4 | ๐ workspace/myproject/src/utils/helpers.py | 2839 tokens |
| 5 | ๐ https://docs.service.org/3/library/api.html | 1203 tokens |
| 6 | ๐ workspace/myproject/tests/test_main.py | 6123 tokens |
| 7 | ๐ workspace/myproject/data/sample_data.json | 131948 tokens |
| 8 | ๐ https://docs.github.com/en/repositories/about-repositories | 3056 tokens |
| 9 | ๐ workspace/myproject/src/components/component.py | 8411 tokens |
| 10 | ๐ workspace/myproject/docs/usage_guide.md | 762 tokens |
| 11 | ๐ฐAider code chat history | 16000 tokens |
| 12 | ๐ฐAider ask chat history | 3300 tokens |
| 13 | ๐ฐAider help chat history | 700 tokens |
Total Token Used: 198197 tokens (max context tokens: 200000)
Choose a number between 1 and 13 (Use comma to drop multiple resources, C to clear all chat context):
> 7, 13, 8
This would be a nice feature independently. Instead of clearing the full chat history or dropping all files, clearing specific components? Clearing part of the history would be nice too (e.g. keep last 10 commands only).