From 3c02ba43adaea969ee4feb06d7e1749f52bd7bc6 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 29 Jul 2026 21:23:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?AskUserTool=20=E5=86=85=E7=BD=AE=E6=8A=80?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aibox/main.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/aibox/main.py b/aibox/main.py index 469b245..5ba567d 100644 --- a/aibox/main.py +++ b/aibox/main.py @@ -4268,6 +4268,36 @@ class ReloadSkillsTool(Tool): output_queue.put(("complete", result)) +# ==================== 询问工具 ======================== +class AskUserTool(Tool): + """智能体遇到了麻烦,主动向用户问一个问题""" + + def get_name(self) -> str: + return "ask_user" + + def get_description(self) -> str: + return "你遇到了一个问题,想向用户询问一个问题的工具。" + + def get_parameters(self) -> Dict: + ''' TODO: 调用子代理生成提示词 ''' + return { + "type": "object", + "properties": { + "question": { + "type": "string", + "description": ( + "你现在遇到一个问题,你想询问用户,现在提供你的问题。" + ) + } + }, + "required": [] + } + + def execute(self, question: str, **kwargs) -> str: + return ( + "你遇到了想搞清楚的事情: " + question + "\n你现在可以询问用户。" + ) + # ==================== 安装技能工具 ==================== class InstallSkillTool(Tool): @@ -6547,6 +6577,9 @@ class DeepSeekChat: # 增强版保存记忆并结束对话工具 if exit_callback and self.memory_db: builtin_tools.append(SaveMemoryAndEndConversationTool(exit_callback, self.memory_db, self.prompt_manager, self.logger)) + + # 添加询问用户的工具 + builtin_tools.append(AskUserTool(self.logger)) # 添加技能热重载工具 & 技能安装指引工具 & 创建技能工具 builtin_tools.append(ReloadSkillsTool(self.tool_registry, self.logger)) From e6e5dab4cdd292506aa2ea1dbb5414a21dfb611a Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 29 Jul 2026 21:54:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=99=BA=E8=83=BD=E4=BD=93=E6=8F=90?= =?UTF-8?q?=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aibox/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aibox/main.py b/aibox/main.py index 5ba567d..eae4ce1 100644 --- a/aibox/main.py +++ b/aibox/main.py @@ -2894,9 +2894,12 @@ class TaskScheduler: 2. 根据任务内容进行适当的操作和回答 3. 任务处理完成后,如果不需要继续对话,可以结束对话 4. 系统已经自动更新了任务状态(更新了执行时间和次数),你不需要手动处理任务完成逻辑 + 5. 不要在任务执行过程中创建新的定时任务(除非任务明确要求),也不要向用户提问(因为此对话是自动触发的) 请现在开始处理这个任务。 """ + + user_input = focus_prompt + "\n\n" + user_input result = "任务已触发AI对话" @@ -6852,7 +6855,11 @@ class DeepSeekChat: ## 第二步:搜索相关记忆 在每次回答用户问题前,**必须**使用 `memory search` 工具搜索记忆库中与当前话题相关的记忆,确保回答的连贯性和准确性。 - ## 第三步:执行任务或回答问题 + ## 第三步:积极向用户提问 + 如果你有任何无法确定的事情,那么你需要用户提供额外信息, + 请务必使用 `ask_user` 工具向用户提问,以便获得更准确的指引。 + + ## 第四步:执行任务或回答问题 根据搜索结果,选择合适的工具或直接回答。 【重要提醒】