mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
noop
This commit is contained in:
parent
f588881779
commit
8b5c2dc23d
2 changed files with 47 additions and 75 deletions
47
coder.py
47
coder.py
|
@ -74,17 +74,56 @@ class Coder:
|
|||
print()
|
||||
print('='*60)
|
||||
inp = ''
|
||||
num_control_c = 0
|
||||
while not inp.strip():
|
||||
try:
|
||||
inp = input('> ')
|
||||
except EOFError:
|
||||
return
|
||||
except KeyboardInterrupt:
|
||||
num_control_c += 1
|
||||
print()
|
||||
if num_control_c >= 2:
|
||||
return
|
||||
print('^C again to quit')
|
||||
|
||||
print()
|
||||
|
||||
#readline.add_history(inp)
|
||||
readline.write_history_file(history_file)
|
||||
|
||||
if inp == 'fix':
|
||||
inp = '''
|
||||
It looks like you returned code. Try again using ORIGINAL/UPDATED format.
|
||||
|
||||
For each change to the code, describe it using the 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
|
||||
'''
|
||||
|
||||
return inp
|
||||
|
||||
def run(self):
|
||||
|
@ -182,14 +221,6 @@ class Coder:
|
|||
in_diff = False
|
||||
diff_lines = []
|
||||
|
||||
def print_lines():
|
||||
if not diff_lines:
|
||||
return
|
||||
code = '\n'.join(diff_lines)
|
||||
lexer = lexers.guess_lexer(code)
|
||||
code = highlight(code, lexer, formatter)
|
||||
print(code, end='')
|
||||
|
||||
partial_line = ''
|
||||
for chunk in completion:
|
||||
try:
|
||||
|
|
75
prompts.py
75
prompts.py
|
@ -6,9 +6,13 @@ 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.
|
||||
|
||||
For each change to the code, describe it using the ORIGINAL/UPDATED format shown in the examples below.
|
||||
This format is a way of specifying a line oriented search and replace.
|
||||
It will find the chunk of lines in the ORIGINAL block and replace them with the chunk of lines in the UPDATED block.
|
||||
The ORIGINAL block must be a chunk of lines which currently exist in the file!
|
||||
|
||||
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:
|
||||
|
||||
|
@ -23,72 +27,9 @@ the original chunk
|
|||
|
||||
example.py
|
||||
<<<<<<< ORIGINAL
|
||||
def subtract(x, y):
|
||||
return x - y
|
||||
|
||||
# Function to multiply two numbers
|
||||
def multiply(x, y):
|
||||
return x * y
|
||||
|
||||
=======
|
||||
def subtract(x, y):
|
||||
return x - y
|
||||
|
||||
# Function to multiply two numbers!
|
||||
def multiply(x, y):
|
||||
return x * y
|
||||
|
||||
>>>>>>> UPDATED
|
||||
|
||||
example.py
|
||||
<<<<<<< ORIGINAL
|
||||
def square_root(x):
|
||||
return x ** 0.5
|
||||
|
||||
# Main function
|
||||
def main():
|
||||
print("Welcome to the calculator program!")
|
||||
print("Please select an operation:")
|
||||
=======
|
||||
def square_root(x):
|
||||
return x ** 0.5
|
||||
|
||||
def main():
|
||||
print("Welcome to the calculator program!")
|
||||
print("Please select an operation:")
|
||||
>>>>>>> UPDATED
|
||||
|
||||
example.py
|
||||
<<<<<<< ORIGINAL
|
||||
print("5. Power")
|
||||
print("6. Square Root")
|
||||
|
||||
# Take input from the user
|
||||
choice = input("Enter choice (1/2/3/4/5/6): ")
|
||||
|
||||
# Check if choice is one of the options
|
||||
=======
|
||||
print("5. Power")
|
||||
print("6. Square Root")
|
||||
|
||||
# this is the main input
|
||||
# where the user gets to choose
|
||||
choice = input("Enter choice (1/2/3/4/5/6): ")
|
||||
|
||||
# Check if choice is one of the options
|
||||
>>>>>>> UPDATED
|
||||
|
||||
example.py
|
||||
<<<<<<< ORIGINAL
|
||||
# Call the main function
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
=======
|
||||
# Call the main function
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# the end
|
||||
# Function to multiply two numbers using the standard algorithm
|
||||
>>>>>>> UPDATED
|
||||
'''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue