aider icon indicating copy to clipboard operation
aider copied to clipboard

[FeatReq] Ask the user to remove some files or to clear the chat history when the AI context is full instead of giving error

Open Emasoft opened this issue 1 year ago โ€ข 2 comments

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

Emasoft avatar Jul 27 '24 17:07 Emasoft

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

paul-gauthier avatar Jul 28 '24 11:07 paul-gauthier

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

Emasoft avatar Jul 29 '24 14:07 Emasoft

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).

casparvitch avatar Jun 13 '25 01:06 casparvitch