обработка новой модели, актуальный manual.py
This commit is contained in:
parent
4c3e7253c7
commit
0cf3117fde
2 changed files with 68 additions and 45 deletions
|
|
@ -2,8 +2,12 @@ import asyncio
|
|||
import traceback
|
||||
|
||||
from lambda_agent_api.agent_api import AgentApi, AgentBusyException
|
||||
from lambda_agent_api.server import MsgEventTextChunk, MsgEventToolCallChunk, MsgEventToolResult
|
||||
|
||||
from lambda_agent_api.server import (
|
||||
MsgEventTextChunk,
|
||||
MsgEventToolCallChunk,
|
||||
MsgEventToolResult,
|
||||
MsgEventSendFile,
|
||||
)
|
||||
|
||||
|
||||
async def main():
|
||||
|
|
@ -28,12 +32,18 @@ async def main():
|
|||
print(chunk.text, end="", flush=True)
|
||||
case MsgEventToolCallChunk():
|
||||
if not is_tool:
|
||||
print(f"\n\n### TOOL CALL: ({chunk.tool_name}) ", end="", flush=True)
|
||||
print(
|
||||
f"\n\n### TOOL CALL: ({chunk.tool_name}) ",
|
||||
end="",
|
||||
flush=True,
|
||||
)
|
||||
is_tool = True
|
||||
print(chunk.args_chunk, end="", flush=True)
|
||||
case MsgEventToolResult():
|
||||
is_tool = False
|
||||
print(f"\nResult: {chunk.result}\n\n", end="", flush=True)
|
||||
case MsgEventSendFile():
|
||||
print(f"\n[SEND FILE] {chunk.path}\n", end="", flush=True)
|
||||
|
||||
print("\n")
|
||||
except KeyboardInterrupt:
|
||||
|
|
@ -44,4 +54,4 @@ async def main():
|
|||
await api.close()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue