tool_call

This commit is contained in:
朱潮 2025-12-14 18:48:48 +08:00
parent 671569026e
commit 559040f7ce

View File

@ -176,11 +176,11 @@ async def enhanced_generate_stream_response(
("stop_reason" in msg.response_metadata and msg.response_metadata["stop_reason"] == "tool_use")
):
for args in function_call.values():
new_content = f"[{message_tag}] {args['function_name']}\n{args['arguments']}"
new_content += f"[{message_tag}] {args['function_name']}\n{args['arguments']}\n"
message_tag = "TOOL_CALL_FINISH"
elif isinstance(msg, ToolMessage) and len(msg.content) > 0:
message_tag = "TOOL_RESPONSE"
new_content = f"[{message_tag}] {msg.name}\n{msg.text}"
new_content = f"[{message_tag}] {msg.name}\n{msg.text}\n"
# 只有当有新内容时才发送chunk
if new_content: