Handle more openai response types for better rendering and error avoidance

The reasoning messages in openai cua needs to be passed back or some
such. Else it throws missing response with required id error.

Folks are confused about expected behavior for this online as well.
The documentation to handle this seems to be sparse, unclear.
This commit is contained in:
Debanjum
2025-05-09 19:07:39 -06:00
parent 3a75cd3c3d
commit 33689feb91
2 changed files with 12 additions and 1 deletions

View File

@@ -119,6 +119,12 @@ class RequestUserAction(BaseAction):
request: str
class NoopAction(BaseAction):
"""No operation action."""
type: Literal["noop"] = "noop"
OperatorAction = Union[
ClickAction,
DoubleClickAction,
@@ -139,4 +145,5 @@ OperatorAction = Union[
GotoAction,
BackAction,
RequestUserAction,
NoopAction,
]

View File

@@ -160,7 +160,11 @@ class OpenAIOperatorAgent(OperatorAgent):
except Exception as e:
logger.error(f"Error converting OpenAI action {action_type}: {e}")
content = f"Error: {action_type}: {e}"
elif block.type == "message":
rendered_response["text"] = response.output_text
elif block.type == "reasoning":
actions.append(NoopAction())
action_results.append(block)
if action_to_run or content:
actions.append(action_to_run)
if action_to_run or content: