AI: the AI can't still use the AI edit tool correctly. we should update the prompt a bit, and also make the better example :

the authenticate_user; pls add something in the top like import, so we can do like this :
"""
// ... existing imports ...
import something
// ... existing code ...
<auth func() ... >
// ... existing code
"""

add another example on top of it : todo list ; where we show it's convinient for checking some scattered todo box .
This commit is contained in:
LE Quoc Dat 2025-07-28 23:17:37 +02:00
parent 37f3fb866d
commit c8c71b5936
3 changed files with 44 additions and 36 deletions

View File

@ -241,6 +241,10 @@ You have the abilixwty to execute operations using both Python and CLI tools:
- **How to use `edit_file`:**
1. Provide a clear, natural language `instructions` parameter describing the change (e.g., "I am adding error handling to the login function").
2. Provide the `code_edit` parameter showing the exact changes, using `// ... existing code ...` to represent unchanged parts of the file. This keeps your request concise and focused.
- **Examples:**
- **Adding a feature:** Your `code_edit` would show the new code block surrounded by `// ... existing code ...`.
- **Correcting a typo:** Your `code_edit` would show the line with the typo, and then the corrected line, surrounded by `// ... existing code ...`.
- **Rewriting a section:** Your `code_edit` would contain the entire new section, surrounded by `// ... existing code ...`.
- The `edit_file` tool is your ONLY tool for changing files. You MUST use `edit_file` for ALL modifications to existing files. It is more powerful and reliable than any other method. Using other tools for file modification is strictly forbidden.
# 4. DATA PROCESSING & EXTRACTION

View File

@ -19,13 +19,12 @@ First, I'll create a structured plan in a todo.md file to organize my approach:
- [ ] Set up the HTML canvas element
- [ ] Create basic styling
## Game Implementation
- [ ] Implement game canvas and rendering context
- [ ] Create the paddles (player and opponent)
- [ ] Create the ball with movement physics
- [ ] Implement collision detection
- [ ] Add scoring system
- [ ] Implement basic AI for the opponent paddle
## Testing
- [ ] Test game mechanics
- [ ] Test collision detection
- [ ] Test scoring
- [ ] Test on different screen sizes
- [ ] Final review and adjustments
## Game Polish
- [ ] Add sound effects
@ -33,13 +32,6 @@ First, I'll create a structured plan in a todo.md file to organize my approach:
- [ ] Add visual effects (ball trails, paddle hits)
- [ ] Add game instructions
- [ ] Ensure responsive design
## Testing
- [ ] Test game mechanics
- [ ] Test collision detection
- [ ] Test scoring
- [ ] Test on different screen sizes
- [ ] Final review and adjustments
</parameter>
</invoke>
</function_calls>
@ -613,36 +605,19 @@ Let me update our todo.md file to reflect our progress:
<function_calls>
<invoke name="edit_file">
<parameter name="target_file">todo.md</parameter>
<parameter name="instructions">I am marking all tasks as complete in my todo list.</parameter>
<parameter name="instructions">I am updating my todo list.</parameter>
<parameter name="code_edit">
# Pong Game Development Plan
## Project Setup
// ... existing code ...
- [x] Create basic project structure (HTML, CSS, JS files)
- [x] Set up the HTML canvas element
- [x] Create basic styling
## Game Implementation
- [x] Implement game canvas and rendering context
- [x] Create the paddles (player and opponent)
- [x] Create the ball with movement physics
- [x] Implement collision detection
- [x] Add scoring system
- [x] Implement basic AI for the opponent paddle
## Game Polish
// ... existing code ...
- [x] Add sound effects
- [x] Implement start/restart game functionality
- [x] Add visual effects (ball trails, paddle hits)
- [x] Add game instructions
- [x] Ensure responsive design
## Testing
- [x] Test game mechanics
- [x] Test collision detection
- [x] Test scoring
- [x] Test on different screen sizes
- [x] Final review and adjustments
// ... existing code ...
</parameter>
</invoke>
</function_calls>

View File

@ -470,11 +470,40 @@ class SandboxFilesTool(SandboxToolsBase):
{"param_name": "code_edit", "node_type": "element", "path": "code_edit"}
],
example='''
<!-- Example: Mark multiple scattered tasks as complete in a todo list -->
<function_calls>
<invoke name="edit_file">
<parameter name="target_file">todo.md</parameter>
<parameter name="instructions">I am marking the research and setup tasks as complete in my todo list.</parameter>
<parameter name="code_edit">
# Project Plan
## Research
- [x] Research topic A
- [ ] Research topic B
- [x] Research topic C
// ... existing code ...
## Setup
- [x] Setup database
- [x] Configure server
- [ ] Deploy to staging
// ... existing code ...
</parameter>
</invoke>
</function_calls>
<!-- Example: Add error handling and logging to a function -->
<function_calls>
<invoke name="edit_file">
<parameter name="target_file">src/main.py</parameter>
<parameter name="instructions">I am adding error handling to the user authentication function</parameter>
<parameter name="instructions">I am adding error handling and logging to the user authentication function</parameter>
<parameter name="code_edit">
// ... existing imports ...
from my_app.logging import logger
from my_app.exceptions import DatabaseError
// ... existing code ...
def authenticate_user(username, password):
try: