fix: infinite loop in simple question until max_step is reached

This commit is contained in:
Jeffrey95
2025-03-27 23:54:54 +08:00
parent a10b973494
commit a8625ee5d9
2 changed files with 9 additions and 8 deletions
+8 -8
View File
@@ -111,14 +111,14 @@ class BrowserAgent(ToolCallAgent):
)
self.memory.add_message(image_message)
# Replace placeholders with actual browser state info
self.next_step_prompt = NEXT_STEP_PROMPT.format(
url_placeholder=url_info,
tabs_placeholder=tabs_info,
content_above_placeholder=content_above_info,
content_below_placeholder=content_below_info,
results_placeholder=results_info,
)
# Replace placeholders with actual browser state info
self.next_step_prompt = NEXT_STEP_PROMPT.format(
url_placeholder=url_info,
tabs_placeholder=tabs_info,
content_above_placeholder=content_above_info,
content_below_placeholder=content_below_info,
results_placeholder=results_info,
)
# Call parent implementation
result = await super().think()
+1
View File
@@ -115,6 +115,7 @@ class ToolCallAgent(ReActAgent):
# For 'auto' mode, continue with content if no commands but content exists
if self.tool_choices == ToolChoice.AUTO and not self.tool_calls:
self.state = AgentState.FINISHED
return bool(content)
return bool(self.tool_calls)