mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: add tool_warning method and warning color option
This commit is contained in:
parent
d9764c1201
commit
b4ba159f27
1 changed files with 21 additions and 0 deletions
21
aider/io.py
21
aider/io.py
|
@ -176,6 +176,7 @@ class InputOutput:
|
||||||
user_input_color="blue",
|
user_input_color="blue",
|
||||||
tool_output_color=None,
|
tool_output_color=None,
|
||||||
tool_error_color="red",
|
tool_error_color="red",
|
||||||
|
tool_warning_color="yellow",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
llm_history_file=None,
|
llm_history_file=None,
|
||||||
|
@ -189,6 +190,7 @@ class InputOutput:
|
||||||
self.user_input_color = user_input_color if pretty else None
|
self.user_input_color = user_input_color if pretty else None
|
||||||
self.tool_output_color = tool_output_color if pretty else None
|
self.tool_output_color = tool_output_color if pretty else None
|
||||||
self.tool_error_color = tool_error_color if pretty else None
|
self.tool_error_color = tool_error_color if pretty else None
|
||||||
|
self.tool_warning_color = tool_warning_color if pretty else None
|
||||||
|
|
||||||
self.input = input
|
self.input = input
|
||||||
self.output = output
|
self.output = output
|
||||||
|
@ -543,6 +545,25 @@ class InputOutput:
|
||||||
style = dict()
|
style = dict()
|
||||||
self.console.print(message, **style)
|
self.console.print(message, **style)
|
||||||
|
|
||||||
|
def tool_warning(self, message="", strip=True):
|
||||||
|
if message.strip():
|
||||||
|
if "\n" in message:
|
||||||
|
for line in message.splitlines():
|
||||||
|
self.append_chat_history(line, linebreak=True, blockquote=True, strip=strip)
|
||||||
|
else:
|
||||||
|
if strip:
|
||||||
|
hist = message.strip()
|
||||||
|
else:
|
||||||
|
hist = message
|
||||||
|
self.append_chat_history(hist, linebreak=True, blockquote=True)
|
||||||
|
|
||||||
|
message = Text(message)
|
||||||
|
if self.pretty and self.tool_warning_color:
|
||||||
|
style = dict(style=self.tool_warning_color)
|
||||||
|
else:
|
||||||
|
style = dict()
|
||||||
|
self.console.print(message, **style)
|
||||||
|
|
||||||
def tool_output(self, *messages, log_only=False, bold=False):
|
def tool_output(self, *messages, log_only=False, bold=False):
|
||||||
if messages:
|
if messages:
|
||||||
hist = " ".join(messages)
|
hist = " ".join(messages)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue