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.

Studio: show the context meter for active project chats (#12605)

lorenzozane45c7524d07d2
diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx
index 2cb8c5440bc..2894cf2ff63 100644
--- a/studio/frontend/src/features/chat/chat-page.tsx
+++ b/studio/frontend/src/features/chat/chat-page.tsx
@@ -4769,7 +4769,8 @@ export function ChatPage({
</div>
<div className="pointer-events-auto ml-auto flex min-w-min max-w-max grow basis-0 items-center gap-1 *:shrink-0">
{showContextWindowUsage &&
- view.mode === "single" &&
+ (view.mode === "single" ||
+ (view.mode === "project" && activeThreadId != null)) &&
(contextUsage || contextWindowKnown) ? (
<ContextUsageBar
used={contextUsage?.contextTokens ?? contextUsage?.totalTokens ?? null}
diff --git a/studio/frontend/tests/composer-submit-path.test.ts b/studio/frontend/tests/composer-submit-path.test.ts
index 2b4ed0ba5d1..97457133b6a 100644
--- a/studio/frontend/tests/composer-submit-path.test.ts
+++ b/studio/frontend/tests/composer-submit-path.test.ts
@@ -343,5 +343,8 @@ test("main, edit and comparison composers use the setting and expose settings ac
);
assert.match(compare, /scrollTarget: "chat-composer"/);
const page = readSrc("features/chat/chat-page.tsx");
- assert.match(page, /showContextWindowUsage &&\s*view.mode === "single"/);
+ assert.match(
+ page,
+ /showContextWindowUsage &&[\s\S]{0,100}view\.mode === "project" && activeThreadId != null/,
+ );
});
diff --git a/studio/frontend/tests/context-window-visible.test.ts b/studio/frontend/tests/context-window-visible.test.ts
index 7f15477daa0..eb05069bb62 100644
--- a/studio/frontend/tests/context-window-visible.test.ts
+++ b/studio/frontend/tests/context-window-visible.test.ts
@@ -145,11 +145,11 @@ test("an uncounted chat reports no per-turn rows", () => {
);
});
-test("the header renders the bar on the window alone, with usage optional", () => {
+test("the header renders the bar for single chats and active project threads", () => {
const page = readSrc("features/chat/chat-page.tsx");
assert.match(
page,
- /showContextWindowUsage &&\s*view\.mode === "single" &&\s*\(contextUsage \|\| contextWindowKnown\)/,
+ /\{showContextWindowUsage &&\s*\(view\.mode === "single" \|\|\s*\(view\.mode === "project" && activeThreadId != null\)\) &&\s*\(contextUsage \|\| contextWindowKnown\) \? \(/,
);
assert.match(
page,