From be264884a22f868c6a7fcb62589a59234e63e1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Sat, 13 Dec 2025 11:21:16 +0800 Subject: [PATCH] add think tag --- agent/guideline_middleware.py | 8 +++++++- prompt/guideline_prompt.md | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/agent/guideline_middleware.py b/agent/guideline_middleware.py index 92441f4..9e0eb9e 100644 --- a/agent/guideline_middleware.py +++ b/agent/guideline_middleware.py @@ -126,7 +126,13 @@ Action: Provide concise, friendly, and personified natural responses. config={"callbacks": [ThinkingCallbackHandler()]} ) - response.additional_kwargs["thinking"] = response.content + # 提取之间的内容作为thinking + import re + match = re.search(r'(.*?)', response.content, re.DOTALL) + if match: + response.additional_kwargs["thinking"] = match.group(1).strip() + else: + response.additional_kwargs["thinking"] = response.content messages = state['messages']+[response] return { diff --git a/prompt/guideline_prompt.md b/prompt/guideline_prompt.md index 729cae0..a8aaa91 100644 --- a/prompt/guideline_prompt.md +++ b/prompt/guideline_prompt.md @@ -56,8 +56,9 @@ **语言要求**:所有用户交互和结果输出,必须使用[{language}] ## 输出格式 -按顺序输出执行步骤: +按顺序输出执行步骤, 用标签包裹,输出格式如下: + ### 🎯 核心目标 [简洁描述用户的主要目标] @@ -70,4 +71,4 @@ **执行步骤**: [按1,2,3...n顺序列出执行步骤] -我现在将根据以上分析,按照计划阶段的执行步骤,开始执行任务。 \ No newline at end of file +