mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
plain output
This commit is contained in:
parent
69c55becde
commit
1c9025716d
1 changed files with 27 additions and 2 deletions
29
coder.py
29
coder.py
|
@ -251,7 +251,7 @@ MAKE ANY CHANGES BASED OFF THESE FILES!
|
||||||
if show_progress:
|
if show_progress:
|
||||||
return self.show_send_progress(completion, show_progress)
|
return self.show_send_progress(completion, show_progress)
|
||||||
else:
|
else:
|
||||||
return self.show_send_output(completion)
|
return self.show_send_output_plain(completion)
|
||||||
|
|
||||||
def show_send_progress(self, completion, show_progress):
|
def show_send_progress(self, completion, show_progress):
|
||||||
resp = []
|
resp = []
|
||||||
|
@ -271,7 +271,32 @@ MAKE ANY CHANGES BASED OFF THESE FILES!
|
||||||
resp = ''.join(resp)
|
resp = ''.join(resp)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def show_send_output(self, completion):
|
def show_send_output_plain(self, completion):
|
||||||
|
resp = []
|
||||||
|
|
||||||
|
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:
|
||||||
|
text = chunk.choices[0].delta.content
|
||||||
|
resp.append(text)
|
||||||
|
except AttributeError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
sys.stdout.write(text)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def show_send_output_color(self, completion):
|
||||||
resp = []
|
resp = []
|
||||||
|
|
||||||
in_diff = False
|
in_diff = False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue