mirror of
https://github.com/sst/opencode.git
synced 2025-07-23 15:55:03 +00:00
fix bash tool rendering
This commit is contained in:
parent
03de0c406d
commit
a8b4aed446
2 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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 := ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue