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.

Fix Audio layout and responsive media headers (#8445)

Lee Jackson4b38ab1b4684
diff --git a/studio/frontend/src/features/audio/audio-page.tsx b/studio/frontend/src/features/audio/audio-page.tsx
index 3c4766ce972..cff6afb32c1 100644
--- a/studio/frontend/src/features/audio/audio-page.tsx
+++ b/studio/frontend/src/features/audio/audio-page.tsx
@@ -1832,81 +1832,91 @@ export function AudioPage({ active = true }: { active?: boolean }) {
return (
<div className="@container flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">
- <div className="relative flex h-[48px] shrink-0 items-start justify-between gap-2 pl-[var(--studio-media-header-left-inset,1.5rem)] pr-2 pt-[var(--studio-chat-header-padding-top,11px)]">
- {/* min-w-0: a long resident model name would otherwise push the mode pill off a narrow window. */}
- <div className="flex min-w-0 items-center gap-2">
- <ModelSelector
- models={selectorModels}
- additionalOnDeviceModels={
- mode === "transcribe" ? sttOnDeviceModels : trainedTtsModels
- }
- loadedModelIdOverride={
- mode === "transcribe" && sttReady
- ? (selectedSttRepo ?? undefined)
- : undefined
- }
- loaded={mode === "transcribe" ? sttReady : undefined}
- value={selectorValue}
- onValueChange={handleModelSelect}
- onEject={busy === null && selectorValue ? handleEject : undefined}
- variant="ghost"
- className="!h-[34px]"
- task={HUB_TASKS_BY_MODE[mode]}
- catalog={AUDIO_CATALOG}
- // TTS/ASR come from the checkpoint's own tokenizer, not a curated
- // recipe, so any publisher's audio repo loads here.
- communityModelPolicy="search-only"
- placeholder="Select audio model"
- open={active && selectorOpen}
- onOpenChange={(o) => setSelectorOpen(active && o)}
- />
+ {/* Keep the tabs centered over the preview region at every width. The model rail
+ holds at 408px when space permits and shrinks only to preserve the controls. */}
+ <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
+ <div className="pointer-events-none flex h-full min-w-0 items-start overflow-hidden pl-[var(--studio-media-header-left-inset,1.5rem)] @[50rem]:border-r @[50rem]:border-border/60">
+ {/* A long resident model name must yield to the mode pill instead of painting over it. */}
+ <div className="pointer-events-auto flex min-w-0 max-w-full items-center gap-2 overflow-hidden pt-[var(--studio-chat-header-padding-top,11px)]">
+ <ModelSelector
+ models={selectorModels}
+ additionalOnDeviceModels={
+ mode === "transcribe" ? sttOnDeviceModels : trainedTtsModels
+ }
+ loadedModelIdOverride={
+ mode === "transcribe" && sttReady
+ ? (selectedSttRepo ?? undefined)
+ : undefined
+ }
+ loaded={mode === "transcribe" ? sttReady : undefined}
+ value={selectorValue}
+ onValueChange={handleModelSelect}
+ onEject={busy === null && selectorValue ? handleEject : undefined}
+ variant="ghost"
+ className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
+ triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"
+ task={HUB_TASKS_BY_MODE[mode]}
+ catalog={AUDIO_CATALOG}
+ // TTS/ASR come from the checkpoint's own tokenizer, not a curated
+ // recipe, so any publisher's audio repo loads here.
+ communityModelPolicy="search-only"
+ placeholder="Select audio model"
+ open={active && selectorOpen}
+ onOpenChange={(o) => setSelectorOpen(active && o)}
+ />
+ </div>
</div>
- <div className="pointer-events-none absolute inset-x-0 top-[var(--studio-chat-header-padding-top,11px)] flex justify-center">
- <PillTabs
- ariaLabel="Page mode"
- // Always "create": Train navigates away, so the pill never latches.
- value="create"
- onValueChange={(v) => {
- if (v !== "train") return;
- toast.info(
- "Audio fine-tuning lives on the Train page. Unsloth trains TTS and STT models there. Pick an audio model and appropriate dataset.",
- { duration: 8000 },
- );
- void navigateSelf({ to: "/studio" });
- }}
- fit={true}
- className="pointer-events-auto h-[34px] [&>button]:h-[34px] [&>button]:px-3 @[68rem]:[&>button]:px-11"
- tabs={[
- {
- value: "create",
- label: "Create",
- icon: (
- <HugeiconsIcon icon={SparklesIcon} className="size-3.5" />
- ),
- },
- {
- value: "train",
- label: "Train",
- icon: (
- <HugeiconsIcon
- icon={TestTubeOutlineIcon}
- className="size-3.5"
- />
- ),
- },
- ]}
- />
+ <div className="grid h-full min-w-0 grid-cols-[1fr_auto] @[50rem]:grid-cols-[1fr_auto_1fr]">
+ <div className="pointer-events-auto col-start-2 justify-self-end pr-3 pt-[var(--studio-chat-header-padding-top,11px)] @[50rem]:justify-self-center @[50rem]:pr-0">
+ <PillTabs
+ ariaLabel="Page mode"
+ // Always "create": Train navigates away, so the pill never latches.
+ value="create"
+ onValueChange={(v) => {
+ if (v !== "train") return;
+ toast.info(
+ "Audio fine-tuning lives on the Train page. Unsloth trains TTS and STT models there. Pick an audio model and appropriate dataset.",
+ { duration: 8000 },
+ );
+ void navigateSelf({ to: "/studio" });
+ }}
+ fit={true}
+ className="h-[34px] [&>button]:h-[34px] [&>button]:px-3 @[68rem]:[&>button]:px-11"
+ tabs={[
+ {
+ value: "create",
+ label: "Create",
+ icon: (
+ <HugeiconsIcon icon={SparklesIcon} className="size-3.5" />
+ ),
+ },
+ {
+ value: "train",
+ label: "Train",
+ icon: (
+ <HugeiconsIcon
+ icon={TestTubeOutlineIcon}
+ className="size-3.5"
+ />
+ ),
+ },
+ ]}
+ />
+ </div>
</div>
</div>
{/* Below 50rem the panes stack and the page scrolls as one column, matching Images and
Video: side by side, the 408px rail plus a usable preview needs more width than that. */}
- <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pl-2 pr-5 pt-9 sm:pr-8 @[50rem]:flex-row @[50rem]:overflow-hidden">
- <div className="flex w-full shrink-0 flex-col border-b border-border/60 pl-8 @[50rem]:w-[408px] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">
+ <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden @[50rem]:flex-row @[50rem]:overflow-hidden">
+ <div className="flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[408px] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">
<div
ref={attachSettingsScroll}
onScroll={onSettingsScroll}
className={cn(
- "hover-scrollbar panel-scroll-fade-action flex min-h-0 flex-1 flex-col gap-4 pb-6 pl-0.5 pr-8 @[50rem]:overflow-y-auto",
+ "hover-scrollbar flex min-h-0 flex-1 flex-col gap-4 px-10 pt-9 pb-6 @[50rem]:overflow-y-auto",
+ mode === "speak"
+ ? "panel-scroll-fade-action"
+ : "panel-scroll-fade",
settingsFadeClass,
)}
>
@@ -2035,7 +2045,7 @@ export function AudioPage({ active = true }: { active?: boolean }) {
</div>
{mode === "speak" ? (
/* The scroll mask provides the fade; leave the footer unpainted to avoid dark-mode banding. */
- <div className="relative z-10 flex shrink-0 justify-center pt-0.5 pb-4 pl-8 pr-8">
+ <div className="relative z-10 flex shrink-0 justify-center px-10 pt-0.5 pb-4">
<Button
className="relative z-10 h-11 px-8 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100"
onClick={
@@ -2061,9 +2071,9 @@ export function AudioPage({ active = true }: { active?: boolean }) {
) : null}
</div>
- <div className="relative flex min-h-[60dvh] min-w-0 flex-1 flex-col overflow-hidden pl-2 @[50rem]:min-h-0">
+ <div className="relative flex min-h-[60dvh] min-w-0 flex-1 flex-col overflow-hidden @[50rem]:min-h-0">
{mode === "transcribe" ? (
- <div className="hover-scrollbar flex flex-1 flex-col gap-3 overflow-auto p-6 pl-8">
+ <div className="hover-scrollbar flex flex-1 flex-col gap-3 overflow-auto p-6 px-10 @[50rem]:pt-[60px]">
{busy === "transcribing" ? (
<div className="flex items-center gap-2 text-ui-13 text-muted-foreground">
<Spinner className="size-4" />
@@ -2104,7 +2114,7 @@ export function AudioPage({ active = true }: { active?: boolean }) {
) : null}
</div>
) : (
- <div className="flex min-h-0 flex-1 flex-col gap-4 p-6 pl-8">
+ <div className="flex min-h-0 flex-1 flex-col gap-4 p-6 px-10 @[50rem]:pt-[60px]">
<div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-4">
{selectedClip ? (
<div className="flex w-full max-w-xl flex-col gap-3">
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 6a6d8e8e25e..4f1ed5eff23 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -3590,10 +3590,9 @@ export function ImagesPage({ active = true }: { active?: boolean }) {
// The chat-style layout gives this page no outer top inset, so clear the custom
// titlebar here (34px on win/linux, 0 under macOS's native one) as chat does.
<div className="diffusion-surface @container flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">
- {/* Below 50rem, equal side tracks keep the mode switch centered without overlaying
- either action group. Above it, the 408px rail continues through the header and
- Create / Train centers over the preview pane. */}
- <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-2 @[50rem]:grid-cols-[408px_minmax(0,1fr)] @[50rem]:gap-0">
+ {/* Keep the tabs centered over the preview region at every width. The model rail
+ holds at 408px when space permits and shrinks only to preserve the controls. */}
+ <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
<div
className={cn(
"pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",
@@ -3624,7 +3623,8 @@ export function ImagesPage({ active = true }: { active?: boolean }) {
resolveDownloadFootprint={resolveDownloadFootprint}
onEject={status?.loaded ? handleUnload : undefined}
variant="ghost"
- className="!h-[34px] max-w-full overflow-hidden"
+ className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
+ triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"
task={IMAGE_GEN_TASKS}
catalog={IMAGE_CATALOG}
placeholder="Select image model"
@@ -3651,8 +3651,8 @@ export function ImagesPage({ active = true }: { active?: boolean }) {
)}
</div>
</div>
- <div className="contents @[50rem]:grid @[50rem]:h-full @[50rem]:min-w-0 @[50rem]:grid-cols-[1fr_auto_1fr]">
- <div className="pointer-events-auto justify-self-center pt-[var(--studio-chat-header-padding-top,11px)] @[50rem]:col-start-2">
+ <div className="grid h-full min-w-0 grid-cols-[1fr_auto_auto] gap-2 @[50rem]:grid-cols-[1fr_auto_1fr] @[50rem]:gap-0">
+ <div className="pointer-events-auto col-start-2 justify-self-center pt-[var(--studio-chat-header-padding-top,11px)]">
<PillTabs
ariaLabel="Page mode"
value={pageMode}
@@ -3665,7 +3665,7 @@ export function ImagesPage({ active = true }: { active?: boolean }) {
]}
/>
</div>
- <div className="pointer-events-none flex min-w-0 items-start justify-end pr-2 pt-[var(--studio-chat-header-padding-top,11px)] @[50rem]:col-start-3">
+ <div className="pointer-events-none col-start-3 flex min-w-0 items-start justify-end pr-2 pt-[var(--studio-chat-header-padding-top,11px)]">
<div className="pointer-events-auto flex min-w-0 items-center gap-2">
<MediaPageLink
to="/video"
diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsx
index 7ac642dc747..aee92c224da 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx
@@ -167,6 +167,8 @@ interface ModelSelectorProps {
variant?: "outline" | "ghost" | "muted";
size?: "sm" | "default" | "lg";
className?: string;
+ /** Responsive text sizing for headers that have to share a constrained row. */
+ triggerLabelClassName?: string;
contentClassName?: string;
open?: boolean;
onOpenChange?: (open: boolean) => void;
@@ -191,6 +193,7 @@ function ModelSelectorTrigger({
variant = "outline",
size = "default",
className,
+ triggerLabelClassName,
dataTour,
onEject,
// Task pages name what they pick ("Select image model"), so the choice reads as separate from the chat model.
@@ -202,6 +205,7 @@ function ModelSelectorTrigger({
variant?: "outline" | "ghost" | "muted";
size?: "sm" | "default" | "lg";
className?: string;
+ triggerLabelClassName?: string;
dataTour?: string;
onEject?: () => void;
placeholder?: string;
@@ -266,7 +270,12 @@ function ModelSelectorTrigger({
</span>
) : null}
<span className="flex min-w-0 flex-1 items-baseline">
- <span className="min-w-0 flex flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-white">
+ <span
+ className={cn(
+ "min-w-0 flex flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-white",
+ triggerLabelClassName,
+ )}
+ >
{currentModel?.name ?? placeholder}
{showCloudIndicator ? (
<HugeiconsIcon
@@ -653,6 +662,7 @@ export function ModelSelector({
variant = "outline",
size = "default",
className,
+ triggerLabelClassName,
contentClassName,
open: controlledOpen,
onOpenChange,
@@ -801,6 +811,7 @@ export function ModelSelector({
variant={variant}
size={size}
className={className}
+ triggerLabelClassName={triggerLabelClassName}
dataTour={triggerDataTour}
onEject={onEject ? handleEject : undefined}
placeholder={placeholder}
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index b355011c51b..684a7aea8aa 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -1286,7 +1286,7 @@ html[data-chat-font] .aui-root {
mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
}
- /* Crossfade Images settings into its in-flow action footer. Multiple alpha stops
+ /* Crossfade media settings into their in-flow action footers. Multiple alpha stops
approximate a smooth 48px ease without painting a separate footer overlay. */
.panel-scroll-fade-action.is-bottom-faded {
-webkit-mask-image: linear-gradient(
diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.py
index ad9933ebbd1..61c94df3e93 100644
--- a/tests/studio/test_desktop_reliability_frontend_contract.py
+++ b/tests/studio/test_desktop_reliability_frontend_contract.py
@@ -41,6 +41,7 @@ DESKTOP_UPDATE_POLICY = REPO / "studio/src-tauri/src/desktop_update_policy.rs"
APP_PROVIDER = FRONTEND / "app/provider.tsx"
ROOT_ROUTE = FRONTEND / "app/routes/__root.tsx"
IMAGES_PAGE = FRONTEND / "features/images/images-page.tsx"
+AUDIO_PAGE = FRONTEND / "features/audio/audio-page.tsx"
DIFFUSION_TRAIN_PANEL = FRONTEND / "features/images/train/diffusion-train-panel.tsx"
MEDIA_PAGE_LINK = FRONTEND / "components/media-page-link.tsx"
@@ -800,6 +801,43 @@ def test_image_page_structural_panes_share_the_container_breakpoint():
assert "border-t border-foreground/10 px-10 py-3" in section
+def test_audio_page_matches_the_image_rail_header_and_action_footer():
+ source = AUDIO_PAGE.read_text(encoding = "utf-8")
+ before, marker, after = source.partition("h-[48px] shrink-0")
+ assert marker
+ header_opening = before.rsplit('<div className="', 1)[1] + marker + after.split(">", 1)[0]
+ header = header_opening + after.split("Below 50rem", 1)[0]
+ layout = source.split("Below 50rem", 1)[1]
+
+ assert "grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]" in header_opening
+ assert "pointer-events-none" in header_opening
+ assert "relative" in header_opening
+ assert "z-40" in header_opening
+ assert "@[50rem]:border-r" in header
+ assert (
+ 'className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 '
+ '@[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"' in header
+ )
+ assert 'triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"' in header
+ assert "grid h-full min-w-0 grid-cols-[1fr_auto]" in header
+ assert "@[50rem]:grid-cols-[1fr_auto_1fr]" in header
+ assert "col-start-2 justify-self-end pr-3" in header
+ assert "@[50rem]:justify-self-center @[50rem]:pr-0" in header
+ assert "absolute" not in header.split("<PillTabs", 1)[0]
+
+ assert "@[50rem]:flex-row @[50rem]:overflow-hidden" in layout
+ assert "@[50rem]:w-[408px]" in layout
+ assert "@[50rem]:border-r @[50rem]:border-b-0" in layout
+ assert "gap-4 px-10 pt-9 pb-6 @[50rem]:overflow-y-auto" in layout
+ assert 'mode === "speak"' in layout
+ assert '"panel-scroll-fade-action"' in layout
+ assert '"panel-scroll-fade"' in layout
+ assert "relative z-10 flex shrink-0 justify-center px-10 pt-0.5 pb-4" in layout
+ assert "btn-float-action" not in layout
+ assert "absolute inset-x-0 bottom-0" not in layout
+ assert layout.count("p-6 px-10 @[50rem]:pt-[60px]") == 2
+
+
def test_image_train_rail_matches_create_and_header():
source = DIFFUSION_TRAIN_PANEL.read_text(encoding = "utf-8")
layout = source.split("overflow-x-hidden: an unset overflow-x", 1)[1]
@@ -855,17 +893,20 @@ def test_images_header_tracks_preview_and_preserves_titlebar_controls():
header = opening + after.split("{/* Train mode", 1)[0]
assert "const { isMobile, pinned } = useSidebar();" in source
- assert "grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]" in opening
- assert "@[50rem]:grid-cols-[408px_minmax(0,1fr)]" in opening
+ assert "grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]" in opening
assert "@[50rem]:border-r" in header
assert "isMobile" in header and "pl-12" in header
assert "!pinned && isTauri" in header
assert "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]" in header
- assert 'className="!h-[34px] max-w-full overflow-hidden"' in header
- assert "contents @[50rem]:grid" in header
- assert "@[50rem]:grid-cols-[1fr_auto_1fr]" in header
- assert "@[50rem]:col-start-2" in header
- assert "@[50rem]:col-start-3" in header
+ assert (
+ 'className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 '
+ '@[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"' in header
+ )
+ assert 'triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"' in header
+ assert "grid h-full min-w-0 grid-cols-[1fr_auto_auto] gap-2" in header
+ assert "@[50rem]:grid-cols-[1fr_auto_1fr] @[50rem]:gap-0" in header
+ assert "col-start-2" in header
+ assert "col-start-3" in header
assert 'labelClassName="hidden @[50rem]:inline"' in header
assert 'arrowClassName="hidden @[50rem]:block"' in header
assert "absolute" not in header.split("<PillTabs", 1)[0]