From 916c5d3904b366e9f7f6f12867f7f0b71791bb6f Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 27 Feb 2026 21:25:26 +0300 Subject: Enha: icon for collapsed tools --- bot.go | 8 +++++--- tui.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.go b/bot.go index c5fe92d..247c0dd 100644 --- a/bot.go +++ b/bot.go @@ -1208,16 +1208,17 @@ func findCall(msg, toolCall string) bool { func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string { resp := make([]string, len(messages)) for i := range messages { + icon := fmt.Sprintf("[-:-:b](%d) <%s>:[-:-:-]", i, messages[i].Role) // Handle tool call indicators (assistant messages with tool call but empty content) - if (messages[i].Role == cfg.AssistantRole || messages[i].Role == "assistant") && messages[i].ToolCallID != "" && messages[i].Content == "" && len(messages[i].ToolCalls) > 0 { + if messages[i].Role == cfg.AssistantRole && len(messages[i].ToolCalls) > 0 { // This is a tool call indicator - show collapsed if toolCollapsed { toolName := messages[i].ToolCalls[0].Name - resp[i] = fmt.Sprintf("[yellow::i][tool call: %s (press Ctrl+T to expand)][-:-:-]", toolName) + resp[i] = fmt.Sprintf("%s\n[yellow::i][tool call: %s (press Ctrl+T to expand)][-:-:-]", icon, toolName) } else { // Show full tool call info toolName := messages[i].ToolCalls[0].Name - resp[i] = fmt.Sprintf("[yellow::i][tool call: %s][-:-:-]\nargs: %s", toolName, messages[i].ToolCalls[0].Args) + resp[i] = fmt.Sprintf("%s\n[yellow::i][tool call: %s][-:-:-]\nargs: %s", icon, toolName, messages[i].ToolCalls[0].Args) } continue } @@ -1230,6 +1231,7 @@ func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string { } // Hide non-shell tool responses when collapsed if toolCollapsed { + resp[i] = icon + "\n[yellow::i][tool resp (press Ctrl+T to expand)][-:-:-]\n" continue } // When expanded, show tool responses diff --git a/tui.go b/tui.go index 1fe3adb..773ba4e 100644 --- a/tui.go +++ b/tui.go @@ -80,7 +80,7 @@ var ( [yellow]Ctrl+p[white]: props edit form (min-p, dry, etc.) [yellow]Ctrl+v[white]: show API link selection popup to choose current API [yellow]Ctrl+r[white]: start/stop recording from your microphone (needs stt server or whisper binary) -[yellow]Ctrl+t[white]: remove thinking () and tool messages from context (delete from chat) +[yellow]Ctrl+t[white]: (un)collapse tool messages [yellow]Ctrl+l[white]: show model selection popup to choose current model [yellow]Ctrl+k[white]: switch tool use (recommend tool use to llm after user msg) [yellow]Ctrl+a[white]: interrupt tts (needs tts server) -- cgit v1.2.3