feat(chat): improve log message display
This commit is contained in:
1 parent
d9204d262c
commit
8e94967a9f
3 files changed
+29
-1
No files matched your search
@@ -131,6 +131,24 @@ class Agent:
|
||||
chat_id=message.chat_id,
|
||||
thread_id=message.thread_id,
|
||||
content=stream,
|
||||
kind="log",
|
||||
subkind="reasoning",
|
||||
)
|
||||
run.emit_event('chat-message', {
|
||||
'messageId': new_message['id'],
|
||||
'chatId': message.chat_id,
|
||||
'threadId': message.thread_id,
|
||||
})
|
||||
|
||||
async def on_toolcall_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,
|
||||
kind="log",
|
||||
subkind="reasoning",
|
||||
)
|
||||
run.emit_event('chat-message', {
|
||||
'messageId': new_message['id'],
|
||||
@@ -139,6 +157,8 @@ class Agent:
|
||||
})
|
||||
|
||||
await run.on_async('reasoning', on_reasoning_event)
|
||||
await run.on_async('output', on_output_event)
|
||||
await run.on_async('tool-call', on_toolcall_event)
|
||||
|
||||
await self.run(run)
|
||||
return run
|
||||
|
||||
Reference in new issue
Block a user