mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-19 16:31:30 +00:00
fix: reset retry counter on handled exceptions and add text to vision tool results
- Reset retry counter to 0 when exception is None or already handled (HandledException, RepairableException) - Add text message to vision_load tool results to prevent model provider errors with image-only messages
This commit is contained in:
parent
fd3b5253c7
commit
f9743cb736
2 changed files with 3 additions and 0 deletions
|
|
@ -16,9 +16,11 @@ class RetryCriticalException(Extension):
|
|||
|
||||
exception = data.get("exception")
|
||||
if not exception:
|
||||
self.agent.set_data(DATA_NAME_COUNTER, 0) # reset counter if exception has been handled
|
||||
return
|
||||
|
||||
if isinstance(exception, (HandledException, RepairableException)):
|
||||
self.agent.set_data(DATA_NAME_COUNTER, 0) # reset counter if exception has been handled
|
||||
return
|
||||
|
||||
max_retries = 1
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class VisionLoad(Tool):
|
|||
# build image data messages for LLMs, or error message
|
||||
content = []
|
||||
if self.images_dict:
|
||||
self.agent.hist_add_tool_result(self.name, f"Processed {len(self.images_dict)} images") # some model providers break when they get have images in message history without text
|
||||
for path, image in self.images_dict.items():
|
||||
if image:
|
||||
content.append(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue