Dax Raad 7 месяцев назад
Родитель
Сommit
a8b4aed446

+ 7 - 4
packages/tui/internal/components/chat/message.go

@@ -264,6 +264,8 @@ func renderToolDetails(
 	toolCall opencode.ToolPart,
 	width int,
 ) string {
+	measure := util.Measure("chat.renderToolDetails")
+	defer measure("tool", toolCall.Tool)
 	ignoredTools := []string{"todoread"}
 	if slices.Contains(ignoredTools, toolCall.Tool) {
 		return ""
@@ -368,13 +370,14 @@ func renderToolDetails(
 				}
 			}
 		case "bash":
+			command := toolInputMap["command"].(string)
+			body = fmt.Sprintf("```console\n$ %s\n", command)
 			stdout := metadata["stdout"]
 			if stdout != nil {
-				command := toolInputMap["command"].(string)
-				out := ansi.Strip(fmt.Sprintf("%s", stdout))
-				body = fmt.Sprintf("```console\n> %s\n%s```", command, out)
-				body = util.ToMarkdown(body, width, backgroundColor)
+				body += ansi.Strip(fmt.Sprintf("%s", stdout))
 			}
+			body += "```"
+			body = util.ToMarkdown(body, width, backgroundColor)
 		case "webfetch":
 			if format, ok := toolInputMap["format"].(string); ok && result != nil {
 				body = *result

+ 2 - 0
packages/tui/internal/components/chat/messages.go

@@ -234,6 +234,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
 				}
 
 			case opencode.AssistantMessage:
+				messageMeasure := util.Measure("messages.Render")
 				hasTextPart := false
 				for partIndex, p := range message.Parts {
 					switch part := p.(type) {
@@ -365,6 +366,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
 						}
 					}
 				}
+				messageMeasure()
 			}
 
 			error := ""