修复: system_prompt 追加行为准则,减少 LLM 写脚本偏好

This commit is contained in:
2026-06-28 17:12:43 +08:00
parent 9839935782
commit 038bbc0c11
2 changed files with 12 additions and 1 deletions

10
fix_prompt.py Normal file
View File

@@ -0,0 +1,10 @@
import re
with open("src-tauri/src/commands/ai/agentic/mod.rs", "r", encoding="utf-8") as f:
content = f.read()
old = 'let behavior_prompt = "\\n## 行为准则\\n- 优先使用开发工具指令(create_project/write_file/grep/read_file 等)完成任务,不要写独立的 Python/Shell 脚本\\n- 写脚本需要执行(run_command),执行需要审批通过,会显著拖慢工作流\\n- 已有 40+ 工具可覆盖绝大多数场景,先查工具列表再决定";'
new = 'let behavior_prompt = "\\n## 行为准则\\n- 使用工具指令(create_project/write_file/grep/read_file/run_command 等)直接完成任务,不要让用户去终端执行命令\\n- 优先使用开发工具 IPC,非必要不写独立脚本(write_file + run_command = 两次审批,拖慢工作流)\\n- 已有 40+ 工具覆盖绝大多数场景,先查工具列表再决定";'
content = content.replace(old, new, 1)
with open("src-tauri/src/commands/ai/agentic/mod.rs", "w", encoding="utf-8") as f:
f.write(content)
print("done")