summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/tui/internal/components/chat/message.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go
index 5b91427d7..61c2c5446 100644
--- a/packages/tui/internal/components/chat/message.go
+++ b/packages/tui/internal/components/chat/message.go
@@ -266,6 +266,14 @@ func renderToolInvocation(
if finished {
body = *result
}
+
+ if metadata["error"] != nil && metadata["message"] != nil {
+ body = styles.BaseStyle().
+ Width(outerWidth).
+ Foreground(t.Error()).
+ Render(metadata["message"].(string))
+ }
+
elapsed := ""
if metadata["time"] != nil {
timeMap := metadata["time"].(map[string]any)
@@ -345,20 +353,9 @@ func renderToolInvocation(
}
default:
toolName := renderToolName(toolCall.ToolName)
- title = style.Render(fmt.Sprintf("%s: %s %s", toolName, toolArgs, elapsed))
- // return title
-
- // toolName := renderToolName(toolCall.ToolName)
- // title = fmt.Sprintf("%s: %s", toolName, toolArgs)
- // body = fmt.Sprintf("```txt\n%s\n```", truncateHeight(body, 10))
- // body = toMarkdown(body, contentWidth)
- }
-
- if metadata["error"] != nil && metadata["message"] != nil {
- body = styles.BaseStyle().
- Width(outerWidth).
- Foreground(t.Error()).
- Render(metadata["message"].(string))
+ title = fmt.Sprintf("%s: %s %s", toolName, toolArgs, elapsed)
+ body = truncateHeight(body, 10)
+ body = renderMarkdown(body, WithFullWidth(), WithPaddingTop(1), WithPaddingBottom(1))
}
content := style.Render(title)
@@ -368,7 +365,6 @@ func renderToolInvocation(
content += "\n" + body
}
return content
- // return styles.ForceReplaceBackgroundWithLipgloss(content, t.Background())
}
func renderToolName(name string) string {