Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix: clear tool status badge immediately after tool execution (#4733)

Wasim Yousef Saidd63cc57e1e2d
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py
index 894dd25cf7b..eb3776e6034 100644
--- a/studio/backend/core/inference/llama_cpp.py
+++ b/studio/backend/core/inference/llama_cpp.py
@@ -2740,6 +2740,8 @@ class LlamaCppBackend:
tool_msg["tool_call_id"] = tool_call_id
conversation.append(tool_msg)
+ # Clear tool status badge before next generation iteration
+ yield {"type": "status", "text": ""}
# Continue the loop to let model respond with context
continue
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index d6888228156..aae027c74b4 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -437,21 +437,40 @@ const CodeToolsToggle: FC = () => {
const ToolStatusDisplay: FC = () => {
const toolStatus = useChatRuntimeStore((s) => s.toolStatus);
+ const isThreadRunning = useAuiState(({ thread }) => thread.isRunning);
const [elapsed, setElapsed] = useState(0);
+ const [visible, setVisible] = useState(false);
useEffect(() => {
if (!toolStatus) {
setElapsed(0);
+ if (!isThreadRunning) {
+ setVisible(false);
+ }
return;
}
+
setElapsed(0);
+
+ // Debounce badge visibility by 300ms when the badge is not
+ // already on screen. Once visible from a prior tool, consecutive
+ // tools show immediately so the badge does not flicker. Fast
+ // tool calls that all complete under 300ms never show the badge.
+ let showTimer: ReturnType<typeof setTimeout> | undefined;
+ if (!visible) {
+ showTimer = setTimeout(() => setVisible(true), 300);
+ }
+
const interval = setInterval(() => {
setElapsed((prev) => prev + 1);
}, 1000);
- return () => clearInterval(interval);
- }, [toolStatus]);
+ return () => {
+ clearInterval(interval);
+ if (showTimer) clearTimeout(showTimer);
+ };
+ }, [toolStatus, isThreadRunning]);
- if (!toolStatus) return null;
+ if (!toolStatus || !visible) return null;
const isRunning = toolStatus.startsWith("Running");
const StatusIcon = isRunning ? TerminalIcon : GlobeIcon;
return (