From 9048d94e33a3365c1a3d17fc22a31d83ceeb1968 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Wed, 15 Apr 2026 02:25:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E8=AF=A6=E7=BB=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AF=8A=E6=96=AD=E5=B7=A5=E5=85=B7=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=B6=88=E6=81=AF=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/llm_service.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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: