From 40943ff4d34a7d77ece2c8e3a427b1cf18eccd6a Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 24 Feb 2026 21:47:57 +0300 Subject: [PATCH] Enha: spinner for tool calls --- bot.go | 16 ++++++++++++++-- main.go | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bot.go b/bot.go index cd2e31d..2d6af0c 100644 --- a/bot.go +++ b/bot.go @@ -830,11 +830,21 @@ func chatWatcher(ctx context.Context) { func showSpinner() { spinners := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"} var i int - for botRespMode { + botPersona := cfg.AssistantRole + if cfg.WriteNextMsgAsCompletionAgent != "" { + botPersona = cfg.WriteNextMsgAsCompletionAgent + } + for botRespMode || toolRunningMode { time.Sleep(100 * time.Millisecond) spin := i % len(spinners) app.QueueUpdateDraw(func() { - textArea.SetTitle(spinners[spin] + " input") + if toolRunningMode { + textArea.SetTitle(spinners[spin] + " tool") + } else if botRespMode { + textArea.SetTitle(spinners[spin] + " " + botPersona) + } else { + textArea.SetTitle(spinners[spin] + " input") + } }) i++ } @@ -1219,7 +1229,9 @@ func findCall(msg, toolCall string) bool { } // Show tool call progress indicator before execution fmt.Fprintf(textView, "\n[yellow::i][tool: %s...][-:-:-]", fc.Name) + toolRunningMode = true resp := callToolWithAgent(fc.Name, fc.Args) + toolRunningMode = false toolMsg := string(resp) // Remove the "tool response: " prefix and %+v formatting logger.Info("llm used a tool call", "tool_name", fc.Name, "too_args", fc.Args, "id", fc.ID, "tool_resp", toolMsg) fmt.Fprintf(textView, "%s[-:-:b](%d) <%s>: [-:-:-]\n%s\n", diff --git a/main.go b/main.go index 27bf258..d90ff4a 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( var ( boolColors = map[bool]string{true: "green", false: "red"} botRespMode = false + toolRunningMode = false editMode = false roleEditMode = false injectRole = true