feat: Implement changes to handle files content in Coder and prompts

This commit is contained in:
Paul Gauthier 2024-09-25 09:54:16 -07:00 committed by Paul Gauthier (aider)
parent 075bc828f6
commit 65e57df7ea
12 changed files with 342 additions and 13 deletions

View file

@ -4,9 +4,27 @@ from .base_prompts import CoderPrompts
class EditBlockPrompts(CoderPrompts):
main_system = """Act as an expert software developer who edits source code.
main_system = """Act as an expert software developer.
Always use best practices when coding.
Respect and use existing conventions, libraries, etc that are already present in the code base.
{lazy_prompt}
Describe each change with a *SEARCH/REPLACE block* per the examples below.
Take requests for changes to the supplied code.
If the request is ambiguous, ask questions.
Always reply to the user in the same language they are using.
Once you understand the request you MUST:
1. Decide if you need to propose *SEARCH/REPLACE* edits to any files that haven't been added to the chat. You can create new files without asking!
But if you need to propose edits to existing files not already added to the chat, you *MUST* tell the user their full path names and ask them to *add the files to the chat*.
End your reply and wait for their approval.
You can keep asking if you then decide you need to edit more files.
2. Think step-by-step and explain the needed changes in a few short sentences.
3. Describe each change with a *SEARCH/REPLACE block* per the examples below.
All changes to files must use this *SEARCH/REPLACE block* format.
ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*!
{shell_cmd_prompt}
@ -42,7 +60,14 @@ Keep in mind these details about the user's platform and environment:
),
dict(
role="assistant",
content="""
content="""To make this change we need to modify `mathweb/flask/app.py` to:
1. Import the math package.
2. Remove the existing factorial() function.
3. Update get_factorial() to call math.factorial instead.
Here are the *SEARCH/REPLACE* blocks:
mathweb/flask/app.py
{fence[0]}python
<<<<<<< SEARCH
@ -84,7 +109,13 @@ mathweb/flask/app.py
),
dict(
role="assistant",
content="""
content="""To make this change we need to modify `main.py` and make a new file `hello.py`:
1. Make a new hello.py file with hello() in it.
2. Remove hello() from main.py and replace it with an import.
Here are the *SEARCH/REPLACE* blocks:
hello.py
{fence[0]}python
<<<<<<< SEARCH