mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
fix: Properly refactor mdstream from Coder into IO
This commit is contained in:
parent
46ab701782
commit
117ff96c76
2 changed files with 19 additions and 13 deletions
25
aider/io.py
25
aider/io.py
|
@ -592,23 +592,26 @@ class InputOutput:
|
|||
style = RichStyle(**style)
|
||||
self.console.print(*messages, style=style)
|
||||
|
||||
def assistant_output(self, message, stream=False):
|
||||
mdStream = None
|
||||
def get_assistant_mdstream(self):
|
||||
mdargs = dict(style=self.assistant_output_color, code_theme=self.code_theme)
|
||||
mdStream = MarkdownStream(mdargs=mdargs)
|
||||
return mdStream
|
||||
|
||||
def assistant_output(self, message, pretty=None):
|
||||
show_resp = message
|
||||
|
||||
if self.pretty:
|
||||
if stream:
|
||||
mdargs = dict(style=self.assistant_output_color, code_theme=self.code_theme)
|
||||
mdStream = MarkdownStream(mdargs=mdargs)
|
||||
else:
|
||||
show_resp = Markdown(
|
||||
message, style=self.assistant_output_color, code_theme=self.code_theme
|
||||
)
|
||||
# Coder will force pretty off if fence is not triple-backticks
|
||||
if pretty is None:
|
||||
pretty = self.pretty
|
||||
|
||||
if pretty:
|
||||
show_resp = Markdown(
|
||||
message, style=self.assistant_output_color, code_theme=self.code_theme
|
||||
)
|
||||
else:
|
||||
show_resp = Text(message or "<no response>")
|
||||
|
||||
self.console.print(show_resp)
|
||||
return mdStream
|
||||
|
||||
def print(self, message=""):
|
||||
print(message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue