mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
Handle complete context blowout more gracefully
This commit is contained in:
parent
41b7a70347
commit
949a633e95
1 changed files with 8 additions and 1 deletions
|
@ -361,10 +361,17 @@ class Coder:
|
|||
if self.verbose:
|
||||
utils.show_messages(messages)
|
||||
|
||||
exhausted = False
|
||||
try:
|
||||
interrupted = self.send(messages, functions=self.functions)
|
||||
except ExhaustedContextWindow:
|
||||
self.io.tool_error("Exhausted context window!")
|
||||
exhausted = True
|
||||
except openai.error.InvalidRequestError as err:
|
||||
if "maximum context length" in str(err):
|
||||
exhausted = True
|
||||
|
||||
if exhausted:
|
||||
self.io.tool_error("The chat session is larger than the context window!")
|
||||
self.io.tool_error(" - Use /tokens to see token usage.")
|
||||
self.io.tool_error(" - Use /drop to remove unneeded files from the chat session.")
|
||||
self.io.tool_error(" - Use /clear to clear chat history.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue