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: resizable Model hub split view, smaller row kebab, centred token icon (#13966)
Michael Hancc0cb59808d8
diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsxindex 446966eb7c4..02ebae6ad64 100644--- a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx+++ b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx@@ -751,8 +751,7 @@ export const InventoryRow = memo(function InventoryRow({deletableRepoId ? (<ModelRowMenuariaLabel={`More options for ${deletableRepoId ?? rowModelId}`}- buttonClassName="pointer-events-auto hub-modal-pe-guard size-8 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(pointer:coarse)]:opacity-100"- iconClassName="size-4"+ buttonClassName="pointer-events-auto hub-modal-pe-guard size-6 rounded-full opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(pointer:coarse)]:opacity-100"pin={isDataset || !deletableRepoId? undefined@@ -816,8 +815,7 @@ export const InventoryRow = memo(function InventoryRow({) : localActionPath && row.kind === "local" ? (<ModelRowMenuariaLabel={`More options for ${rowModelId}`}- buttonClassName="pointer-events-auto hub-modal-pe-guard size-8 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(pointer:coarse)]:opacity-100"- iconClassName="size-4"+ buttonClassName="pointer-events-auto hub-modal-pe-guard size-6 rounded-full opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(pointer:coarse)]:opacity-100"onReveal={() => revealLocalModel(localActionPath, row.loadId)}del={DELETABLE_LOCAL_SOURCES.has(row.source)diff --git a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx b/studio/frontend/src/features/hub/components/hf-token-indicator.tsxindex 0ac99241e27..977fe1021ce 100644--- a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx+++ b/studio/frontend/src/features/hub/components/hf-token-indicator.tsx@@ -111,18 +111,41 @@ export function HfTokenIndicator({aria-label={ariaLabel}className={cn(// Solid circle reads optically larger than the flat HTTP/Xet box, so keep it 22px.- "inline-flex h-[calc(22px*var(--ui-space-scale,1))] w-[calc(22px*var(--ui-space-scale,1))] items-center justify-center rounded-full text-ui-11p5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ "group relative inline-flex h-[calc(22px*var(--ui-space-scale,1))] w-[calc(22px*var(--ui-space-scale,1))] shrink-0 rounded-full focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",hasToken- ? "hub-tag-soft text-muted-foreground hover:text-foreground/80"- : "bg-destructive text-destructive-foreground hover:bg-destructive/90",+ ? "text-muted-foreground hover:text-foreground/80"+ : "text-destructive-foreground",)}>- <HugeiconsIcon- icon={AiSecurity03Icon}- strokeWidth={1.75}- // Shield ink leans right; nudge left to optically centre it.- className="block size-[calc(13px*var(--ui-space-scale,1))] shrink-0 -translate-x-[0.5px]"- />+ {/* One SVG: a CSS background and an inline SVG pixel-snap apart, off centre at fractional scales. */}+ <svg+ aria-hidden="true"+ viewBox="0 0 22 22"+ className="absolute inset-0 block size-full"+ >+ <circle+ cx="11"+ cy="11"+ r="11"+ className={cn(+ "transition-[fill]",+ hasToken+ ? "fill-transparent group-hover:fill-[color-mix(in_srgb,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)] dark:group-hover:fill-accent"+ : "fill-destructive group-hover:fill-destructive/90",+ )}+ />+ <g+ transform={`translate(4.5 4.5) scale(${13 / 24})`}+ fill="none"+ stroke="currentColor"+ strokeWidth={1.75}+ strokeLinejoin="round"+ >+ {AiSecurity03Icon.map(([, attrs]) => (+ <path key={String(attrs.key)} d={String(attrs.d)} />+ ))}+ </g>+ </svg></button></TooltipTrigger><TooltipContent side="bottom" sideOffset={6} className="tooltip-compact">diff --git a/studio/frontend/src/features/hub/components/hub-split-divider.tsx b/studio/frontend/src/features/hub/components/hub-split-divider.tsxnew file mode 100644index 00000000000..f1fc1b62050--- /dev/null+++ b/studio/frontend/src/features/hub/components/hub-split-divider.tsx@@ -0,0 +1,228 @@+// 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 {+ type CSSProperties,+ type KeyboardEvent,+ type PointerEvent,+ type RefObject,+ useCallback,+ useEffect,+ useRef,+ useState,+} from "react";++import {+ acquireDragOverlay,+ releaseDragOverlay,+} from "@/components/ui/panel-drag-overlay";++import {+ SPLIT_LIST_MIN_PX,+ clampSplitListWidth,+ keyboardSplitWidth,+ splitListMax,+} from "../lib/split-width";++const SPLIT_LIST_WIDTH_STORAGE_KEY = "unsloth.hub.splitListWidth";+const DRAG_SLOP = 4;++export const HUB_SPLIT_WIDTH_VAR = "--hub-split-list-width";+// Re-clamped in CSS so a stored width stays valid when the window narrows.+export const HUB_SPLIT_CUSTOM_WIDTH_CLASS =+ "lg:w-[clamp(340px,var(--hub-split-list-width),calc(100%_-_480px))]";++function readStoredWidth(): number | null {+ try {+ const value = Number(+ window.localStorage.getItem(SPLIT_LIST_WIDTH_STORAGE_KEY),+ );+ return Number.isFinite(value) && value >= SPLIT_LIST_MIN_PX ? value : null;+ } catch {+ return null;+ }+}++export function useHubSplitWidth(): {+ width: number | null;+ setWidth: (px: number | null) => void;+ style: CSSProperties | undefined;+} {+ const [width, setWidthState] = useState<number | null>(readStoredWidth);+ const setWidth = useCallback((px: number | null) => {+ const next = px === null ? null : Math.round(px);+ setWidthState(next);+ try {+ if (next === null) {+ window.localStorage.removeItem(SPLIT_LIST_WIDTH_STORAGE_KEY);+ } else {+ window.localStorage.setItem(SPLIT_LIST_WIDTH_STORAGE_KEY, String(next));+ }+ } catch {+ // Storage unavailable: the width still applies for this session.+ }+ }, []);+ const style =+ width === null+ ? undefined+ : ({ [HUB_SPLIT_WIDTH_VAR]: `${width}px` } as CSSProperties);+ return { width, setWidth, style };+}++type HubSplitDividerProps = {+ paneRef: RefObject<HTMLElement | null>;+ width: number | null;+ onWidthChange: (px: number | null) => void;+};++export function HubSplitDivider({+ paneRef,+ width,+ onWidthChange,+}: HubSplitDividerProps) {+ const dragRef = useRef<{+ startX: number;+ startWidth: number;+ moved: boolean;+ } | null>(null);+ const frameRef = useRef(0);+ const pendingRef = useRef(0);+ const [bounds, setBounds] = useState({ now: 0, max: 0, total: 0 });++ const limits = useCallback(() => {+ const pane = paneRef.current;+ const total = pane?.parentElement?.clientWidth ?? 0;+ return {+ now: pane?.getBoundingClientRect().width ?? 0,+ max: splitListMax(total),+ total,+ };+ }, [paneRef]);++ useEffect(() => {+ const pane = paneRef.current;+ if (!pane?.parentElement) return;+ const update = () => {+ const next = limits();+ setBounds((prev) =>+ Math.round(prev.now) === Math.round(next.now) && prev.max === next.max+ ? prev+ : next,+ );+ };+ update();+ const observer = new ResizeObserver(update);+ observer.observe(pane);+ observer.observe(pane.parentElement);+ return () => observer.disconnect();+ }, [paneRef, limits]);++ const clamp = useCallback(+ (px: number) => clampSplitListWidth(px, limits().total),+ [limits],+ );++ const endDrag = useCallback(() => {+ dragRef.current = null;+ if (frameRef.current) {+ cancelAnimationFrame(frameRef.current);+ frameRef.current = 0;+ }+ paneRef.current?.removeAttribute("data-resizing");+ releaseDragOverlay();+ }, [paneRef]);++ useEffect(+ () => () => {+ if (dragRef.current) endDrag();+ },+ [endDrag],+ );++ const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {+ if (event.button !== 0) return;+ event.preventDefault();+ event.currentTarget.setPointerCapture(event.pointerId);+ const start = limits().now;+ dragRef.current = {+ startX: event.clientX,+ startWidth: start,+ moved: false,+ };+ pendingRef.current = start;+ paneRef.current?.setAttribute("data-resizing", "true");+ acquireDragOverlay();+ };++ const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {+ const drag = dragRef.current;+ if (!drag) return;+ const delta = event.clientX - drag.startX;+ if (!drag.moved) {+ if (Math.abs(delta) < DRAG_SLOP) return;+ drag.moved = true;+ // The default width is CSS-only; pin it so the var below takes over.+ if (width === null) onWidthChange(drag.startWidth);+ }+ pendingRef.current = clamp(drag.startWidth + delta);+ if (frameRef.current) return;+ // One paint per frame; the page re-renders only on release.+ frameRef.current = requestAnimationFrame(() => {+ frameRef.current = 0;+ paneRef.current?.style.setProperty(+ HUB_SPLIT_WIDTH_VAR,+ `${pendingRef.current}px`,+ );+ });+ };++ // Cancel and lost capture commit too, else the pane keeps an unsaved painted width.+ const finishDrag = (event: PointerEvent<HTMLButtonElement>) => {+ const drag = dragRef.current;+ if (!drag) return;+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {+ event.currentTarget.releasePointerCapture(event.pointerId);+ }+ endDrag();+ if (drag.moved) onWidthChange(pendingRef.current);+ };++ const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {+ const { now, total } = limits();+ const next = keyboardSplitWidth(now, event.key, total);+ if (next !== null) {+ event.preventDefault();+ onWidthChange(next);+ } else if (event.key === "Home") {+ event.preventDefault();+ onWidthChange(null);+ }+ };++ return (+ <div className="relative hidden w-0 shrink-0 lg:block">+ <button+ type="button"+ data-slot="hub-split-divider"+ role="separator"+ aria-orientation="vertical"+ aria-label="Resize model list"+ aria-valuenow={Math.round(bounds.now)}+ aria-valuemin={SPLIT_LIST_MIN_PX}+ aria-valuemax={Math.round(bounds.max)}+ title="Drag to resize, double-click to reset"+ onPointerDown={handlePointerDown}+ onPointerMove={handlePointerMove}+ onPointerUp={finishDrag}+ onPointerCancel={finishDrag}+ onLostPointerCapture={finishDrag}+ onDoubleClick={() => onWidthChange(null)}+ onKeyDown={handleKeyDown}+ className={+ // Centred on the list's 1px border, which the hover line recolours.+ "absolute inset-y-0 -left-1.5 z-30 w-3 cursor-col-resize! touch-none select-none outline-none after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-full after:w-px after:bg-transparent after:transition-colors after:duration-150 hover:after:bg-sidebar-ring/40 focus-visible:after:bg-sidebar-ring/70 active:after:bg-sidebar-ring/40"+ }+ />+ </div>+ );+}diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsxindex 9922528ad13..e10ffb85568 100644--- a/studio/frontend/src/features/hub/hub-page.tsx+++ b/studio/frontend/src/features/hub/hub-page.tsx@@ -51,6 +51,11 @@ import { FreeUpSpaceDialog } from "./catalog/free-up-space-dialog";import { HubDetailView } from "./catalog/hub-detail-view";import { HubFeed } from "./catalog/hub-feed";import { HubTopBar } from "./catalog/hub-top-bar";+import {+ HUB_SPLIT_CUSTOM_WIDTH_CLASS,+ HubSplitDivider,+ useHubSplitWidth,+} from "./components/hub-split-divider";import { buildHubTourSteps } from "./tour";import {ModelsCatalog,@@ -2056,6 +2061,9 @@ export function ModelsPage() {// Unreachable under the full-page detail overlay.const catalogCovered = detailOpen && !splitMode;+ const catalogPaneRef = useRef<HTMLDivElement>(null);+ const splitWidth = useHubSplitWidth();+const tour = useGuidedTourController({id: "hub",steps: useMemo(() => buildHubTourSteps({ catalogCovered }), [catalogCovered]),@@ -2117,17 +2125,24 @@ export function ModelsPage() {)}><div+ ref={catalogPaneRef}data-tour="hub-catalog"className={cn("flex min-h-0 flex-col",// Split mode keeps the catalog as a master pane that grows off a 460px floor; otherwise it// fills the area and the detail view overlays it.splitMode- ? "flex-1 lg:w-[clamp(460px,32%,620px)] lg:max-w-[44%] lg:flex-none lg:shrink-0 lg:border-r lg:border-border/60"+ ? cn(+ "flex-1 lg:flex-none lg:shrink-0 lg:border-r lg:border-border/60",+ splitWidth.width === null+ ? "lg:w-[clamp(460px,32%,620px)] lg:max-w-[44%]"+ : HUB_SPLIT_CUSTOM_WIDTH_CLASS,+ ): "flex-1",// A full-bleed opaque overlay, so the catalog leaves the tab order; else tabbing walks behind it.catalogCovered && "pointer-events-none",)}+ style={splitMode ? splitWidth.style : undefined}aria-hidden={catalogCovered || undefined}inert={catalogCovered || undefined}>@@ -2152,6 +2167,13 @@ export function ModelsPage() {)}</div>+ {splitMode && !isCompactViewport && (+ <HubSplitDivider+ paneRef={catalogPaneRef}+ width={splitWidth.width}+ onWidthChange={splitWidth.setWidth}+ />+ )}{splitMode ? (detailOpen ? (<divdiff --git a/studio/frontend/src/features/hub/lib/split-width.ts b/studio/frontend/src/features/hub/lib/split-width.tsnew file mode 100644index 00000000000..75af525300c--- /dev/null+++ b/studio/frontend/src/features/hub/lib/split-width.ts@@ -0,0 +1,26 @@+// 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 const SPLIT_LIST_MIN_PX = 340;+export const SPLIT_DETAIL_MIN_PX = 480;+export const SPLIT_RESIZE_STEP_PX = 16;++export function splitListMax(totalPx: number): number {+ return Math.max(SPLIT_LIST_MIN_PX, totalPx - SPLIT_DETAIL_MIN_PX);+}++export function clampSplitListWidth(px: number, totalPx: number): number {+ return Math.min(Math.max(px, SPLIT_LIST_MIN_PX), splitListMax(totalPx));+}++// Steps from the RENDERED width: a stored width past the max renders clamped.+export function keyboardSplitWidth(+ renderedPx: number,+ key: string,+ totalPx: number,+): number | null {+ if (key !== "ArrowLeft" && key !== "ArrowRight") return null;+ const step =+ key === "ArrowRight" ? SPLIT_RESIZE_STEP_PX : -SPLIT_RESIZE_STEP_PX;+ return clampSplitListWidth(renderedPx + step, totalPx);+}diff --git a/studio/frontend/tests/hub-split-width.test.ts b/studio/frontend/tests/hub-split-width.test.tsnew file mode 100644index 00000000000..286072cad1f--- /dev/null+++ b/studio/frontend/tests/hub-split-width.test.ts@@ -0,0 +1,34 @@+// 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 {+ clampSplitListWidth,+ keyboardSplitWidth,+ splitListMax,+} from "../src/features/hub/lib/split-width.ts";+import { readSrc } from "./helpers/kit.ts";++test("the list keeps 340px and the detail pane keeps 480px", () => {+ assert.equal(splitListMax(1100), 620);+ assert.equal(splitListMax(700), 340);+ assert.equal(clampSplitListWidth(100, 1100), 340);+ assert.equal(clampSplitListWidth(900, 1100), 620);+});++test("arrow keys step from the rendered width, not a wider stored one", () => {+ // Stored 900px on a 1100px row renders clamped at 620px; Left must move off that edge.+ assert.equal(keyboardSplitWidth(620, "ArrowLeft", 1100), 604);+ assert.equal(keyboardSplitWidth(620, "ArrowRight", 1100), 620);+ assert.equal(keyboardSplitWidth(500, "ArrowRight", 1100), 516);+ assert.equal(keyboardSplitWidth(500, "Home", 1100), null);+});++test("a cancelled drag commits the painted width like a release", () => {+ const src = readSrc("features/hub/components/hub-split-divider.tsx");+ assert.match(src, /onPointerUp=\{finishDrag\}/);+ assert.match(src, /onPointerCancel=\{finishDrag\}/);+ assert.match(src, /onLostPointerCapture=\{finishDrag\}/);+});