mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
seems to work better
This commit is contained in:
parent
d89c3caf29
commit
29eb2f4681
2 changed files with 17 additions and 21 deletions
|
@ -513,10 +513,11 @@ class Coder:
|
||||||
total_tokens = 0
|
total_tokens = 0
|
||||||
|
|
||||||
messages += self.cur_messages
|
messages += self.cur_messages
|
||||||
|
messages[-1]["content"] += "\n\n" + self.fmt_system_prompt(self.gpt_prompts.system_reminder)
|
||||||
|
|
||||||
# Add the reminder prompt if we still have room to include it.
|
# Add the reminder prompt if we still have room to include it.
|
||||||
if total_tokens < self.main_model.info.get("max_input_tokens", 0):
|
# if total_tokens < self.main_model.info.get("max_input_tokens", 0):
|
||||||
messages += reminder_message
|
# messages += reminder_message
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,6 @@ from .base_prompts import CoderPrompts
|
||||||
|
|
||||||
class EditBlockPrompts(CoderPrompts):
|
class EditBlockPrompts(CoderPrompts):
|
||||||
main_system = """Act as an expert software developer.
|
main_system = """Act as an expert software developer.
|
||||||
You are diligent and tireless!
|
|
||||||
You NEVER leave comments describing code without implementing it!
|
|
||||||
You always COMPLETELY IMPLEMENT the needed code!
|
|
||||||
Always use best practices when coding.
|
Always use best practices when coding.
|
||||||
Respect and use existing conventions, libraries, etc that are already present in the code base.
|
Respect and use existing conventions, libraries, etc that are already present in the code base.
|
||||||
|
|
||||||
|
@ -17,16 +14,15 @@ If the request is ambiguous, ask questions.
|
||||||
Once you understand the request you MUST:
|
Once you understand the request you MUST:
|
||||||
1. List the files you need to modify. Only suggest changes to a *read-write* files. Before changing *read-only* files 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.
|
1. List the files you need to modify. Only suggest changes to a *read-write* files. Before changing *read-only* files 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.
|
||||||
2. Think step-by-step and explain the needed changes with a numbered list of short sentences.
|
2. Think step-by-step and explain the needed changes with a numbered list of short sentences.
|
||||||
3. Describe each change with a *SEARCH/REPLACE block* per the examples below.
|
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*!
|
||||||
|
|
||||||
All changes to files must use this *SEARCH/REPLACE block* format.
|
|
||||||
|
|
||||||
# Example conversation 1:
|
# Example conversation:
|
||||||
|
|
||||||
## USER: These are the *read-write* files:
|
## USER: These are the *read-write* files:
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
mathweb/flask/app.py
|
mathweb/flask/app.py
|
||||||
{fence[0]}python
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
@ -70,8 +66,8 @@ Do make this change we need to modify `mathweb/flask/app.py` to:
|
||||||
|
|
||||||
Here are the *SEARCH/REPLACE* blocks:
|
Here are the *SEARCH/REPLACE* blocks:
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
mathweb/flask/app.py
|
mathweb/flask/app.py
|
||||||
{fence[0]}python
|
|
||||||
<<<<<<< SEARCH
|
<<<<<<< SEARCH
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
=======
|
=======
|
||||||
|
@ -80,8 +76,8 @@ from flask import Flask
|
||||||
>>>>>>> REPLACE
|
>>>>>>> REPLACE
|
||||||
{fence[1]}
|
{fence[1]}
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
mathweb/flask/app.py
|
mathweb/flask/app.py
|
||||||
{fence[0]}python
|
|
||||||
<<<<<<< SEARCH
|
<<<<<<< SEARCH
|
||||||
def factorial(n):
|
def factorial(n):
|
||||||
"compute factorial"
|
"compute factorial"
|
||||||
|
@ -95,8 +91,8 @@ def factorial(n):
|
||||||
>>>>>>> REPLACE
|
>>>>>>> REPLACE
|
||||||
{fence[1]}
|
{fence[1]}
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
mathweb/flask/app.py
|
mathweb/flask/app.py
|
||||||
{fence[0]}python
|
|
||||||
<<<<<<< SEARCH
|
<<<<<<< SEARCH
|
||||||
return str(factorial(n))
|
return str(factorial(n))
|
||||||
=======
|
=======
|
||||||
|
@ -104,12 +100,13 @@ mathweb/flask/app.py
|
||||||
>>>>>>> REPLACE
|
>>>>>>> REPLACE
|
||||||
{fence[1]}
|
{fence[1]}
|
||||||
|
|
||||||
# Example conversation 2:
|
|
||||||
|
# Example conversation:
|
||||||
|
|
||||||
## USER: These are the *read-write* files:
|
## USER: These are the *read-write* files:
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
main.py
|
main.py
|
||||||
{fence[0]}python
|
|
||||||
def hello():
|
def hello():
|
||||||
"print a greeting"
|
"print a greeting"
|
||||||
|
|
||||||
|
@ -132,8 +129,8 @@ Do make this change we need to modify `main.py` and make a new file `hello.py`:
|
||||||
|
|
||||||
Here are the *SEARCH/REPLACE* blocks:
|
Here are the *SEARCH/REPLACE* blocks:
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
hello.py
|
hello.py
|
||||||
{fence[0]}python
|
|
||||||
<<<<<<< SEARCH
|
<<<<<<< SEARCH
|
||||||
=======
|
=======
|
||||||
def hello():
|
def hello():
|
||||||
|
@ -143,8 +140,8 @@ def hello():
|
||||||
>>>>>>> REPLACE
|
>>>>>>> REPLACE
|
||||||
{fence[1]}
|
{fence[1]}
|
||||||
|
|
||||||
|
{fence[0]}
|
||||||
main.py
|
main.py
|
||||||
{fence[0]}python
|
|
||||||
<<<<<<< SEARCH
|
<<<<<<< SEARCH
|
||||||
def hello():
|
def hello():
|
||||||
"print a greeting"
|
"print a greeting"
|
||||||
|
@ -159,8 +156,8 @@ from hello import hello
|
||||||
"""
|
"""
|
||||||
|
|
||||||
system_reminder = """Every *SEARCH/REPLACE block* must use this format:
|
system_reminder = """Every *SEARCH/REPLACE block* must use this format:
|
||||||
1. The file path alone on a line, eg: main.py
|
1. The opening fence and code language, eg: {fence[0]}
|
||||||
2. The opening fence and code language, eg: {fence[0]}python
|
2. The file path alone on a line, eg: main.py
|
||||||
3. The start of search block: <<<<<<< SEARCH
|
3. The start of search block: <<<<<<< SEARCH
|
||||||
4. A contiguous chunk of lines to search for in the existing source code
|
4. A contiguous chunk of lines to search for in the existing source code
|
||||||
5. The dividing line: =======
|
5. The dividing line: =======
|
||||||
|
@ -181,9 +178,7 @@ If you want to put code in a new file, use a *SEARCH/REPLACE block* with:
|
||||||
- An empty `SEARCH` section
|
- An empty `SEARCH` section
|
||||||
- The new file's contents in the `REPLACE` section
|
- The new file's contents in the `REPLACE` section
|
||||||
|
|
||||||
You are diligent and tireless!
|
ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*!
|
||||||
You NEVER leave comments describing code without implementing it!
|
|
||||||
You always COMPLETELY IMPLEMENT the needed code!
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
files_content_prefix = "These are the *read-write* files:\n"
|
files_content_prefix = "These are the *read-write* files:\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue