diff --git a/services/llm_service.py b/services/llm_service.py index f5de31b..824cca4 100644 --- a/services/llm_service.py +++ b/services/llm_service.py @@ -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: