修复none值的问题

This commit is contained in:
朱潮 2025-12-15 17:38:27 +08:00
parent c391c97b24
commit d9ee1edf8a

View File

@ -152,7 +152,8 @@ async def enhanced_generate_stream_response(
for tool_call_chunk in msg.tool_call_chunks: for tool_call_chunk in msg.tool_call_chunks:
if tool_call_chunk["name"]: if tool_call_chunk["name"]:
new_content = f"[{message_tag}] {tool_call_chunk['name']}\n" new_content = f"[{message_tag}] {tool_call_chunk['name']}\n"
new_content += tool_call_chunk['args'] if tool_call_chunk['args']:
new_content += tool_call_chunk['args']
# 处理文本内容 # 处理文本内容
elif msg.content: elif msg.content:
@ -162,7 +163,8 @@ async def enhanced_generate_stream_response(
if meta_message_tag != message_tag: if meta_message_tag != message_tag:
message_tag = meta_message_tag message_tag = meta_message_tag
new_content = f"[{meta_message_tag}]\n" new_content = f"[{meta_message_tag}]\n"
new_content += msg.text if msg.text:
new_content += msg.text
# 处理工具响应 # 处理工具响应
elif isinstance(msg, ToolMessage) and tool_response and msg.content: elif isinstance(msg, ToolMessage) and tool_response and msg.content: