fix(backend): handle reasoning event correctly
This commit is contained in:
1 parent
11b5c4e69f
commit
143bca8a8b
2 files changed
+16
-2
No files matched your search
+15
-1
@@ -115,7 +115,21 @@ class Agent:
|
||||
'threadId': message.thread_id,
|
||||
})
|
||||
|
||||
await run.on_async('output', on_output_event)
|
||||
async def on_reasoning_event(stream):
|
||||
print("[agent] run output " + repr(stream))
|
||||
new_message = await self.app.send_chat_message(
|
||||
sender=self.id,
|
||||
chat_id=message.chat_id,
|
||||
thread_id=message.thread_id,
|
||||
content=stream,
|
||||
)
|
||||
run.emit_event('chat-message', {
|
||||
'messageId': new_message['id'],
|
||||
'chatId': message.chat_id,
|
||||
'threadId': message.thread_id,
|
||||
})
|
||||
|
||||
await run.on_async('reasoning', on_reasoning_event)
|
||||
|
||||
await self.run(run)
|
||||
return run
|
||||
|
||||
Reference in new issue
Block a user