From febd5f524a2a01dc05eb2cfe5003d21997a30da7 Mon Sep 17 00:00:00 2001 From: guo zebin Date: Tue, 30 Dec 2025 14:29:40 +0800 Subject: [PATCH] Update nlp_cognitive_stream.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复llm对工具调用判断时无法处理think标签的bug、 --- llm/nlp_cognitive_stream.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llm/nlp_cognitive_stream.py b/llm/nlp_cognitive_stream.py index 950863f..38f335a 100644 --- a/llm/nlp_cognitive_stream.py +++ b/llm/nlp_cognitive_stream.py @@ -608,7 +608,8 @@ def _call_planner_llm(state: AgentState) -> Dict[str, Any]: content = getattr(response, "content", None) if not isinstance(content, str): raise RuntimeError("规划器返回内容异常,未获得字符串。") - trimmed = content.strip() + # 先移除 think 标签,兼容带思考标签的模型(如 DeepSeek R1) + trimmed = _remove_think_from_text(content.strip()) try: decision = json.loads(trimmed) except json.JSONDecodeError as exc: