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: keep pop-up messages off the Run settings panel (#11486)

Nilay8b8306bd3e3e
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx
index 611811d88ed..42a112e9b78 100644
--- a/studio/frontend/src/app/provider.tsx
+++ b/studio/frontend/src/app/provider.tsx
@@ -47,7 +47,11 @@ import { useTauriUpdate } from "@/hooks/use-tauri-update";
import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { isTauri } from "@/lib/api-base";
import { followDesktopUpdateScreen } from "@/lib/desktop-update-activity";
-import { getToastOffsets } from "@/lib/toast-offset";
+import {
+ CHAT_SETTINGS_INSET_VAR,
+ getToastOffsets,
+ insetPastChatSettings,
+} from "@/lib/toast-offset";
import { Z_LAYER } from "@/lib/z-layers";
import { useRouterState } from "@tanstack/react-router";
import { setDesktopShellReady } from "./desktop-shell-ready";
@@ -104,6 +108,8 @@ const STACK_SHADOW_GUTTER_TOP = 16;
const STACK_SHADOW_GUTTER_LEFT = 28;
// The cards' own inset from the right edge, not a gutter: the rail is flush there.
const STACK_CARD_INSET_RIGHT = 16;
+// Rail stays flush with the corner; only its padding grows past the open Run settings panel.
+const STACK_CARD_INSET_RIGHT_PAST_PANEL = `calc(${STACK_CARD_INSET_RIGHT}px + var(${CHAT_SETTINGS_INSET_VAR}, 0px))`;
// macos page zoom does not change dpr; windows already includes zoom in its dpr.
function logicalPerCssPx(monitorScale: number): number {
@@ -503,7 +509,7 @@ function TauriUpdateLayer({
paddingTop: STACK_SHADOW_GUTTER_TOP,
paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,
paddingLeft: STACK_SHADOW_GUTTER_LEFT,
- paddingRight: STACK_CARD_INSET_RIGHT,
+ paddingRight: STACK_CARD_INSET_RIGHT_PAST_PANEL,
zIndex: Z_LAYER.OVERLAY_STACK,
}}
>
@@ -865,7 +871,7 @@ function TauriWrapper({ children }: { children: ReactNode }) {
paddingTop: STACK_SHADOW_GUTTER_TOP,
paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,
paddingLeft: STACK_SHADOW_GUTTER_LEFT,
- paddingRight: STACK_CARD_INSET_RIGHT,
+ paddingRight: STACK_CARD_INSET_RIGHT_PAST_PANEL,
zIndex: Z_LAYER.OVERLAY_STACK,
}}
>
@@ -1065,7 +1071,7 @@ export function AppProvider({ children }: AppProviderProps) {
visibleToasts={2}
expand={true}
closeButton={true}
- offset={toastOffsets.default}
+ offset={insetPastChatSettings(toastOffsets.default)}
mobileOffset={toastOffsets.mobile}
/>
</TooltipProvider>
diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
index 3652ad28d40..f4ec3296392 100644
--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx
+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
@@ -51,6 +51,7 @@ import {
} from "@/features/model-picker";
import { RetrievalSettingsSection } from "@/features/rag";
import { useLlamaUpdateCheck } from "@/hooks/use-llama-update-check";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import {
CHAT_SETTINGS_WIDTH_MIN,
clampChatSettingsWidth,
@@ -60,6 +61,7 @@ import { useIsCompact } from "@/hooks/use-mobile";
import { useT } from "@/i18n";
import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
import { toast } from "@/lib/toast";
+import { watchChatSettingsInset } from "@/lib/toast-offset";
import { cn } from "@/lib/utils";
import { Edit03Icon, LayoutAlignRightIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
@@ -508,11 +510,21 @@ export function ChatSettingsPanel({
!isExternalModel || Boolean(providerCapabilities?.presencePenalty);
// Overlay as a sheet below lg so the thread keeps its width.
const isCompact = useIsCompact();
+ const uiSpaceScale = useUiSpaceScale();
const activeGgufVariant = useChatRuntimeStore((s) => s.activeGgufVariant);
const loadedIsGguf = useChatRuntimeStore((s) => s.loadedIsGguf);
const activeNativePathToken = useChatRuntimeStore(
(s) => s.activeNativePathToken,
);
+ useEffect(() => {
+ if (!open || isCompact) return;
+ return watchChatSettingsInset(
+ document.documentElement,
+ asideRef.current,
+ settingsWidth * settingsScale,
+ uiSpaceScale,
+ );
+ }, [open, isCompact, settingsWidth, settingsScale, uiSpaceScale]);
const currentCheckpoint = params.checkpoint;
const activeModelIsLocal = useChatRuntimeStore(
(s) => s.activeModelIsLocal,
diff --git a/studio/frontend/src/lib/toast-offset.ts b/studio/frontend/src/lib/toast-offset.ts
index 04cc5d8f97e..d3e023a88f7 100644
--- a/studio/frontend/src/lib/toast-offset.ts
+++ b/studio/frontend/src/lib/toast-offset.ts
@@ -6,6 +6,19 @@ const MOBILE_EDGE_OFFSET = 16;
const HEADER_TOP_OFFSET = 52;
const DESKTOP_TITLEBAR_HEIGHT = 34;
+export const CHAT_SETTINGS_INSET_VAR = "--studio-chat-settings-inset";
+// Only the widest card scales with --ui-space-scale; the download panel and rail gutters do not.
+const CORNER_CARD_MAX_WIDTH = 448;
+const DOWNLOAD_PANEL_WIDTH = 400;
+const CORNER_CARD_GUTTERS = 44;
+
+export function chatSettingsInsetMinColumn(uiSpaceScale = 1): number {
+ return (
+ Math.max(CORNER_CARD_MAX_WIDTH * uiSpaceScale, DOWNLOAD_PANEL_WIDTH) +
+ CORNER_CARD_GUTTERS
+ );
+}
+
const HEADER_ROUTES = new Set(["/chat", "/images", "/video"]);
export type ToastOffset = {
@@ -46,3 +59,54 @@ export function getToastOffsets(
},
};
}
+
+export function insetPastChatSettings(offset: ToastOffset): {
+ top: number;
+ right: string;
+} {
+ return {
+ top: offset.top,
+ right: `calc(${offset.right}px + var(${CHAT_SETTINGS_INSET_VAR}, 0px))`,
+ };
+}
+
+type InsetPanel = {
+ offsetWidth: number;
+ parentElement: { clientWidth: number } | null;
+};
+type InsetObserver = new (
+ callback: () => void,
+) => {
+ observe(target: object): void;
+ disconnect(): void;
+};
+
+// Live width, not the stored one: a drag paints the panel before it commits.
+export function watchChatSettingsInset(
+ root: { style: Pick<CSSStyleDeclaration, "setProperty" | "removeProperty"> },
+ panel: InsetPanel | null,
+ fallbackWidth: number,
+ uiSpaceScale = 1,
+ Observer: InsetObserver = ResizeObserver,
+): () => void {
+ const row = panel?.parentElement ?? null;
+ const minColumn = chatSettingsInsetMinColumn(uiSpaceScale);
+ let applied: string | null = null;
+ const apply = () => {
+ const width = panel?.offsetWidth || fallbackWidth;
+ const fits = !row || row.clientWidth - width >= minColumn;
+ const next = fits ? `${width}px` : null;
+ if (next === applied) return;
+ applied = next;
+ if (next) root.style.setProperty(CHAT_SETTINGS_INSET_VAR, next);
+ else root.style.removeProperty(CHAT_SETTINGS_INSET_VAR);
+ };
+ apply();
+ const observer = panel ? new Observer(apply) : null;
+ if (row) observer?.observe(row);
+ if (panel) observer?.observe(panel);
+ return () => {
+ observer?.disconnect();
+ root.style.removeProperty(CHAT_SETTINGS_INSET_VAR);
+ };
+}
diff --git a/studio/frontend/tests/toast-offset.test.ts b/studio/frontend/tests/toast-offset.test.ts
index 9ac9b1c52b3..9ed1a0cb49e 100644
--- a/studio/frontend/tests/toast-offset.test.ts
+++ b/studio/frontend/tests/toast-offset.test.ts
@@ -4,7 +4,11 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { getToastOffsets } from "../src/lib/toast-offset.ts";
+import {
+ getToastOffsets,
+ insetPastChatSettings,
+ watchChatSettingsInset,
+} from "../src/lib/toast-offset.ts";
test("web chat toasts clear the header and stay against the right edge", () => {
assert.deepEqual(getToastOffsets("/chat", false, false), {
@@ -121,3 +125,91 @@ test("the header offset follows the UI font size, the titlebar does not", () =>
mobile: { top: 16, right: 16 },
});
});
+
+test("desktop toasts shift left by the open Run settings panel", () => {
+ assert.deepEqual(insetPastChatSettings({ top: 52, right: 12 }), {
+ top: 52,
+ right: "calc(12px + var(--studio-chat-settings-inset, 0px))",
+ });
+});
+
+function fakeInsetDom(rowWidth: number, panelWidth: number) {
+ const vars = new Map<string, string>();
+ const root = {
+ style: {
+ setProperty: (name: string, value: string) => void vars.set(name, value),
+ removeProperty: (name: string) => {
+ vars.delete(name);
+ return "";
+ },
+ },
+ };
+ const row = { clientWidth: rowWidth };
+ const panel = { offsetWidth: panelWidth, parentElement: row };
+ const observed = new Set<object>();
+ let notify = () => {};
+ class Observer {
+ constructor(callback: () => void) {
+ notify = callback;
+ }
+ observe(target: object) {
+ observed.add(target);
+ }
+ disconnect() {
+ observed.clear();
+ }
+ }
+ const resize = (target: object) => {
+ if (observed.has(target)) notify();
+ };
+ return { vars, root, row, panel, Observer, resize };
+}
+
+test("the inset follows the panel while it is dragged wider", () => {
+ const dom = fakeInsetDom(1400, 320);
+ watchChatSettingsInset(dom.root, dom.panel, 320, 1, dom.Observer);
+ assert.equal(dom.vars.get("--studio-chat-settings-inset"), "320px");
+
+ dom.panel.offsetWidth = 520;
+ dom.resize(dom.panel);
+ assert.equal(dom.vars.get("--studio-chat-settings-inset"), "520px");
+});
+
+test("the inset is dropped when the chat column cannot hold a corner card", () => {
+ const dom = fakeInsetDom(1400, 320);
+ const stop = watchChatSettingsInset(
+ dom.root,
+ dom.panel,
+ 320,
+ 1,
+ dom.Observer,
+ );
+ dom.row.clientWidth = 700;
+ dom.resize(dom.row);
+ assert.equal(dom.vars.has("--studio-chat-settings-inset"), false);
+
+ dom.row.clientWidth = 1400;
+ dom.resize(dom.row);
+ assert.equal(dom.vars.get("--studio-chat-settings-inset"), "320px");
+
+ stop();
+ assert.equal(dom.vars.has("--studio-chat-settings-inset"), false);
+});
+
+test("a larger UI scale needs a wider chat column before the inset applies", () => {
+ // 1100 - 320 = 780 holds a 448px card at scale 1 but not a 1.8x one (850px).
+ const plain = fakeInsetDom(1100, 320);
+ watchChatSettingsInset(plain.root, plain.panel, 320, 1, plain.Observer);
+ assert.equal(plain.vars.get("--studio-chat-settings-inset"), "320px");
+
+ const scaled = fakeInsetDom(1100, 320);
+ watchChatSettingsInset(scaled.root, scaled.panel, 320, 1.8, scaled.Observer);
+ assert.equal(scaled.vars.has("--studio-chat-settings-inset"), false);
+});
+
+test("a smaller UI scale still leaves room for the fixed-width download panel", () => {
+ // 1024 - 280 sidebar = 744 row; 744 - 340 = 404 < 400 + 44, though 448 * 0.8 + 44 = 402.4 fits.
+ const dom = fakeInsetDom(744, 340);
+ watchChatSettingsInset(dom.root, dom.panel, 340, 0.8, dom.Observer);
+ assert.equal(dom.vars.has("--studio-chat-settings-inset"), false);
+});
diff --git a/tests/studio/test_update_release_notes.py b/tests/studio/test_update_release_notes.py
index 295bb4bc7c5..d151089f3cd 100644
--- a/tests/studio/test_update_release_notes.py
+++ b/tests/studio/test_update_release_notes.py
@@ -1999,8 +1999,12 @@ def test_the_rail_gutters_come_out_of_the_cap_and_not_the_cards():
"paddingTop": "STACK_SHADOW_GUTTER_TOP",
"paddingBottom": "STACK_SHADOW_GUTTER_BOTTOM",
"paddingLeft": "STACK_SHADOW_GUTTER_LEFT",
- "paddingRight": "STACK_CARD_INSET_RIGHT",
+ "paddingRight": "STACK_CARD_INSET_RIGHT_PAST_PANEL",
}
+ assert re.search(
+ r"const STACK_CARD_INSET_RIGHT_PAST_PANEL =\s*`calc\(\$\{STACK_CARD_INSET_RIGHT\}px \+ var\(",
+ provider,
+ ), "the rail's right padding is no longer the px card inset plus the panel width"
openings = _rail_openings(provider)
assert len(openings) == 2, f"expected the browser and desktop rails, found {len(openings)}"
for tag in openings: