Handle LLM returning element_id instead of id, and handle cases where it may not be returned at all (#301)
This commit is contained in:
@@ -138,7 +138,13 @@ class CompleteAction(DecisiveAction):
|
|||||||
def parse_actions(task: Task, json_response: List[Dict[str, Any]]) -> List[Action]:
|
def parse_actions(task: Task, json_response: List[Dict[str, Any]]) -> List[Action]:
|
||||||
actions = []
|
actions = []
|
||||||
for action in json_response:
|
for action in json_response:
|
||||||
element_id = action["id"]
|
if "id" in action:
|
||||||
|
element_id = action["id"]
|
||||||
|
elif "element_id" in action:
|
||||||
|
element_id = action["element_id"]
|
||||||
|
else:
|
||||||
|
element_id = None
|
||||||
|
|
||||||
reasoning = action["reasoning"] if "reasoning" in action else None
|
reasoning = action["reasoning"] if "reasoning" in action else None
|
||||||
if "action_type" not in action or action["action_type"] is None:
|
if "action_type" not in action or action["action_type"] is None:
|
||||||
actions.append(NullAction(reasoning=reasoning))
|
actions.append(NullAction(reasoning=reasoning))
|
||||||
|
|||||||
Reference in New Issue
Block a user