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: prompt edit box, menu heading chips, hub Run, files panel, loaded row menu (#15375)
Michael Hanbb65bde2a4cc
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex f5285f9b1f6..b6c2733f4a5 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -8913,33 +8913,39 @@ const EditComposer: FC = () => {}, [aui, isComposingRef]);return (- <MessagePrimitive.Root className="aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-content-max-width) flex-col py-3">+ // Top gap and type match UserMessage, so the text stays near the prompt's line.+ <MessagePrimitive.Root className="aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-content-max-width) flex-col pt-6 pb-4 text-ui-15p5 [font-weight:410] tracking-[0.01em] dark:tracking-[0.02em]"><ComposerPrimitive.Root- className="aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-3xl bg-muted"+ className="aui-edit-composer-root flex w-full flex-col rounded-xl bg-muted"onSubmit={(event) => {event.preventDefault();submitEdit();}}>- <ComposerAttachments className="mb-0 px-3 pt-3" />+ <ComposerAttachments className="mb-0 px-4 pt-4" /><ComposerPrimitive.InputsubmitMode={effectiveSendShortcut(sendShortcut, editMultiline ? "\n" : "") === "mod-enter"? "ctrlEnter": "enter"}- className="aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm font-[450] outline-none"+ minRows={2}+ className="aui-edit-composer-input w-full resize-none bg-transparent px-5 py-3.5 text-foreground outline-none"autoFocus={true}dir="auto"{...inputProps}/>- <div className="aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end">+ <div className="aui-edit-composer-footer mx-4 mb-4 flex items-center gap-2 self-end"><ComposerPrimitive.Cancel asChild={true}>- <Button type="button" variant="ghost" size="sm">+ <Button type="button" variant="outline">Cancel</Button></ComposerPrimitive.Cancel>- <Button type="submit" size="sm" disabled={researchActive || editEmpty}>+ <Button+ type="submit"+ variant="dark"+ disabled={researchActive || editEmpty}+ >Send</Button></div>diff --git a/studio/frontend/src/features/hub/catalog/download-card.tsx b/studio/frontend/src/features/hub/catalog/download-card.tsxindex 27234ad6284..6716e563084 100644--- a/studio/frontend/src/features/hub/catalog/download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/download-card.tsx@@ -115,7 +115,7 @@ export function ModelRunActionButton({</>) : (<>- <PlayIcon strokeWidth={1.75} />+ <PlayIcon strokeWidth={2} className="[&_path]:fill-current" />Run</>)}diff --git a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsxindex 63069fe43d0..ccbcc8444eb 100644--- a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx@@ -1264,7 +1264,8 @@ export function GgufDownloadCard({/>)}- {(showUpdateAction || showDownloadAction || showRunAction) && (+ {/* Run sets itself apart; the line only separates the download and update actions. */}+ {(showUpdateAction || showDownloadAction) && !(showRunAction && onRun && selected) && (<CardDivider />)}diff --git a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsxindex 9973f005e2b..77b39ec3397 100644--- a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx+++ b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx@@ -62,7 +62,6 @@ import { DeleteImpactSummary, useDeleteImpact } from "./delete-impact";import { DotTag } from "./dot-tag";import {CardDeleteButton,- CardDivider,CardUpdateButton,DeleteConfirmDialog,ModelRunActionButton,@@ -617,28 +616,25 @@ export function LocalOnDeviceCard({</div></div>{showRunAction && onRun && (- <>- <CardDivider />- <ModelRunActionButton- label={`Configure and run ${displayName.trim() || "this model"}`}- loading={runPending}- onClick={() =>- onRun(- needsVariantSelection && selectedVariant- ? {- ggufVariant: selectedVariant.quant,- ggufFilename: selectedVariant.filename,- expectedBytes:- selectedVariant.download_size_bytes &&- selectedVariant.download_size_bytes > 0- ? selectedVariant.download_size_bytes- : selectedVariant.size_bytes,- }- : {},- )- }- />- </>+ <ModelRunActionButton+ label={`Configure and run ${displayName.trim() || "this model"}`}+ loading={runPending}+ onClick={() =>+ onRun(+ needsVariantSelection && selectedVariant+ ? {+ ggufVariant: selectedVariant.quant,+ ggufFilename: selectedVariant.filename,+ expectedBytes:+ selectedVariant.download_size_bytes &&+ selectedVariant.download_size_bytes > 0+ ? selectedVariant.download_size_bytes+ : selectedVariant.size_bytes,+ }+ : {},+ )+ }+ />)}</div>{/* Render the full-width memory bar below the horizontal card row so itdiff --git a/studio/frontend/src/features/hub/catalog/mlx-precision-card.tsx b/studio/frontend/src/features/hub/catalog/mlx-precision-card.tsxindex b38bb8dd25c..134fce9e368 100644--- a/studio/frontend/src/features/hub/catalog/mlx-precision-card.tsx+++ b/studio/frontend/src/features/hub/catalog/mlx-precision-card.tsx@@ -8,7 +8,7 @@ import type { HubModelRunSelection } from "../lib/model-run-selection";import { formatBytes } from "../lib/format";import { useHfTokenStore } from "../stores/hf-token-store";import { DotTag } from "./dot-tag";-import { CardDivider, ModelRunActionButton } from "./download-card";+import { ModelRunActionButton } from "./download-card";export function MlxPrecisionCard({repoId,@@ -82,24 +82,21 @@ export function MlxPrecisionCard({))}</div>{onRun && (- <>- <CardDivider />- <div className="flex items-center justify-end">- <ModelRunActionButton- label={`Configure and run ${repoId} ${chosen.quant}`}- loading={runPending}- onClick={() =>- onRun({- ggufVariant: chosen.quant,- ggufFilename: chosen.filename,- expectedBytes: chosen.size_bytes,- precisionFolder: true,- downloaded: chosen.downloaded === true,- })- }- />- </div>- </>+ <div className="flex items-center justify-end">+ <ModelRunActionButton+ label={`Configure and run ${repoId} ${chosen.quant}`}+ loading={runPending}+ onClick={() =>+ onRun({+ ggufVariant: chosen.quant,+ ggufFilename: chosen.filename,+ expectedBytes: chosen.size_bytes,+ precisionFolder: true,+ downloaded: chosen.downloaded === true,+ })+ }+ />+ </div>)}</div>);diff --git a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsxindex 8f729684f30..baf63a81795 100644--- a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx@@ -266,7 +266,7 @@ export function SafetensorsDownloadCard({)}</div></div>- {(showDownloadAction || showRunAction) && <CardDivider />}+ {showDownloadAction && !(showRunAction && onRun) && <CardDivider />}{showDownloadAction && (<DownloadActionButtondownloading={downloadAction.downloading}diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex e99903f410d..47b3ba57d1d 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1198,12 +1198,15 @@border-radius: 9999px;background-color: var(--status-success);/* The play glyph's empty right side reads as padding on the left, so the right gets more. */- padding: calc(0.5rem * var(--ui-space-scale, 1)) calc(0.9375rem * var(--ui-space-scale, 1))- calc(0.5rem * var(--ui-space-scale, 1)) calc(0.75rem * var(--ui-space-scale, 1));- font-size: calc(0.8125rem * var(--ui-font-scale, 1));+ padding: calc(0.625rem * var(--ui-space-scale, 1)) calc(1rem * var(--ui-space-scale, 1))+ calc(0.625rem * var(--ui-space-scale, 1)) calc(0.875rem * var(--ui-space-scale, 1));+ /* Half a pixel more on top: centred by its line box, the cap-height label sits that much high. */+ padding-block: calc(0.625rem * var(--ui-space-scale, 1) + 0.5px) calc(0.625rem * var(--ui-space-scale, 1) - 0.5px);+ margin-inline-start: calc(0.5rem * var(--ui-space-scale, 1));+ font-size: calc(0.9375rem * var(--ui-font-scale, 1));font-weight: 600;line-height: calc(1.125rem * var(--ui-font-scale, 1));- letter-spacing: -0.025em;+ letter-spacing: 0;color: #fff;transition: background-color 150ms, transform 150ms;box-shadow:@@ -1211,9 +1214,10 @@0 1px 2px color-mix(in srgb, var(--status-success) 22%, transparent);}- /* Icons add no height. */+ /* Icons add no height. The nudge undoes the label's half pixel, so the triangle stays centred. */.hub-run-action-btn svg {- margin-block: calc(-0.5rem * var(--ui-space-scale, 1));+ margin-block: calc(-0.625rem * var(--ui-space-scale, 1));+ translate: 0 -0.5px;}.hub-run-action-btn:hover:not(:disabled) {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 675229d194f..8e7546e301e 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@@ -268,7 +268,11 @@ import {modelIdsMatchForPicker,soleQuantRowState,} from "./row-identity";-import { isStandaloneGgufPath } from "@/features/hub/lib/model-identity";+import {+ isHfCacheSnapshotPath,+ isStandaloneGgufPath,+ publicModelId,+} from "@/features/hub/lib/model-identity";import { cachedRepoConfigId } from "../../model-config/model-identity";import {type FormatTone,@@ -6133,6 +6137,13 @@ export function HubModelPicker({? { ...selectMeta, ggufVariant: undefined, isGguf: true }: selectMeta,];+ // A path load keeps the menu. A cached download pins and reveals as its repo: the local+ // reveal endpoint only lists non-cache sources, so it would 404.+ const pinRepoId = !isLocal+ ? checkpoint+ : isHfCacheSnapshotPath(checkpoint)+ ? publicModelId(checkpoint)+ : null;// Its curated row is hidden while loaded, so this row must open the quant list instead.const expandable = Boolean(quant) && !isLocal && isKnownGgufRepo(entry.id);const expanded = expandable && expandedGguf === entry.id;@@ -6174,7 +6185,10 @@ export function HubModelPicker({<ModelRowMenuariaLabel={`More options for ${entry.id}`}cachePath={- isLocal ? undefined : { repoId: checkpoint, variant: quant ?? undefined }+ pinRepoId === null ? undefined : { repoId: pinRepoId, variant: quant ?? undefined }+ }+ onReveal={+ pinRepoId === null ? () => revealLocalModel(checkpoint, entry.id) : undefined}// Every loaded row ejects while several are loaded, the active one included.items={@@ -6196,13 +6210,13 @@ export function HubModelPicker({: undefined}pin={- isLocal+ pinRepoId === null? undefined: {- pinned: pinnedSet.has(pinKey(checkpoint, quant ?? undefined)),+ pinned: pinnedSet.has(pinKey(pinRepoId, quant ?? undefined)),pinLabel: "Pin",unpinLabel: "Unpin",- onToggle: () => togglePinned(checkpoint, quant ?? undefined),+ onToggle: () => togglePinned(pinRepoId, quant ?? undefined),}}/>diff --git a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx b/studio/frontend/src/features/rag/components/thread-documents-bar.tsxindex d40ae6d6f87..a45d9bde3d1 100644--- a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx+++ b/studio/frontend/src/features/rag/components/thread-documents-bar.tsx@@ -1466,7 +1466,6 @@ export function ThreadDocumentsBar({onClick={pickFiles}className="unsloth-files-panel-action">- <HugeiconsIcon icon={PlusSignIcon} className="size-4" />Add files</button></HeaderTip>diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 9706e577a5d..9667d991a71 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -2850,7 +2850,8 @@ html[data-chat-font] .aui-root {}/* Whole-pixel label, inside it, not a margin: the next row's 2px margin collapses with one. */- [data-slot="dropdown-menu-label"]::after {+ /* Not in flex or grid labels, where it would be an item and pull a justify-between chip inward. */+ [data-slot="dropdown-menu-label"]:not(.flex, .inline-flex, .grid, .inline-grid)::after {content: "";display: block;height: calc(round(up, 1lh, 1px) - 1lh);@@ -5886,8 +5887,8 @@ html[data-find-bar-open] [data-sonner-toaster][data-y-position="top"] {}.unsloth-files-panel {- /* pt-3.5: the 28px Add files pill sits in the 32px header row, so this keeps it 16px from the top edge. */- @apply relative mb-2 flex w-full flex-col gap-5 overflow-hidden rounded-2xl px-4 pt-3.5 pb-6;+ /* pt-2: the 28px Add files pill sits in the 32px header row, so this keeps it 10px from the top edge. */+ @apply relative mb-2 flex w-full flex-col gap-5 overflow-hidden rounded-2xl px-4 pt-2 pb-4;container: files-panel / inline-size;font-family: var(--font-sans);background-color: #ffffff;@@ -5944,6 +5945,9 @@ html[data-find-bar-open] [data-sonner-toaster][data-y-position="top"] {/* pt-2.5 + the 32px header row's 2px around the Add files pill = the pills' 12px below. */@apply gap-2.5 pt-2.5 pb-3;}+.unsloth-files-panel[data-collapsed="true"]:not(:has(.unsloth-files-panel-strip > *)) {+ @apply rounded-full;+}/* Dropdown-surface look. Hover washes over the solid fill, never replaces it (it would turn see-through). */.unsloth-files-panel-show-all {@apply pointer-events-none absolute top-1/2 right-0 z-10 inline-flex h-8 -translate-y-1/2 items-center rounded-full px-3.5 text-ui-13 text-popover-foreground opacity-0 transition-opacity;diff --git a/studio/frontend/tests/edit-composer-attachments.test.ts b/studio/frontend/tests/edit-composer-attachments.test.tsindex dc8a756deb6..7e38db0c070 100644--- a/studio/frontend/tests/edit-composer-attachments.test.ts+++ b/studio/frontend/tests/edit-composer-attachments.test.ts@@ -21,10 +21,38 @@ const editComposer = block(thread, "const EditComposer: FC = () => {");test("the edit composer shows the attachments it will resend", () => {assert.match(editComposer,- /<ComposerAttachments\b[^>]*\/>\s*<ComposerPrimitive\.Input\b/,+ /<ComposerAttachments\b[^>]*\/>[\s\S]{0,500}<ComposerPrimitive\.Input\b/,);});+test("the edit box keeps the prompt's line at full width, with the standard button pair", () => {+ const user = block(thread, "const UserMessage: FC = () => {");+ // Same top gap and type as the prompt bubble, so the text stays near its line.+ assert.match(+ user,+ /aui-user-message-root [^"]*\bpt-6 pb-4 text-ui-15p5 \[font-weight:410\]/,+ );+ assert.match(+ editComposer,+ /aui-edit-composer-wrapper [^"]*\bpt-6 pb-4 text-ui-15p5 \[font-weight:410\]/,+ );+ assert.match(+ editComposer,+ /aui-edit-composer-root flex w-full flex-col rounded-xl/,+ );+ assert.match(+ editComposer,+ /minRows=\{2\}\s*className="aui-edit-composer-input [^"]*\bpx-5 py-3\.5/,+ );+ assert.match(editComposer, /aui-edit-composer-footer mx-4 mb-4/);+ // The dialog pair: outline Cancel, dark action, both default size.+ assert.match(+ editComposer,+ /<Button type="button" variant="outline">\s*Cancel/,+ );+ assert.match(editComposer, /type="submit"\s*variant="dark"\s*disabled=/);+});+test("Send is disabled once the edit leaves nothing to send", () => {assert.match(editComposer,diff --git a/studio/frontend/tests/files-panel-shape.test.ts b/studio/frontend/tests/files-panel-shape.test.tsnew file mode 100644index 00000000000..7e091978160--- /dev/null+++ b/studio/frontend/tests/files-panel-shape.test.ts@@ -0,0 +1,32 @@+// 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 { readSrc } from "./helpers/kit.ts";++const css = readSrc("index.css");++test("Chat with files: tighter open padding, a pill once collapsed to its header", () => {+ assert.match(+ css,+ /\.unsloth-files-panel \{[^}]*@apply [^;]*\brounded-2xl px-4 pt-2 pb-4;/,+ );+ assert.match(+ css,+ /\.unsloth-files-panel\[data-collapsed="true"\] \{[^}]*@apply gap-2\.5 pt-2\.5 pb-3;/,+ );+ assert.match(+ css,+ /\.unsloth-files-panel\[data-collapsed="true"\]:not\(:has\(\.unsloth-files-panel-strip > \*\)\) \{\s*@apply rounded-full;/,+ );+});++test("the header's Add files pill is text only", () => {+ const bar = readSrc("features/rag/components/thread-documents-bar.tsx");+ assert.match(+ bar,+ /onClick=\{pickFiles\}\s*className="unsloth-files-panel-action"\s*>\s*Add files/,+ );+});diff --git a/studio/frontend/tests/hub-run-play-icon.test.ts b/studio/frontend/tests/hub-run-play-icon.test.tsnew file mode 100644index 00000000000..9990e1453b5--- /dev/null+++ b/studio/frontend/tests/hub-run-play-icon.test.ts@@ -0,0 +1,19 @@+// 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 { readSrc } from "./helpers/kit.ts";++test("Model hub's Run uses the filled play glyph Library's play buttons use", () => {+ const card = readSrc("features/hub/catalog/download-card.tsx");+ const library = readSrc("features/library/components/library-cards.tsx");+ const filled =+ /<PlayIcon strokeWidth=\{2\} className="[^"]*\[&_path\]:fill-current"/;+ assert.match(library, filled);+ assert.match(+ card,+ /<PlayIcon strokeWidth=\{2\} className="\[&_path\]:fill-current" \/>\s*Run/,+ );+});diff --git a/studio/frontend/tests/loaded-gguf-quant-marker.test.ts b/studio/frontend/tests/loaded-gguf-quant-marker.test.tsindex fb6b8ac60a4..2b355258855 100644--- a/studio/frontend/tests/loaded-gguf-quant-marker.test.ts+++ b/studio/frontend/tests/loaded-gguf-quant-marker.test.ts@@ -96,3 +96,24 @@ test("a loaded hub GGUF row opens its quant list, so quants downloaded after theassert.match(loadedRow, /expandable\s*\?\s*setExpandedGguf\(\(prev\) =>\s*prev === entry\.id \? null : entry\.id,?\s*\)/);assert.match(loadedRow, /\{expanded && \(\s*<GgufVariantExpander[\s\S]*?repoId=\{entry\.id\}/);});++test("a model loaded by path keeps its row menu, and a cached download pins and reveals as its repo", () => {+ // The menu hides with no items, so a path load once lost it with only one model loaded.+ const start = picker.indexOf("const renderLoadedRow = (");+ const loadedRow = picker.slice(start, picker.indexOf("const renderConnectedModelRow", start));+ assert.match(+ loadedRow,+ /const pinRepoId = !isLocal\s*\? checkpoint\s*: isHfCacheSnapshotPath\(checkpoint\)\s*\? publicModelId\(checkpoint\)\s*: null;/,+ );+ // A cached download reveals through the cache endpoint; the local one 404s for hf_cache rows.+ assert.match(+ loadedRow,+ /cachePath=\{\s*pinRepoId === null \? undefined : \{ repoId: pinRepoId, variant: quant \?\? undefined \}\s*\}/,+ );+ assert.match(+ loadedRow,+ /onReveal=\{\s*pinRepoId === null \? \(\) => revealLocalModel\(checkpoint, entry\.id\) : undefined\s*\}/,+ );+ assert.match(loadedRow, /pinnedSet\.has\(pinKey\(pinRepoId, quant \?\? undefined\)\)/);+ assert.match(loadedRow, /togglePinned\(pinRepoId, quant \?\? undefined\)/);+});diff --git a/studio/frontend/tests/menu-label-spacer.test.ts b/studio/frontend/tests/menu-label-spacer.test.tsnew file mode 100644index 00000000000..86fab74394f--- /dev/null+++ b/studio/frontend/tests/menu-label-spacer.test.ts@@ -0,0 +1,45 @@+// 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 { readSrc } from "./helpers/kit.ts";++test("the whole-pixel label spacer skips flex and grid labels", () => {+ const css = readSrc("index.css");+ const spacers = [+ ...css.matchAll(+ /\[data-slot="dropdown-menu-label"\](?::not\([^)]*\))?::after\s*\{/g,+ ),+ ];+ assert.equal(spacers.length, 1);+ assert.match(+ spacers[0]?.[0] ?? "",+ /:not\(\.flex, \.inline-flex, \.grid, \.inline-grid\)::after/,+ );+});++test("labels that pin a chip right carry a literal flex class the spacer skips", () => {+ // As a flex item the spacer pulled each chip or link off the right edge (#15232).+ const labels = [+ [+ "features/chat/permission-mode-select.tsx",+ "flex items-center justify-between gap-3",+ ],+ [+ "features/chat/permission-mode-select.tsx",+ "flex items-start justify-between gap-3",+ ],+ [+ "features/rag/components/knowledge-base-composer-button.tsx",+ "flex items-center justify-between gap-3",+ ],+ ];+ for (const [file, cls] of labels) {+ assert.ok(+ readSrc(file).includes(`<DropdownMenuLabel className="${cls}">`),+ `${file}: ${cls}`,+ );+ }+});