mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
roughed in edit, has tiny context window
This commit is contained in:
parent
243033a9d1
commit
b5ef704590
1 changed files with 29 additions and 2 deletions
31
coder.py
31
coder.py
|
@ -101,6 +101,33 @@ class Coder:
|
|||
self.update_files(resp)
|
||||
|
||||
|
||||
def run_edit(self):
|
||||
prompt = ''
|
||||
for fname in self.fnames:
|
||||
prompt += self.quoted_file(fname)
|
||||
|
||||
completion = openai.Edit.create(
|
||||
model="code-davinci-edit-001",
|
||||
instruction= prompt,
|
||||
input=prompt,
|
||||
#max_tokens=2048,
|
||||
temperature=0,
|
||||
)
|
||||
dump(completion)
|
||||
resp = []
|
||||
for chunk in completion:
|
||||
try:
|
||||
text = chunk.choices[0].text
|
||||
resp.append(text)
|
||||
except AttributeError:
|
||||
continue
|
||||
sys.stdout.write(text)
|
||||
sys.stdout.flush()
|
||||
|
||||
resp = ''.join(resp)
|
||||
self.update_files(resp)
|
||||
|
||||
|
||||
|
||||
def run(self):
|
||||
prompt = ''
|
||||
|
@ -167,8 +194,8 @@ coder.system(prompt_webdev)
|
|||
|
||||
dname = Path('../easy-chat')
|
||||
#coder.file(dname / 'chat.css')
|
||||
#coder.file(dname / 'index.html')
|
||||
coder.file(dname / 'chat.js')
|
||||
coder.file(dname / 'index.html')
|
||||
#coder.file(dname / 'chat.js')
|
||||
|
||||
#for fname in coder.fnames:
|
||||
# print(coder.quoted_file(fname))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue