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
Size the model picker's row metadata to the ink it holds (#10006)
Michael Han024ddb364cbf
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsxindex e7758f5a9d0..b3607c212d4 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx@@ -779,16 +779,21 @@ const META_COLUMN = {badge: "min-w-min min-[560px]:w-[24px]",// One glyph plus the disk mark (18 + 4 + 14).badgeMid: "min-w-min min-[560px]:w-[36px]",- // Unscoped chat: a generation glyph and audio, plus whichever of vision (On Device rows) or the- // disk mark (Hub rows) that list carries -- the two never appear on the same row (18+4+18+4+24).- badgeWide: "min-w-min min-[560px]:w-[68px]",+ // On Device draws the vision badge and no disk mark: 26px is that badge measured, so rows with+ // and without one still line up. One slot sized for both lists left ~44px empty on every row.+ badgeDevice: "min-w-min min-[560px]:w-[26px]",+ // Hub draws the disk mark and no vision badge (18+4+14). A second glyph grows it via min-w-min.+ badgeWide: "min-w-min min-[560px]:w-[36px]",// The "OOM" pill, wider than bare "TIGHT" (Hub rows).vram: "min-w-min min-[560px]:w-[4em]",- // "235B" on device rows; Hub rows report "2779.5B", hence paramWide.- param: "min-w-min min-[560px]:w-[3.6em]",+ // Device rows hug the chip. A column sized for "235B" spends 6.1px in front of a "30B", and that+ // leftover IS the gap to the modality mark; -ml-0.5 against the cluster's gap-1 makes it 2px. In+ // exchange a wider label pulls that row's name and quant chip left. Hub keeps its "2779.5B".+ param: "min-w-min -ml-0.5",paramWide: "min-w-min min-[560px]:w-[5.2em]",- // "536 MB".- size: "min-w-min min-[560px]:w-[4.2em]",+ // formatBytes writes no space ("536MB"), so the widest this holds is 29.5px, not the ~40px a+ // spaced "536 MB" needs. The surplus sat between the parameter chip and the size.+ size: "min-w-min min-[560px]:w-[3.2em]",// The format dot that leads the row; the name lives in its tooltip.format: "min-[560px]:w-[14px]",} as const;@@ -888,15 +893,18 @@ function ModelRow({const capabilityScope = useContext(CapabilityScope);const capabilityBadges = visibleCapabilityBadges(caps, capabilityScope);const showCaps = capabilityBadges.length > 0;+ const aligned = alignMeta !== undefined;// Reserve only what this picker's scope can draw. The Images and Audio pickers draw no glyph and// Video draws one, so holding the chat row's slot open there is dead space on every row.+ // Unscoped chat splits again by list: On Device marks vision, Hub marks the disk.const badgeColumn =capabilityScope === null || capabilityScope.length > 1- ? META_COLUMN.badgeWide+ ? alignMeta === "device"+ ? META_COLUMN.badgeDevice+ : META_COLUMN.badgeWide: capabilityScope.length === 1? META_COLUMN.badgeMid: META_COLUMN.badge;- const aligned = alignMeta !== undefined;// One dot per row. A second format shares the first's colour anyway, so it// rides along in the tooltip instead of pushing the name out of line.const formatDot = parsed.formats[0]@@ -925,13 +933,18 @@ function ModelRow({}}onClick={onClick}className={cn(- "flex w-full flex-col items-stretch px-2 py-1.5 text-left text-sm transition-colors hover:bg-[#ececec] focus-visible:bg-[#ececec] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:hover:bg-[var(--sidebar-accent)] dark:focus-visible:bg-[var(--sidebar-accent)]",+ // pl-[5.5px]: the dot is centred in a 14px hover target, so 5.5 + (14 - 5) / 2 lands it+ // on 10px, level with the section labels at px-2.5. Inside a w-full button, so the hover+ // pill itself does not move.+ "flex w-full flex-col items-stretch py-1.5 pl-[5.5px] pr-2 text-left text-sm transition-colors hover:bg-[#ececec] focus-visible:bg-[#ececec] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:hover:bg-[var(--sidebar-accent)] dark:focus-visible:bg-[var(--sidebar-accent)]",showMemoryBar ? "rounded-2xl" : "rounded-full",selected && "bg-[#ececec] dark:bg-[var(--sidebar-accent)]",className,)}>- <span className="flex w-full items-center gap-2">+ {/* gap-1: the quant chip ends the name group, so what this separates is that chip from the+ first meta mark. 4px is the rhythm the meta columns already keep among themselves. */}+ <span className="flex w-full items-center gap-1"><span className="flex min-w-0 flex-1 items-baseline">{/* Fixed slot, so names start on one line with or without a dot. */}{aligned ? (@@ -967,7 +980,8 @@ function ModelRow({{alignMeta === "device" ? (<spanclassName={cn(- "ml-1.5 flex shrink-0 items-center self-center text-ui-9",+ // ml-0.5: the chip carries px-1 of its own, so 2px still leaves 6px of air.+ "ml-0.5 flex shrink-0 items-center self-center text-ui-9",META_COLUMN.quant,)}>@@ -997,7 +1011,8 @@ function ModelRow({{aligned ? (<spanclassName={cn(- "flex shrink-0 items-center justify-center gap-1 text-ui-10",+ // Right, not centre: slack belongs to the name, not split either side of a glyph.+ "flex shrink-0 items-center justify-end gap-1 text-ui-10",badgeColumn,)}>diff --git a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts b/studio/frontend/tests/on-device-dot-and-header-alignment.test.tsindex 31e67acfcdb..824d74b6a02 100644--- a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts+++ b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts@@ -43,6 +43,55 @@ test("the scoped badge column reserves the wider on-device marker", () => {assert.ok(PICKERS.includes('badgeMid: "min-w-min min-[560px]:w-[36px]"'));});+test("the unscoped badge column is sized per list, not to the union of both", () => {+ // One slot sized for both lists left ~44px of empty column on every On Device row. 26px is the+ // vision badge measured, so rows with and without one keep the same column positions.+ assert.ok(PICKERS.includes('badgeDevice: "min-w-min min-[560px]:w-[26px]"'));+ assert.ok(PICKERS.includes('badgeWide: "min-w-min min-[560px]:w-[36px]"'));+ assert.match(+ PICKERS,+ /alignMeta === "device"\n\s*\? META_COLUMN\.badgeDevice\n\s*: META_COLUMN\.badgeWide/,+ );+});++test("a row's leading dot starts where its section label does", () => {+ // Section labels sit at px-2.5. The dot is centred in a 14px hover target, so its slot starts+ // at 10 - (14 - 5) / 2 = 5.5px for the dot to land on 10px. px-2 put it at 12.5px.+ assert.match(PICKERS, /py-1\.5 pl-\[5\.5px\] pr-2 text-left text-sm/);+ const label = PICKERS.slice(PICKERS.indexOf("flex items-center justify-between gap-1 px-2.5"));+ assert.ok(label.startsWith("flex items-center justify-between gap-1 px-2.5"));+ // The 14px hover target is what makes 5.5 the right number; shrinking it would move the dot.+ assert.ok(PICKERS.includes('className="flex size-[14px] shrink-0 items-center justify-center"'));+});++test("the parameter and size columns are sized to the ink they hold", () => {+ // The widest size formatBytes writes ("128GB", no space) is 29.5px, not the ~40px a spaced+ // "536 MB" would need.+ assert.ok(PICKERS.includes('size: "min-w-min min-[560px]:w-[3.2em]"'));+ // The no-space format is what makes 3.2em enough; a spaced size would need ~4.2em again.+ assert.match(+ PICKERS,+ /No space: "145MB" reads as one value beside the quant chip\./,+ );+});++test("the parameter chip hugs its label so the gap to the modality mark is the row's own", () => {+ // A fixed right-aligned column spends its leftover in front of the chip, and that leftover is+ // the gap to the modality mark, which no gap setting can undo. Hugging plus -ml-0.5 gives 2px.+ assert.ok(PICKERS.includes('param: "min-w-min -ml-0.5"'));+ // Hub keeps a column: its labels run to "2779.5B".+ assert.ok(PICKERS.includes('paramWide: "min-w-min min-[560px]:w-[5.2em]"'));+});++test("aligned meta slots spend their slack on the name", () => {+ // Centring a lone glyph splits the slack either side of it, reading as a gap on both sides.+ assert.ok(+ PICKERS.includes(+ '"flex shrink-0 items-center justify-end gap-1 text-ui-10"',+ ),+ );+});+test("every select-model surface shares that one badge", () => {// Images, Video and Audio render the same ModelSelector, so there is no// second copy of the badge to keep in step.