mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 05:40:17 +00:00
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:
@@ -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,
|
||||
]
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user