mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-23 11:25:55 +00:00
fix: add retry termination notification to interaction channel
This commit is contained in:
parent
25ded8e747
commit
ec14933aa1
@ -718,9 +718,22 @@ class LLMProvider(ABC):
|
|||||||
identical_error_count,
|
identical_error_count,
|
||||||
(response.content or "")[:120].lower(),
|
(response.content or "")[:120].lower(),
|
||||||
)
|
)
|
||||||
|
if on_retry_wait:
|
||||||
|
await on_retry_wait(
|
||||||
|
f"Persistent retry stopped after {identical_error_count} identical errors."
|
||||||
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
if not persistent and attempt > len(delays):
|
if not persistent and attempt > len(delays):
|
||||||
|
logger.warning(
|
||||||
|
"LLM request failed after {} retries, giving up: {}",
|
||||||
|
attempt,
|
||||||
|
(response.content or "")[:120].lower(),
|
||||||
|
)
|
||||||
|
if on_retry_wait:
|
||||||
|
await on_retry_wait(
|
||||||
|
f"Model request failed after {attempt} retries, giving up."
|
||||||
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
base_delay = delays[min(attempt - 1, len(delays) - 1)]
|
base_delay = delays[min(attempt - 1, len(delays) - 1)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user