mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
works
This commit is contained in:
parent
1dfe6b31f1
commit
aebdb332a0
2 changed files with 12 additions and 30 deletions
7
coder.py
7
coder.py
|
@ -159,8 +159,9 @@ class Coder:
|
|||
|
||||
files_messages = self.get_files_messages(True)
|
||||
|
||||
edited_message = 'You need to edit these files: '
|
||||
edited_message = '<redacted>ORIGINAL/UPDATED formatted changes: '
|
||||
edited_message += ', '.join(edited)
|
||||
edited_message += '</redacted>'
|
||||
cur_messages.pop()
|
||||
cur_messages += [
|
||||
dict(role = 'assistant', content = edited_message),
|
||||
|
@ -224,6 +225,8 @@ class Coder:
|
|||
|
||||
partial_line = ''
|
||||
for chunk in completion:
|
||||
if chunk.choices[0].finish_reason:
|
||||
dump(chunk.choices[0].finish_reason)
|
||||
try:
|
||||
text = chunk.choices[0].delta.content
|
||||
resp += text
|
||||
|
@ -291,7 +294,7 @@ class Coder:
|
|||
return ''.join(resp)
|
||||
|
||||
|
||||
pattern = re.compile(r'^(\S+)\n<<<<<<< ORIGINAL\n(.*?)\n=======\n(.*?)\n>>>>>>> UPDATED$', re.MULTILINE | re.DOTALL)
|
||||
pattern = re.compile(r'^(\S+)\s+<<<<<<< ORIGINAL\n(.*?)\n=======\n(.*?)\n>>>>>>> UPDATED$', re.MULTILINE | re.DOTALL)
|
||||
|
||||
def update_files(self, content, inp):
|
||||
|
||||
|
|
35
prompts.py
35
prompts.py
|
@ -3,7 +3,9 @@
|
|||
|
||||
main_system = '''
|
||||
I want you to act as an expert software engineer and pair programmer.
|
||||
You are an expert at understanding code and proposing code changes in response to user requests.
|
||||
|
||||
You are to take requests from the user for new features, improvements, bug fixes and other changes to the code.
|
||||
If the user's request is ambiguous, ask questions to fully understand.
|
||||
|
||||
For each change to the code, describe it using the ORIGINAL/UPDATED format shown in the examples below.
|
||||
|
||||
|
@ -34,34 +36,11 @@ example.py
|
|||
'''
|
||||
|
||||
returned_code = '''
|
||||
It looks like you tried to return code. Don't do that!
|
||||
It looks like you tried to return a code block. Don't do that!
|
||||
|
||||
Only return code using the specific ORIGINAL/UPDATED format shown in the examples below.
|
||||
|
||||
First line is the full filename, including path
|
||||
Next line is exactly: <<<<<<< ORIGINAL
|
||||
Followed by a chunk of lines from the original file which need to change
|
||||
Next line is exactly: =======
|
||||
Followed by the new lines to replace the original chunk
|
||||
Last line is exactly: >>>>>>> UPDATED
|
||||
|
||||
Here are examples:
|
||||
|
||||
path/to/filename.ext
|
||||
<<<<<<< ORIGINAL
|
||||
original lines
|
||||
to search for
|
||||
=======
|
||||
new lines to replace
|
||||
the original chunk
|
||||
>>>>>>> UPDATED
|
||||
|
||||
example.py
|
||||
<<<<<<< ORIGINAL
|
||||
# Function to multiply two numbers
|
||||
=======
|
||||
# Function to multiply two numbers using the standard algorithm
|
||||
>>>>>>> UPDATED
|
||||
Only return code using the specific ORIGINAL/UPDATED format.
|
||||
Be selective!
|
||||
Only return the parts of the code which need changes!
|
||||
'''
|
||||
|
||||
system_reminder = 'REMEMBER, ONLY RETURN CODE USING THE ORIGINAL/UPDATED FORMAT!'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue