debug: 添加更多调试日志来诊断 llm_token 不输出的问题
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 6m2s

This commit is contained in:
2026-05-02 08:00:32 +08:00
parent 26b15aa4e5
commit bd2c20d927

View File

@@ -219,6 +219,8 @@ class AIAgentService:
if hasattr(message_chunk, 'additional_kwargs'): if hasattr(message_chunk, 'additional_kwargs'):
reasoning_token = message_chunk.additional_kwargs.get("reasoning_content", "") reasoning_token = message_chunk.additional_kwargs.get("reasoning_content", "")
info(f"💬 消息token: token_content='{repr(token_content[:50])}', reasoning_token='{repr(reasoning_token[:50])}', node_name='{node_name}'")
# 处理思考过程 # 处理思考过程
if reasoning_token: if reasoning_token:
processed_event = { processed_event = {
@@ -226,6 +228,7 @@ class AIAgentService:
"node": node_name, "node": node_name,
"reasoning_token": reasoning_token "reasoning_token": reasoning_token
} }
info(f"✅ 生成 reasoning_token 事件: {processed_event}")
# 处理工具调用 # 处理工具调用
elif hasattr(message_chunk, 'tool_calls') and message_chunk.tool_calls: elif hasattr(message_chunk, 'tool_calls') and message_chunk.tool_calls:
for tool_call in message_chunk.tool_calls: for tool_call in message_chunk.tool_calls:
@@ -253,6 +256,9 @@ class AIAgentService:
"token": token_content, "token": token_content,
"reasoning_token": reasoning_token "reasoning_token": reasoning_token
} }
info(f"✅ 生成 llm_token 事件: {processed_event}")
else:
info(f"⚠️ 没有生成任何事件token_content='{repr(token_content)}', reasoning_token='{repr(reasoning_token)}'")
elif chunk_type == "updates": elif chunk_type == "updates":
info(f"🔄 处理updates chunk") info(f"🔄 处理updates chunk")