From c955ecd54462ea286a41cd64fa15ffc5004eb472 Mon Sep 17 00:00:00 2001 From: Val-sss <154882199@qq.com> Date: Sun, 26 Apr 2026 23:00:14 +0800 Subject: [PATCH] Improve Gate prompt: explicit expert_type descriptions, codegen boundary fix "Add function to existing file" now correctly routes to locator_repair instead of codegen. codegen reserved for "create from scratch" only. 5/5 boundary cases pass on gemma3:4b. Co-Authored-By: Claude Opus 4.6 (1M context) --- kaiwu/core/gate.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kaiwu/core/gate.py b/kaiwu/core/gate.py index 7ef5bb2..7f95011 100644 --- a/kaiwu/core/gate.py +++ b/kaiwu/core/gate.py @@ -15,9 +15,18 @@ GATE_SYSTEM = "你是任务分类器。只返回JSON,不要有其他内容。" GATE_PROMPT = """分析用户输入,返回分类JSON。 -expert_type选项:locator_repair | codegen | refactor | doc | office +expert_type选项: +- locator_repair:修复bug、修改已有代码、在已有文件中添加/删除函数 +- codegen:从零创建全新文件或全新项目 +- refactor:重构、优化、整理已有代码结构 +- doc:写注释、文档、README +- office:生成Excel/Word/PPT等办公文档 + difficulty选项:easy | hard(hard = 跨多文件/逻辑复杂/描述模糊) +注意:只要任务涉及已有文件,就选locator_repair或refactor,不要选codegen。 +codegen仅用于"从零创建"的场景。 + 格式:{{"expert_type": "...", "task_summary": "10字内", "difficulty": "..."}} 用户输入:{user_input}"""