dont rasie exeption when multiple actions for actionblock (#1976)

Co-authored-by: lawyzheng <lawyzheng1106@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-03-19 21:56:27 -07:00
committed by GitHub
parent fe781836ee
commit ee1f6dd10e
2 changed files with 13 additions and 5 deletions

View File

@@ -1487,7 +1487,11 @@ class ForgeAgent:
reason=json_response.get("thought"), error_type=json_response.get("error")
)
action_type: str = json_response.get("action_type") or ""
inferred_actions: list[dict[str, Any]] = json_response.get("inferred_actions", [])
if not inferred_actions:
raise FailedToParseActionInstruction(reason=json_response.get("thought"), error_type="EMPTY_ACTION")
action_type: str = inferred_actions[0].get("action_type") or ""
action_type = ActionType[action_type.upper()]
if action_type == ActionType.CLICK: