This commit is contained in:
2025-02-25 09:48:10 +08:00
parent 345f61b4a7
commit c0570aef13
3 changed files with 46 additions and 53 deletions

View File

@@ -222,8 +222,13 @@ async def chat(websocket: WebSocket):
continue
print(f"----------------{message.source}----------------\n {message.content}")
if message.type == 'TextMessage' or message.type == 'HandoffMessage' \
or message.type == 'ToolCallRequestEvent' or message.type == 'UserInputRequestedEvent':
await websocket.send_json(message.model_dump())
or message.type == 'UserInputRequestedEvent':
if isinstance(message.content, str):
await websocket.send_json(message.model_dump())
else:
_message = message
_message.content = str(_message.content)
await websocket.send_json(_message.model_dump())
if not isinstance(message, UserInputRequestedEvent):
history.append(message.model_dump())