Files
DevFlow/fix_prompt.py

11 lines
1004 B
Python

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")