From bbbb9df1127dd586f6e2ad96892db94432b6a2e2 Mon Sep 17 00:00:00 2001 From: Windpicker-owo <3431391539@qq.com> Date: Wed, 27 Aug 2025 17:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=EF=BC=8C=E5=90=8C=E6=97=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?tool=5Fcall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/llm_models/utils_model.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/llm_models/utils_model.py b/src/llm_models/utils_model.py index eb956abff..7c9f19869 100644 --- a/src/llm_models/utils_model.py +++ b/src/llm_models/utils_model.py @@ -328,10 +328,13 @@ class LLMRequest: if not reasoning_content and content: content, extracted_reasoning = self._extract_reasoning(content) reasoning_content = extracted_reasoning - - # 检测是否为空回复或截断 - is_empty_reply = not content or content.strip() == "" + + is_empty_reply = False is_truncated = False + # 检测是否为空回复或截断 + if not tool_calls: + is_empty_reply = not content or content.strip() == "" + is_truncated = False if use_anti_truncation: if content.endswith("[done]"): @@ -370,7 +373,7 @@ class LLMRequest: ) # 处理空回复 - if not content: + if not content and not tool_calls: if raise_when_empty: raise RuntimeError(f"经过 {empty_retry_count} 次重试后仍然生成空回复") content = "生成的响应为空,请检查模型配置或输入内容是否正确"