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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: size the composer to the message column at every width and zoom, and stop clipping thinking text (#13675)
Michael Han2bb3b63e27d6
diff --git a/studio/frontend/src/components/assistant-ui/composer-column-inset.ts b/studio/frontend/src/components/assistant-ui/composer-column-inset.tsnew file mode 100644index 00000000000..bd02d9a4bf3--- /dev/null+++ b/studio/frontend/src/components/assistant-ui/composer-column-inset.ts@@ -0,0 +1,60 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++export type ViewportBox = {+ left: number;+ right: number;+ offsetWidth: number;+ clientWidth: number;+ borderLeft: number;+ borderRight: number;+ paddingLeft: number;+ paddingRight: number;+ /** `scrollbar-gutter` reserves both sides. */+ bothEdges: boolean;+ rtl: boolean;+};++/** Dock padding that lands on the viewport's content box; the scrollbar is measured (0 when overlay). */+export function composerColumnInset(+ viewport: ViewportBox,+ dock: { left: number; right: number },+): { left: number; right: number } {+ const scrollbar = Math.max(+ 0,+ viewport.offsetWidth -+ viewport.clientWidth -+ viewport.borderLeft -+ viewport.borderRight,+ );+ const [gutterLeft, gutterRight] = viewport.bothEdges+ ? [scrollbar / 2, scrollbar / 2]+ : viewport.rtl+ ? [scrollbar, 0]+ : [0, scrollbar];+ const contentLeft =+ viewport.left + viewport.borderLeft + gutterLeft + viewport.paddingLeft;+ const contentRight =+ viewport.right - viewport.borderRight - gutterRight - viewport.paddingRight;+ return {+ left: Math.max(0, contentLeft - dock.left),+ right: Math.max(0, dock.right - contentRight),+ };+}++export function readViewportBox(el: HTMLElement): ViewportBox {+ const style = getComputedStyle(el);+ const rect = el.getBoundingClientRect();+ return {+ left: rect.left,+ right: rect.right,+ offsetWidth: el.offsetWidth,+ clientWidth: el.clientWidth,+ borderLeft: Number.parseFloat(style.borderLeftWidth) || 0,+ borderRight: Number.parseFloat(style.borderRightWidth) || 0,+ paddingLeft: Number.parseFloat(style.paddingLeft) || 0,+ paddingRight: Number.parseFloat(style.paddingRight) || 0,+ bothEdges: style.scrollbarGutter.includes("both-edges"),+ rtl: style.direction === "rtl",+ };+}diff --git a/studio/frontend/src/components/assistant-ui/reasoning.tsx b/studio/frontend/src/components/assistant-ui/reasoning.tsxindex 3fc4b60c71c..f0524452857 100644--- a/studio/frontend/src/components/assistant-ui/reasoning.tsx+++ b/studio/frontend/src/components/assistant-ui/reasoning.tsx@@ -266,7 +266,7 @@ function ReasoningContent({}: ComponentProps<typeof CollapsibleContent> & { streaming?: boolean }) {// Colour and size live on ReasoningText: the folded-round path skips this wrapper.const shared = cn(- "aui-reasoning-content relative overflow-hidden outline-none",+ "aui-reasoning-content relative min-w-0 overflow-hidden supports-[overflow:clip]:overflow-x-visible supports-[overflow:clip]:overflow-y-clip outline-none","group/collapsible-content ease-out","data-[state=closed]:pointer-events-none",);@@ -576,8 +576,9 @@ function ReasoningTail({onExpandedChange(true);}}className={cn(+ // A mask paints only inside its box: bleed into the side padding so list markers survive.capped &&- "flex max-h-[min(18rem,40vh)] flex-col overflow-hidden [&>*]:shrink-0",+ "-mx-[calc(1.25rem*var(--ui-space-scale,1))] flex min-w-0 max-h-[min(18rem,40vh)] flex-col overflow-hidden px-[calc(1.25rem*var(--ui-space-scale,1))] supports-[overflow:clip]:overflow-x-visible supports-[overflow:clip]:overflow-y-clip [&>*]:shrink-0",capped && (streaming ? "justify-end" : "justify-start"),clipped &&(streamingdiff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 39606d72d04..e12ff9df5ab 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -52,6 +52,10 @@ import { ProgressiveMessages } from "@/components/assistant-ui/progressive-messaimport { MessageMenuTime } from "@/components/assistant-ui/message-menu-time";import { UserMessageActionBar, UserMessageFooter } from "@/components/assistant-ui/user-message-actions";import { useActionBarFocusReveal } from "@/components/assistant-ui/use-action-bar-focus-reveal";+import {+ composerColumnInset,+ readViewportBox,+} from "@/components/assistant-ui/composer-column-inset";import { MessageTiming } from "@/components/assistant-ui/message-timing";import { attachThreadFastCopy } from "@/components/assistant-ui/thread-fast-copy";import { attachWheelHoverSuppression } from "@/components/assistant-ui/thread-wheel-hover";@@ -2564,6 +2568,29 @@ const ThreadComposerDock: FC<{};}, [onHeightChange]);+ const dockInnerRef = useRef<HTMLDivElement | null>(null);+ useLayoutEffect(() => {+ const dock = dockRef.current;+ const inner = dockInnerRef.current;+ const viewport = dock?.parentElement?.querySelector<HTMLElement>(+ ":scope > .aui-thread-viewport",+ );+ if (!dock || !inner || !viewport) return;+ const apply = () => {+ const inset = composerColumnInset(+ readViewportBox(viewport),+ dock.getBoundingClientRect(),+ );+ inner.style.setProperty("--composer-dock-inset-left", `${inset.left}px`);+ inner.style.setProperty("--composer-dock-inset-right", `${inset.right}px`);+ };+ apply();+ const resizeObserver = new ResizeObserver(apply);+ resizeObserver.observe(viewport);+ resizeObserver.observe(dock);+ return () => resizeObserver.disconnect();+ }, []);+return (<divref={dockRef}@@ -2584,9 +2611,7 @@ const ThreadComposerDock: FC<{: "top-[calc(10px*var(--ui-space-scale,1))]",)}/>- {/* Narrow panes spend the gutter on the composer instead; index.css- trims it off the pane's width, not the window's. */}- <div className="unsloth-composer-dock-inner relative px-5 pb-2">+ <div ref={dockInnerRef} className="unsloth-composer-dock-inner relative pb-2"><div className="pointer-events-auto mx-auto w-full max-w-(--thread-max-width)"><ComposerAnimateddisabled={disabled}diff --git a/studio/frontend/src/components/ui/unmeasured-collapsible.tsx b/studio/frontend/src/components/ui/unmeasured-collapsible.tsxindex 98743261427..ff57f6869fe 100644--- a/studio/frontend/src/components/ui/unmeasured-collapsible.tsx+++ b/studio/frontend/src/components/ui/unmeasured-collapsible.tsx@@ -276,7 +276,8 @@ const UnmeasuredCollapsibleContent = React.forwardRef<className,)}>- <div className="min-h-0 overflow-hidden">{present && children}</div>+ {/* Vertical clip only, so hanging list markers show; min-w-0 replaces the shrink hidden gave. */}+ <div className="min-h-0 min-w-0 overflow-hidden supports-[overflow:clip]:overflow-x-visible supports-[overflow:clip]:overflow-y-clip">{present && children}</div></div>);},diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 9ecae59e1ba..58d6f8040b7 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -3744,16 +3744,10 @@ html[data-chat-font] .aui-root {font-weight: 500;}- /* Narrow panes shrink the greeting along with the composer under it, or a- 30px title wraps over two lines above a tightened box. Sized off the- text tokens so the UI font scale still applies.-- The gutters here are on the pane's width, not the window's: an artifact- split can leave a 42% thread pane inside a wide window, and a viewport- breakpoint would keep the full 20px there. */- :where(.aui-thread-root[data-thread-narrow]) .unsloth-composer-dock-inner {- padding-left: calc(0.75rem * var(--ui-space-scale, 1));- padding-right: calc(0.75rem * var(--ui-space-scale, 1));+ /* ThreadComposerDock sets the measured message-column insets; px-5 until then. */+ .unsloth-composer-dock-inner {+ padding-left: var(--composer-dock-inset-left, 1.25rem);+ padding-right: var(--composer-dock-inset-right, 1.25rem);}/* Pull back into the viewport's gutter, or the empty state is 40px narrower than the thread. */@@ -3765,6 +3759,8 @@ html[data-chat-font] .aui-root {width: calc(100% + 1rem * var(--ui-space-scale, 1));}+ /* Narrow panes shrink the greeting, or a 30px title wraps over two lines. Sized off the+ text tokens so the UI font scale still applies. */:where(.aui-thread-root[data-thread-narrow]) .unsloth-welcome-title {font-size: var(--text-2xl);}diff --git a/studio/frontend/tests/chat-column-centering.test.ts b/studio/frontend/tests/chat-column-centering.test.tsindex f4fe1541e02..cdd680ecb49 100644--- a/studio/frontend/tests/chat-column-centering.test.ts+++ b/studio/frontend/tests/chat-column-centering.test.ts@@ -37,8 +37,8 @@ test("nothing around the composer re-adds a one-sided inset", async () => {assert.doesNotMatch(chatPage, /pl-5 pr-5 md:pr-\[30px\]/);assert.match(chatPage, /pl-5 pr-5 md:px-\[30px\]/);- // The dock's own padding stays even.- assert.match(thread, /unsloth-composer-dock-inner relative px-5/);+ // The dock's padding is measured off the message column, so it has no fixed inset to drift.+ assert.match(thread, /ref=\{dockInnerRef\} className="unsloth-composer-dock-inner relative pb-2"/);// The dock offset keeps the bottom fade off the scrollbar, so it stays,// but one-sided it also shifts the composer half its width off centre.diff --git a/studio/frontend/tests/composer-column-inset.test.ts b/studio/frontend/tests/composer-column-inset.test.tsnew file mode 100644index 00000000000..91e2c40427d--- /dev/null+++ b/studio/frontend/tests/composer-column-inset.test.ts@@ -0,0 +1,77 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { composerColumnInset } from "../src/components/assistant-ui/composer-column-inset.ts";+import { readSrc } from "./helpers/kit.ts";++const DOCK_INNER_RULE =+ /\.unsloth-composer-dock-inner \{\s*padding-left: var\(--composer-dock-inset-left/;+const NARROW_DOCK_RULE = /data-thread-narrow\]\) \.unsloth-composer-dock-inner/;++const base = {+ left: 0,+ right: 700,+ offsetWidth: 700,+ clientWidth: 678,+ borderLeft: 0,+ borderRight: 0,+ paddingLeft: 20,+ paddingRight: 20,+ bothEdges: true,+ rtl: false,+};++test("a both-edges gutter splits the scrollbar across the sides", () => {+ assert.deepEqual(composerColumnInset(base, { left: 0, right: 700 }), {+ left: 31,+ right: 31,+ });+});++test("overlay scrollbars reserve nothing, so only the padding is inset", () => {+ assert.deepEqual(+ composerColumnInset({ ...base, clientWidth: 700 }, { left: 0, right: 700 }),+ { left: 20, right: 20 },+ );+});++test("the dock's own offset is subtracted", () => {+ assert.deepEqual(composerColumnInset(base, { left: 10, right: 690 }), {+ left: 21,+ right: 21,+ });+});++test("a one-sided gutter with a border, as the Windows low-scale viewport has", () => {+ assert.deepEqual(+ composerColumnInset(+ { ...base, clientWidth: 680, borderLeft: 10, bothEdges: false },+ { left: 0, right: 700 },+ ),+ { left: 30, right: 30 },+ );+ assert.deepEqual(+ composerColumnInset(+ {+ ...base,+ clientWidth: 680,+ borderLeft: 10,+ bothEdges: false,+ rtl: true,+ },+ { left: 0, right: 700 },+ ),+ { left: 40, right: 20 },+ );+});++test("the dock pads from the measured inset, not a fixed gutter", () => {+ const css = readSrc("index.css");+ assert.match(css, DOCK_INNER_RULE);+ assert.ok(!NARROW_DOCK_RULE.test(css));+ const thread = readSrc("components/assistant-ui/thread.tsx");+ assert.ok(!thread.includes('"unsloth-composer-dock-inner relative px-5'));+});diff --git a/studio/frontend/tests/reasoning-grid-collapse.test.ts b/studio/frontend/tests/reasoning-grid-collapse.test.tsindex ea4b1e38187..a6511549569 100644--- a/studio/frontend/tests/reasoning-grid-collapse.test.ts+++ b/studio/frontend/tests/reasoning-grid-collapse.test.ts@@ -67,10 +67,15 @@ test("the unmeasured collapsible reads no geometry at all", () => {}});-test("the animating child carries min-height:0 and overflow:hidden", () => {- // Both on one element, and that element is the wrapper the component renders itself, so a- // caller cannot omit them.- assert.match(UNMEASURED, /className="min-h-0 overflow-hidden"/);+test("the animating child carries min-height:0 and clips vertically only", () => {+ // All on one element, and that element is the wrapper the component renders itself, so a+ // caller cannot omit them. Hidden is the fallback where `overflow: clip` is missing; the x axis+ // stays visible so list markers hanging past the column are not cut, and min-w-0 stands in+ // for the shrink that hidden used to give.+ assert.match(+ UNMEASURED,+ /className="min-h-0 min-w-0 overflow-hidden supports-\[overflow:clip\]:overflow-x-visible supports-\[overflow:clip\]:overflow-y-clip"/,+ );});test("the collapse is a grid-template-rows transition between 0fr and 1fr", () => {diff --git a/studio/frontend/tests/reasoning-live-tail.test.ts b/studio/frontend/tests/reasoning-live-tail.test.tsindex 940f1b32625..a30df554621 100644--- a/studio/frontend/tests/reasoning-live-tail.test.ts+++ b/studio/frontend/tests/reasoning-live-tail.test.ts@@ -37,7 +37,7 @@ test("the box clips at the top instead of scrolling, and Expand toggles without);assert.match(tail,- /flex max-h-\[[^\]]+\] flex-col overflow-hidden/,+ /flex min-w-0 max-h-\[[^\]]+\] flex-col overflow-hidden px-\[[^\]]+\] supports-\[overflow:clip\]:overflow-x-visible supports-\[overflow:clip\]:overflow-y-clip/,);assert.doesNotMatch(tail, /overflow-(y-)?(auto|scroll)|scrollTop|scrollTo\(/);assert.match(diff --git a/studio/frontend/tests/thread-width-steps.test.ts b/studio/frontend/tests/thread-width-steps.test.tsindex 5a3686ae929..2b21182cbcf 100644--- a/studio/frontend/tests/thread-width-steps.test.ts+++ b/studio/frontend/tests/thread-width-steps.test.ts@@ -48,7 +48,6 @@ test("the thread root is no longer a size container, so a width change restylesassert.equal(/@container \((max|min)-width: (31\.5|18\.75)rem\)/.test(css), false);assert.equal(css.includes("@container (min-width: 36rem)"), false);for (const selector of [- ":where(.aui-thread-root[data-thread-narrow]) .unsloth-composer-dock-inner {",":where(.aui-thread-root[data-thread-narrow]) .aui-thread-welcome-message {",":where(.aui-thread-root[data-thread-narrow]) .unsloth-welcome-title {",":where(.aui-thread-root[data-thread-tiny]) .unsloth-welcome-title {",