refactor: Move retry logic from base_coder to sendchat module

This commit is contained in:
Paul Gauthier 2024-10-28 15:05:06 -07:00 committed by Paul Gauthier (aider)
parent 54d55c857b
commit f9c45432e6
2 changed files with 3 additions and 1 deletions

View file

@ -1124,6 +1124,7 @@ class Coder:
exhausted = False
interrupted = False
try:
# ai: replicate this try/except retry loop...
while True:
try:
yield from self.send(messages, functions=self.functions)
@ -1136,6 +1137,7 @@ class Coder:
self.io.tool_output(f"Retrying in {retry_delay:.1f} seconds...")
time.sleep(retry_delay)
continue
# ai: ... down to here
except KeyboardInterrupt:
interrupted = True
break

View file

@ -102,7 +102,7 @@ def send_completion(
return hash_object, res
@lazy_litellm_retry_decorator
# ai: in this function!
def simple_send_with_retries(model_name, messages, extra_params=None):
try:
kwargs = {