mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
fix test for windows
This commit is contained in:
parent
a042914e66
commit
6f1e26157e
1 changed files with 31 additions and 30 deletions
|
@ -821,39 +821,40 @@ class Coder:
|
|||
|
||||
exhausted = False
|
||||
interrupted = False
|
||||
while True:
|
||||
try:
|
||||
yield from self.send(messages, functions=self.functions)
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
interrupted = True
|
||||
break
|
||||
except litellm.ContextWindowExceededError:
|
||||
# The input is overflowing the context window!
|
||||
exhausted = True
|
||||
break
|
||||
except litellm.exceptions.BadRequestError as br_err:
|
||||
self.io.tool_error(f"BadRequestError: {br_err}")
|
||||
return
|
||||
except FinishReasonLength:
|
||||
# We hit the 4k output limit!
|
||||
if not self.main_model.can_prefill:
|
||||
try:
|
||||
while True:
|
||||
try:
|
||||
yield from self.send(messages, functions=self.functions)
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
interrupted = True
|
||||
break
|
||||
except litellm.ContextWindowExceededError:
|
||||
# The input is overflowing the context window!
|
||||
exhausted = True
|
||||
break
|
||||
except litellm.exceptions.BadRequestError as br_err:
|
||||
self.io.tool_error(f"BadRequestError: {br_err}")
|
||||
return
|
||||
except FinishReasonLength:
|
||||
# We hit the 4k output limit!
|
||||
if not self.main_model.can_prefill:
|
||||
exhausted = True
|
||||
break
|
||||
|
||||
# Use prefill to continue the response
|
||||
self.multi_response_content += self.partial_response_content
|
||||
if messages[-1]["role"] == "assistant":
|
||||
messages[-1]["content"] = self.multi_response_content
|
||||
else:
|
||||
messages.append(dict(role="assistant", content=self.multi_response_content))
|
||||
except Exception as err:
|
||||
self.io.tool_error(f"Unexpected error: {err}")
|
||||
traceback.print_exc()
|
||||
return
|
||||
|
||||
if self.mdstream:
|
||||
self.live_incremental_response(True)
|
||||
# Use prefill to continue the response
|
||||
self.multi_response_content += self.partial_response_content
|
||||
if messages[-1]["role"] == "assistant":
|
||||
messages[-1]["content"] = self.multi_response_content
|
||||
else:
|
||||
messages.append(dict(role="assistant", content=self.multi_response_content))
|
||||
except Exception as err:
|
||||
self.io.tool_error(f"Unexpected error: {err}")
|
||||
traceback.print_exc()
|
||||
return
|
||||
finally:
|
||||
if self.mdstream:
|
||||
self.live_incremental_response(True)
|
||||
|
||||
if self.multi_response_content:
|
||||
self.multi_response_content += self.partial_response_content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue