fix infeasible&chome tasks
This commit is contained in:
@@ -671,8 +671,14 @@ class OpenAICUAAgent:
|
||||
action_exit = False
|
||||
thought_exit = False
|
||||
message_exit = False
|
||||
infeasible_message = False
|
||||
infeasible_word_list = ["infeasible", "unfeasible", "impossible", "not feasible", "cannot be done"]
|
||||
for item in response.output:
|
||||
parsed_item = self._handle_item(item)
|
||||
if item.type == "message" and any(word in parsed_item.lower() for word in infeasible_word_list):
|
||||
actions.append({"action_space": "pyautogui", "action": "FAIL", "pending_checks": [], "call_id": ""})
|
||||
infeasible_message = True
|
||||
break
|
||||
if isinstance(parsed_item, dict) and parsed_item.get("action_space", None) == "pyautogui":
|
||||
actions.append(parsed_item)
|
||||
else:
|
||||
@@ -693,7 +699,7 @@ class OpenAICUAAgent:
|
||||
# state_correct = True
|
||||
# if action_exit and not message_exit:
|
||||
# state_correct = True
|
||||
if action_exit:
|
||||
if action_exit and not infeasible_message:
|
||||
state_correct = True
|
||||
if not state_correct:
|
||||
logger.warning("The state of the agent is not correct, action_exit: %s, thought_exit: %s, message_exit: %s", action_exit, thought_exit, message_exit)
|
||||
@@ -747,6 +753,7 @@ class OpenAICUAAgent:
|
||||
# Convert the action to an Action object
|
||||
step_action = Action(action.get("action", ""), self.action_space)
|
||||
# Execute the action in the environment
|
||||
print(f"Executing action: {step_action.get_action()}")
|
||||
obs, reward, terminated, info = self.env.step(step_action.get_action())
|
||||
|
||||
screenshot_base64 = encode_image(obs["screenshot"])
|
||||
|
||||
Reference in New Issue
Block a user