Handle multiline tool_error() better

This commit is contained in:
Paul Gauthier 2024-05-13 11:42:22 -07:00
parent ebeec04cae
commit edc70bdf84
2 changed files with 12 additions and 10 deletions

View file

@ -329,11 +329,15 @@ class InputOutput:
self.num_error_outputs += 1
if message.strip():
if strip:
hist = message.strip()
if "\n" in message:
for line in message.splitlines():
self.append_chat_history(line, linebreak=True, blockquote=True)
else:
hist = message
self.append_chat_history(hist, linebreak=True, blockquote=True)
if strip:
hist = message.strip()
else:
hist = message
self.append_chat_history(hist, linebreak=True, blockquote=True)
message = Text(message)
style = dict(style=self.tool_error_color) if self.tool_error_color else dict()