Files
MuWinds 5305754f0b refactor: 重构注释规范、修复类型错误、添加 lint hook 和 CLAUDE.md (#66)
- 后端按 Google Python Style Guide 重构注释,修复 ruff 和 pyright 错误(161→0)
- 前端按 Vue.js Style Guide 重构注释,修复 biome 错误
- 添加 PostToolUse lint hook(ruff + biome 自动检查)
- 更新 CLAUDE.md 覆盖 Commands/Testing/Structure/CodeStyle/GitWorkflow/Boundaries
- 修复 tsconfig.json 废弃的 baseUrl 配置
2026-05-11 23:02:39 +08:00

64 lines
2.1 KiB
Python

"""共享的提示词工具函数。"""
def get_reflection_prompt(error_message, code) -> str:
"""生成代码错误反思提示词。
Args:
error_message: 错误信息。
code: 出错的代码。
Returns:
反思提示词字符串。
"""
return f"""The code execution encountered an error:
{error_message}
Please analyze the error, identify the cause, and provide a corrected version of the code.
Consider:
1. Syntax errors
2. Missing imports
3. Incorrect variable names or types
4. File path issues
5. Any other potential issues
6. If a task repeatedly fails to complete, try breaking down the code, changing your approach, or simplifying the model. If you still can't do it, I'll "chop" you 🪓 and cut your power 😡.
7. Don't ask user any thing about how to do and next to do,just do it by yourself.
Previous code:
{code}
Please provide an explanation of what went wrong and Remenber call the function tools to retry
"""
def get_completion_check_prompt(prompt, text_to_gpt) -> str:
"""生成任务完成检查提示词。
Args:
prompt: 原始任务描述。
text_to_gpt: 最新执行结果。
Returns:
完成检查提示词字符串。
"""
return f"""
Please analyze the current state and determine if the task is fully completed:
Original task: {prompt}
Latest execution results:
{text_to_gpt} # 修改:使用合并后的结果
Consider:
1. Have all required data processing steps been completed?
2. Have all necessary files been saved?
3. Are there any remaining steps needed?
4. Is the output satisfactory and complete?
5. 如果一个任务反复无法完成,尝试切换路径、简化路径或直接跳过,千万别陷入反复重试,导致死循环。
6. 尽量在较少的对话轮次内完成任务
7. If the task is complete, please provide a short summary of what was accomplished and don't call function tool.
8. If the task is not complete, please rethink how to do and call function tool
9. Don't ask user any thing about how to do and next to do,just do it by yourself
10. have a good visualization?
"""