fix: 添加详细日志诊断工具调用消息格式
This commit is contained in:
@@ -550,6 +550,16 @@ class LLMService:
|
||||
}
|
||||
|
||||
logger.info(f"工具结果返回LLM: url={url}, model={model}, 消息数={len(final_messages)}")
|
||||
# 打印消息内容(调试)
|
||||
for i, msg in enumerate(final_messages):
|
||||
role = msg.get('role')
|
||||
content_preview = str(msg.get('content', ''))[:100] if msg.get('content') else 'None'
|
||||
if role == 'tool':
|
||||
logger.info(f"消息[{i}] role={role}, tool_call_id={msg.get('tool_call_id')}, content长度={len(msg.get('content',''))}")
|
||||
elif role == 'assistant' and msg.get('tool_calls'):
|
||||
logger.info(f"消息[{i}] role={role}, tool_calls={len(msg['tool_calls'])}")
|
||||
else:
|
||||
logger.info(f"消息[{i}] role={role}, content={content_preview}...")
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=60.0) as client:
|
||||
|
||||
Reference in New Issue
Block a user