优化输出

This commit is contained in:
朱潮 2026-01-18 22:04:36 +08:00
parent f9ba3c8e51
commit 3b438d8ab7
2 changed files with 11 additions and 11 deletions

View File

@ -54,4 +54,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8001/api/health || exit 1
# 启动命令 - 使用优化的统一启动脚本
CMD ["python3", "start_unified.py", "--profile", "balanced"]
CMD ["sh", "-c", "python3 start_unified.py --profile ${PROFILE:-balanced}"]

View File

@ -83,14 +83,14 @@ async def enhanced_generate_stream_response(
if isinstance(msg, AIMessageChunk):
# 处理工具调用
if msg.tool_call_chunks and config.tool_response:
if msg.tool_call_chunks:
message_tag = "TOOL_CALL"
for tool_call_chunk in msg.tool_call_chunks:
if tool_call_chunk["name"]:
new_content = f"[{message_tag}] {tool_call_chunk['name']}\n"
if tool_call_chunk['args']:
new_content += tool_call_chunk['args']
if config.tool_response:
for tool_call_chunk in msg.tool_call_chunks:
if tool_call_chunk["name"]:
new_content = f"[{message_tag}] {tool_call_chunk['name']}\n"
if tool_call_chunk['args']:
new_content += tool_call_chunk['args']
# 处理文本内容
elif msg.content:
preamble_completed.set()
@ -101,11 +101,11 @@ async def enhanced_generate_stream_response(
new_content = f"[{meta_message_tag}]\n"
if msg.text:
new_content += msg.text
# 处理工具响应
elif isinstance(msg, ToolMessage) and config.tool_response and msg.content:
elif isinstance(msg, ToolMessage) and msg.content:
message_tag = "TOOL_RESPONSE"
new_content = f"[{message_tag}] {msg.name}\n{msg.text}\n"
if config.tool_response:
new_content = f"[{message_tag}] {msg.name}\n{msg.text}\n"
# 收集完整内容
if new_content: