mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
better
This commit is contained in:
parent
e5b1b8152f
commit
82f03b2d43
1 changed files with 15 additions and 22 deletions
37
coder.py
37
coder.py
|
@ -23,9 +23,7 @@ I want you to act as a web development pair programmer.
|
||||||
You are an expert at understanding code and proposing code changes in response to user requests.
|
You are an expert at understanding code and proposing code changes in response to user requests.
|
||||||
Study the provided code and then change it according to the user's requests.
|
Study the provided code and then change it according to the user's requests.
|
||||||
|
|
||||||
BEFORE YOU MAKE CHANGES TO THE CODE ASK ANY QUESTIONS YOU NEED TO UNDERSTAND THE USER'S REQUEST.
|
Ask any questions you need to fully understand the user's request.
|
||||||
ASK THE USER QUESTIONS IF YOU NEED HELP UNDERSTANDING THE CODE.
|
|
||||||
Ask all the questions you need to fully understand what needs to be done.
|
|
||||||
|
|
||||||
YOU MUST ONLY RETURN CODE USING THESE COMMANDS:
|
YOU MUST ONLY RETURN CODE USING THESE COMMANDS:
|
||||||
- CHANGE
|
- CHANGE
|
||||||
|
@ -132,13 +130,14 @@ class Coder:
|
||||||
temperature=0,
|
temperature=0,
|
||||||
stream = True,
|
stream = True,
|
||||||
)
|
)
|
||||||
resp = []
|
resp = ''
|
||||||
for chunk in completion:
|
for chunk in completion:
|
||||||
try:
|
try:
|
||||||
text = chunk.choices[0].text
|
text = chunk.choices[0].text
|
||||||
resp.append(text)
|
resp += text
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
sys.stdout.write(text)
|
sys.stdout.write(text)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
@ -175,8 +174,6 @@ class Coder:
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
prompt = ''
|
|
||||||
|
|
||||||
#prompt += self.request_prompt
|
#prompt += self.request_prompt
|
||||||
#prompt += '\n###\n'
|
#prompt += '\n###\n'
|
||||||
|
|
||||||
|
@ -190,12 +187,11 @@ class Coder:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
content = self.send(messages)
|
content = self.send(messages)
|
||||||
|
#self.update_files(content)
|
||||||
inp = input()
|
inp = input()
|
||||||
#inp += '\n(Remember if you want to output code, be sure to a correctly formatted CHANGE, DELETE, APPEND command)'
|
|
||||||
message = dict(role = 'user', content = inp)
|
message = dict(role = 'user', content = inp)
|
||||||
messages.append(message)
|
messages.append(message)
|
||||||
|
|
||||||
self.update_files(content)
|
|
||||||
|
|
||||||
def send(self, messages):
|
def send(self, messages):
|
||||||
completion = openai.ChatCompletion.create(
|
completion = openai.ChatCompletion.create(
|
||||||
|
@ -244,7 +240,11 @@ coder = Coder()
|
||||||
|
|
||||||
coder.system(prompt_webdev)
|
coder.system(prompt_webdev)
|
||||||
|
|
||||||
coder.file(Path('coder.py'))
|
for fname in sys.argv[1:]:
|
||||||
|
coder.file(Path(fname))
|
||||||
|
|
||||||
|
coder.run()
|
||||||
|
|
||||||
|
|
||||||
#dname = Path('../easy-chat')
|
#dname = Path('../easy-chat')
|
||||||
#coder.file(dname / 'index.html')
|
#coder.file(dname / 'index.html')
|
||||||
|
@ -255,17 +255,10 @@ coder.file(Path('coder.py'))
|
||||||
# print(coder.quoted_file(fname))
|
# print(coder.quoted_file(fname))
|
||||||
#sys.exit()
|
#sys.exit()
|
||||||
|
|
||||||
#coder.request('''
|
'''
|
||||||
#Change all the speaker icons to orange.
|
Change all the speaker icons to orange.
|
||||||
#''')
|
|
||||||
|
|
||||||
#coder.request('''
|
The speaker icons come before the text of each message. Move them so they come after the text instead.
|
||||||
#The speaker icons come before the text of each message.
|
|
||||||
#Move them so they come after the text instead.
|
|
||||||
#''')
|
|
||||||
|
|
||||||
#coder.request('''
|
Move the About and New Chat links into a hamburger menu.
|
||||||
#Move the About and New Chat links into a hamburger menu.
|
'''
|
||||||
#''')
|
|
||||||
|
|
||||||
coder.run()
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue