Make tool error results visually distinct with red border
Kujtim Hoxha
and
termai
created 7 months ago
- Change tool result border color to red when displaying errors
- Keep green border for successful results
- Improve visual distinction between error and success states
🤖 Generated with termai
Co-Authored-By: termai <noreply@termai.io>
Change summary
internal/tui/components/repl/messages.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Detailed changes
@@ -221,11 +221,15 @@ func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.
Bold(true).
Foreground(styles.Green).
Render(fmt.Sprintf("%s Result", styles.CheckIcon))
+
+ // Use the same style for both header and border if it's an error
+ borderColor := styles.Green
if result.IsError {
resultHeader = lipgloss.NewStyle().
Bold(true).
Foreground(styles.Red).
Render(fmt.Sprintf("%s Error", styles.ErrorIcon))
+ borderColor = styles.Red
}
truncate := 200
@@ -235,7 +239,7 @@ func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.
}
resultContent := lipgloss.JoinVertical(lipgloss.Left, resultHeader, content)
- return toolResultStyle.Render(resultContent)
+ return toolResultStyle.BorderForeground(borderColor).Render(resultContent)
}
connector := connectorStyle.Render("└─> Tool Calls:")