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: Video Create and Train tabs, media header icons, Images and Video linked (#15520)
Michael Hanf4f15d333c0a
diff --git a/studio/backend/core/training/diffusion_train_common.py b/studio/backend/core/training/diffusion_train_common.pyindex 43a5c5e5882..cec1cc36241 100644--- a/studio/backend/core/training/diffusion_train_common.py+++ b/studio/backend/core/training/diffusion_train_common.py@@ -1016,6 +1016,8 @@ def family_train_infos() -> list[dict[str, Any]]:# sample_every is refused elsewhere, so the panel offers "Sample every" only where it runs."supports_samples": name in SAMPLE_FAMILIES,"supports_bucketing": name not in UNBUCKETED_FAMILIES,+ # The images loader refuses video bases, so the panel offers no Deploy to Create for these.+ "is_video": name in TRAINABLE_VIDEO_FAMILIES,# A batch > 1 is REFUSED for a family whose forward covers one packed sequence, so leaving the control# unrestricted turns a reasonable 2 into a rejected Start with nothing to say why."max_train_batch_size": 1 if name in SINGLE_SEQUENCE_FAMILIES else None,diff --git a/studio/backend/models/training.py b/studio/backend/models/training.pyindex 5be9f5e9862..da4d1dd5ca1 100644--- a/studio/backend/models/training.py+++ b/studio/backend/models/training.py@@ -1345,6 +1345,7 @@ class DiffusionTrainableFamily(BaseModel):supports_checkpoints: bool = Truesupports_samples: bool = Falsesupports_bucketing: bool = True+ is_video: bool = False# 1 for a family whose forward covers one packed sequence: a value above the cap is refused rather# than clamped, and declaring it here is what stops Pydantic dropping it from the response.max_train_batch_size: Optional[int] = Nonediff --git a/studio/backend/tests/test_diffusion_train_is_video.py b/studio/backend/tests/test_diffusion_train_is_video.pynew file mode 100644index 00000000000..f74abc4d351--- /dev/null+++ b/studio/backend/tests/test_diffusion_train_is_video.py@@ -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+++def test_video_families_are_flagged_through_the_response_model():+ """The images loader refuses video bases, so the Train panel hides Deploy to Create on this flag."""+ from core.training.diffusion_train_common import (+ TRAINABLE_VIDEO_FAMILIES,+ family_train_infos,+ )+ from models.training import DiffusionTrainableFamily++ infos = {info["name"]: info for info in family_train_infos()}+ assert {"ltx-2", "minimax-h3"} <= TRAINABLE_VIDEO_FAMILIES+ for name, info in infos.items():+ expected = name in TRAINABLE_VIDEO_FAMILIES+ assert info["is_video"] is expected, name+ assert DiffusionTrainableFamily(**info).is_video is expected, name+ assert infos["z-image"]["is_video"] is Falsediff --git a/studio/frontend/src/components/media-api-button.tsx b/studio/frontend/src/components/media-api-button.tsxindex 7169c8c81aa..7207597faaa 100644--- a/studio/frontend/src/components/media-api-button.tsx+++ b/studio/frontend/src/components/media-api-button.tsx@@ -11,6 +11,7 @@ import {} from "@/components/ui/tooltip";import { publicModelId } from "@/features/hub";import { useSettingsDialogStore } from "@/features/settings";+import { HEADER_ICON_BUTTON } from "@/components/media-page-link";import { useT } from "@/i18n";export function MediaApiButton({@@ -35,12 +36,13 @@ export function MediaApiButton({model: model ? publicModelId(model) : null,})}- className="flex h-[calc(34px*var(--ui-space-scale,1))] w-[calc(34px*var(--ui-space-scale,1))] shrink-0 items-center justify-center gap-1.5 rounded-full text-ui-13 @[84rem]:w-auto @[84rem]:px-2.5 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className={HEADER_ICON_BUTTON}>- <HugeiconsIcon icon={ApiIcon} className="size-4 shrink-0" />- <span className="hidden whitespace-nowrap @[84rem]:inline">- {label}- </span>+ <HugeiconsIcon+ icon={ApiIcon}+ strokeWidth={1.75}+ className="size-icon"+ /></button></TooltipTrigger><TooltipContent side="bottom" sideOffset={6} className="tooltip-compact">diff --git a/studio/frontend/src/components/media-page-link.tsx b/studio/frontend/src/components/media-page-link.tsxindex 50bebd5d1f4..070b00c0658 100644--- a/studio/frontend/src/components/media-page-link.tsx+++ b/studio/frontend/src/components/media-page-link.tsx@@ -1,7 +1,11 @@// 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 { LibrariesIcon } from "@hugeicons/core-free-icons";+import {+ FlimSlateIcon,+ Image03Icon,+ LibrariesIcon,+} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import type { IconSvgElement } from "@hugeicons/react";import { useNavigate } from "@tanstack/react-router";@@ -14,11 +18,12 @@ import {import type { LibraryTab } from "@/features/library";import { useT } from "@/i18n";import { cn } from "@/lib/utils";-import {- ArrowRightIcon,-} from "lucide-react";+import { ArrowRightIcon } from "lucide-react";++export const HEADER_ICON_BUTTON =+ "flex size-[calc(30px*var(--ui-space-scale,1))] shrink-0 cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:hover:text-white";-/** Link to another page's workspace, parked past a divider so it reads as leaving. */+/** Link to another page, past a divider; `iconOnly` makes it a header icon button. */export function MediaPageLink({to,libraryTab,@@ -28,6 +33,8 @@ export function MediaPageLink({onNavigate,labelClassName,arrowClassName,+ iconOnly = false,+ iconArrow = false,}: {to: "/images" | "/video" | "/audio" | "/library";libraryTab?: LibraryTab;@@ -38,8 +45,58 @@ export function MediaPageLink({onNavigate?: () => void;labelClassName?: string;arrowClassName?: string;+ iconOnly?: boolean;+ iconArrow?: boolean;}) {const navigate = useNavigate();+ const go = () => {+ onNavigate?.();+ if (to === "/library") {+ void navigate({ to, search: libraryTab ? { show: libraryTab } : {} });+ } else {+ void navigate({ to });+ }+ };+ if (iconOnly) {+ return (+ <Tooltip>+ <TooltipTrigger asChild={true}>+ <button+ type="button"+ aria-label={label}+ onClick={go}+ className={cn(+ HEADER_ICON_BUTTON,+ // The square button's inset, so the icon stays put.+ iconArrow &&+ "w-auto gap-1.5 pr-2 pl-[calc((30px*var(--ui-space-scale,1)-var(--icon-size))/2)]",+ )}+ >+ <HugeiconsIcon+ icon={icon}+ strokeWidth={1.75}+ className="size-icon"+ />+ {iconArrow && (+ <>+ <span className="hidden min-w-0 truncate text-ui-13 font-medium @[50rem]:inline">+ {label}+ </span>+ <ArrowRightIcon className="size-3.5 shrink-0 opacity-60" />+ </>+ )}+ </button>+ </TooltipTrigger>+ <TooltipContent+ side="bottom"+ sideOffset={6}+ className="tooltip-compact"+ >+ {tooltip ?? label}+ </TooltipContent>+ </Tooltip>+ );+ }return (<>{/* first:hidden: the control to its left is conditional, and a leading divider looks stray. */}@@ -52,24 +109,23 @@ export function MediaPageLink({<buttontype="button"aria-label={label}- onClick={() => {- onNavigate?.();- if (to === "/library") {- void navigate({ to, search: libraryTab ? { show: libraryTab } : {} });- } else {- void navigate({ to });- }- }}+ onClick={go}className="flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 items-center gap-1.5 rounded-full pl-2.5 pr-2 text-ui-13 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><HugeiconsIcon icon={icon} className="size-4 shrink-0" />- <span className={cn("min-w-0 truncate", labelClassName)}>{label}</span>+ <span className={cn("min-w-0 truncate", labelClassName)}>+ {label}+ </span><ArrowRightIconclassName={cn("size-3.5 shrink-0 opacity-60", arrowClassName)}/></button></TooltipTrigger>- <TooltipContent side="bottom" sideOffset={6} className="tooltip-compact">+ <TooltipContent+ side="bottom"+ sideOffset={6}+ className="tooltip-compact"+ >{tooltip ?? `Go to ${label}`}</TooltipContent></Tooltip>@@ -81,10 +137,12 @@ export function LibraryPageLink({tab,labelClassName,arrowClassName,+ iconOnly,}: {tab: LibraryTab;labelClassName?: string;arrowClassName?: string;+ iconOnly?: boolean;}) {const t = useT();return (@@ -96,6 +154,24 @@ export function LibraryPageLink({icon={LibrariesIcon}labelClassName={labelClassName}arrowClassName={arrowClassName}+ iconOnly={iconOnly}+ />+ );+}++export function SiblingMediaPageLink({ to }: { to: "/images" | "/video" }) {+ const t = useT();+ const label = t(+ to === "/images" ? "shell.navigation.images" : "shell.navigation.video",+ );+ return (+ <MediaPageLink+ to={to}+ label={label}+ icon={to === "/images" ? Image03Icon : FlimSlateIcon}+ tooltip={label}+ iconOnly={true}+ iconArrow={true}/>);}diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.tsindex 1d3c8c81271..e9451414633 100644--- a/studio/frontend/src/features/images/api.ts+++ b/studio/frontend/src/features/images/api.ts@@ -826,6 +826,7 @@ export interface DiffusionTrainableFamily {supports_checkpoints?: boolean;// Absent on an older backend: "Sample every" hidden.supports_samples?: boolean;+ is_video?: boolean;// Undefined on an older backend (control hidden).supports_bucketing?: boolean;/** 1 for a family whose forward covers one packed sequence; null/absent means unrestricted. */diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsxindex eb873ef6827..3f1a27847bf 100644--- a/studio/frontend/src/features/images/images-page.tsx+++ b/studio/frontend/src/features/images/images-page.tsx@@ -124,7 +124,7 @@ import { MEDIA_RAIL_ROOT_ATTR, useMediaRailWidth } from "@/hooks/use-media-rail-import { StripDropLine } from "@/components/gallery-strip-reorder";import { useStripReorder } from "@/hooks/use-strip-reorder";import { MediaApiButton } from "@/components/media-api-button";-import { LibraryPageLink } from "@/components/media-page-link";+import { LibraryPageLink, SiblingMediaPageLink } from "@/components/media-page-link";import { translate, useT } from "@/i18n";import {chatAboutMedia,@@ -1765,6 +1765,9 @@ export function ImagesPage({);// Page mode: "create" is the generation workspace, "train" the LoRA training workspace.const pageMode = useImageWorkflowStore((s) => s.pageMode);+ // Mounted on first visit, then hidden rather than unmounted, so switching to Create keeps the training form.+ const [trainMounted, setTrainMounted] = useState(false);+ if (pageMode === "train" && !trainMounted) setTrainMounted(true);const setPageMode = useImageWorkflowStore((s) => s.setPageMode);const tourSteps = useMemo(() => buildImagesTourSteps({ pageMode }),@@ -3195,6 +3198,18 @@ export function ImagesPage({}}, [setStatusIfNewest]);+ // Starting a training run unloads the image model, so re-read it on the way back to Create.+ const leftForTrain = useRef(false);+ useEffect(() => {+ if (pageMode === "train") {+ leftForTrain.current = true;+ return;+ }+ if (!active || !leftForTrain.current) return;+ leftForTrain.current = false;+ void refreshStatus();+ }, [active, pageMode, refreshStatus]);+useEffect(() => {isMounted.current = true;return () => {@@ -4693,6 +4708,16 @@ export function ImagesPage({},[applyImageModelDefaults, busy, handleLoad, pickGuard, pickToast, quant, revertPick, setPageMode],);+ const deployFromVideo = useImageWorkflowStore((s) => s.pendingDeploy);+ useEffect(() => {+ if (!active || !deployFromVideo) return;+ const request = useImageWorkflowStore.getState().takeDeploy();+ if (request) handleDeployAdapter(request);+ }, [active, deployFromVideo, handleDeployAdapter]);+ const trainingCompletions = useImageWorkflowStore((s) => s.trainingCompletions);+ useEffect(() => {+ if (trainingCompletions > 0) setLoraRefreshKey((k) => k + 1);+ }, [trainingCompletions]);const handleUnload = useCallback(async (): Promise<boolean> => {pendingRecalledGeneration.current = null;@@ -5932,45 +5957,46 @@ export function ImagesPage({value={pageMode}onValueChange={(v) => setPageMode(v as "create" | "train")}fit={true}- className="h-[calc(34px*var(--ui-space-scale,1))] [&>button]:h-[calc(34px*var(--ui-space-scale,1))] [&>button]:px-3 @[68rem]:[&>button]:px-11 @max-[30rem]:[&>button]:px-2.5 @max-[30rem]:[&>button>[data-pill-tab-label]]:sr-only"+ className="h-[calc(34px*var(--ui-space-scale,1))] [&>button]:h-[calc(34px*var(--ui-space-scale,1))] [&>button]:px-7 @[68rem]:[&>button]:px-14 @max-[30rem]:[&>button]:px-2.5 @max-[30rem]:[&>button>[data-pill-tab-label]]:sr-only"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 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">+ {/* The chat header's right inset. */}+ <div className="pointer-events-none col-start-3 flex min-w-0 items-start justify-end pr-[calc(var(--thread-scrollbar-gutter,10px)+0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))] pt-[var(--studio-chat-header-padding-top,11px)]">+ <div className="pointer-events-auto flex min-w-0 items-center gap-1"><MediaApiButtonkind="images"model={status?.loaded ? (status.repo_id ?? null) : null}/>- <LibraryPageLink- tab="images"- labelClassName="hidden @[50rem]:inline"- arrowClassName="hidden @[50rem]:block"- />+ <LibraryPageLink tab="images" iconOnly={true} />+ <SiblingMediaPageLink to="/video" /></div></div></div></div>- {pageMode === "train" ? (- <DiffusionTrainPanel- active={active && pageMode === "train"}- loadedFamily={status?.family ?? null}- loadedBaseRepo={- // For a GGUF load repo_id is a checkpoint path, not a trainable base.- status?.base_repo ?? status?.repo_id ?? null- }- onTrainingComplete={() => setLoraRefreshKey((k) => k + 1)}- onDeploy={handleDeployAdapter}- familyName={trainFamilyName}- onFamilyNameChange={setTrainFamilyName}- baseChoice={trainBaseChoice}- onBaseChoiceChange={setTrainBaseChoice}- onFamiliesChange={setTrainFamilies}- />- ) : (+ {trainMounted && (+ <div className={pageMode === "train" ? "contents" : "hidden"} inert={pageMode !== "train" || undefined}>+ <DiffusionTrainPanel+ active={active && pageMode === "train"}+ loadedFamily={status?.family ?? null}+ loadedBaseRepo={+ // For a GGUF load repo_id is a checkpoint path, not a trainable base.+ status?.base_repo ?? status?.repo_id ?? null+ }+ onTrainingComplete={() => setLoraRefreshKey((k) => k + 1)}+ onDeploy={handleDeployAdapter}+ familyName={trainFamilyName}+ onFamilyNameChange={setTrainFamilyName}+ baseChoice={trainBaseChoice}+ onBaseChoiceChange={setTrainBaseChoice}+ onFamiliesChange={setTrainFamilies}+ />+ </div>+ )}+ {pageMode !== "train" && (/* Settings column + preview canvas. Structural borders stay edge-to-edge; spacing belongs inside each pane.The same 50rem page-container breakpoint drives this body and the header above. */<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">@@ -6950,7 +6976,7 @@ export function ImagesPage({disabled={busy !== null}onClick={handleReapply}>- <HugeiconsIcon icon={ReloadIcon} className="mr-2 size-4" />+ <HugeiconsIcon icon={ReloadIcon} className="size-4" />Reapply</Button></TooltipTrigger>diff --git a/studio/frontend/src/features/images/stores/image-workflow-store.ts b/studio/frontend/src/features/images/stores/image-workflow-store.tsindex 3803aaa59c0..4525ec7d18b 100644--- a/studio/frontend/src/features/images/stores/image-workflow-store.ts+++ b/studio/frontend/src/features/images/stores/image-workflow-store.ts@@ -4,6 +4,13 @@import { create } from "zustand";import type { WorkflowId } from "../workflows";+export interface AdapterDeployRequest {+ baseRepo: string;+ family: string;+ catalogPath: string;+ trigger: string;+}+/** `supported` null means nothing is loaded, so every workflow stays selectable. */interface ImageWorkflowState {workflow: WorkflowId;@@ -14,9 +21,15 @@ interface ImageWorkflowState {setWorkflow: (id: WorkflowId) => void;setPageMode: (mode: "create" | "train") => void;setSupported: (ids: WorkflowId[] | null) => void;+ /** Video's Train tab hands Images its adapters: Video loads none. */+ pendingDeploy: AdapterDeployRequest | null;+ requestDeploy: (request: AdapterDeployRequest) => void;+ takeDeploy: () => AdapterDeployRequest | null;+ trainingCompletions: number;+ noteTrainingComplete: () => void;}-export const useImageWorkflowStore = create<ImageWorkflowState>((set) => ({+export const useImageWorkflowStore = create<ImageWorkflowState>((set, get) => ({workflow: "create",pageMode: "create",supported: null,@@ -25,6 +38,16 @@ export const useImageWorkflowStore = create<ImageWorkflowState>((set) => ({setWorkflow: (workflow) => set({ workflow, pageMode: "create" }),setPageMode: (pageMode) => set({ pageMode }),setSupported: (supported) => set({ supported }),+ pendingDeploy: null,+ requestDeploy: (pendingDeploy) => set({ pendingDeploy }),+ takeDeploy: () => {+ const request = get().pendingDeploy;+ if (request) set({ pendingDeploy: null });+ return request;+ },+ trainingCompletions: 0,+ noteTrainingComplete: () =>+ set((s) => ({ trainingCompletions: s.trainingCompletions + 1 })),}));export function isWorkflowEnabled(diff --git a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx b/studio/frontend/src/features/images/train/diffusion-train-panel.tsxindex c93a30d19fa..09f75af520e 100644--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx@@ -1234,6 +1234,11 @@ export function DiffusionTrainPanel({},[info?.families],);+ // The images loader refuses video bases, so their adapters get no Deploy to Create.+ const isVideoFamily = useCallback(+ (famName: string) => info?.families?.find((f) => f.name === famName)?.is_video === true,+ [info?.families],+ );const navigate = useNavigate();const exportAdapter = useCallback(@@ -2060,7 +2065,7 @@ export function DiffusionTrainPanel({: ""}</p><div className="flex flex-wrap items-center gap-2">- {viewRun.saved && viewRun.catalog_path && (+ {viewRun.saved && viewRun.catalog_path && !isVideoFamily(viewRun.family || "") && (<Buttontype="button"size="sm"@@ -2291,7 +2296,7 @@ export function DiffusionTrainPanel({)}</p><div className="mt-1 flex flex-wrap gap-2">- {status?.catalog_path && (+ {status?.catalog_path && !isVideoFamily(status.family || family?.name || "") && (<Button type="button" size="sm" onClick={onDeployClick}>Deploy to Create</Button>diff --git a/studio/frontend/src/features/images/train/train-base-selector.tsx b/studio/frontend/src/features/images/train/train-base-selector.tsxindex c7f6978641c..ebe0a7f7c39 100644--- a/studio/frontend/src/features/images/train/train-base-selector.tsx+++ b/studio/frontend/src/features/images/train/train-base-selector.tsx@@ -39,17 +39,22 @@ export function TrainBaseSelector({return (<DropdownMenu><DropdownMenuTrigger asChild={true}>+ {/* Matches Create's picker, so the name stays put across tabs. */}<buttontype="button"aria-label="Training base model"- className="unsloth-model-selector-trigger flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 max-w-[calc(320px*var(--ui-space-scale,1))] items-center gap-2 rounded-full pl-4 pr-2 text-sm transition-colors hover:bg-accent"+ className="unsloth-model-selector-trigger flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-[10px] pl-3 pr-1 transition-colors hover:bg-nav-surface-hover @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2">- <span className="min-w-0 truncate font-medium">{label}</span>- {family && (- <span className="shrink-0 text-xs leading-none text-muted-foreground">- {family.label}+ <span className="flex min-w-0 flex-1 items-baseline">+ <span className="min-w-0 shrink-0 truncate whitespace-nowrap font-heading text-ui-14 font-medium leading-tight text-black dark:text-foreground @[68rem]:text-ui-16">+ {label}</span>- )}+ {family && (+ <span className="min-w-0 shrink-[1000] truncate text-xs leading-tight text-muted-foreground before:inline-block before:w-2 before:content-['']">+ {family.label}+ </span>+ )}+ </span><span className="-ml-1 flex size-4 shrink-0 items-center justify-center"><HugeiconsIconicon={ChevronDownStandardIcon}diff --git a/studio/frontend/src/features/library/library-page.tsx b/studio/frontend/src/features/library/library-page.tsxindex 2e4a8095ad5..57a3d0a3d09 100644--- a/studio/frontend/src/features/library/library-page.tsx+++ b/studio/frontend/src/features/library/library-page.tsx@@ -117,6 +117,7 @@ const EMPTY_COPY: Record<LibraryTab, EmptyCopy> = {};const EMPTY_LINKS = {+ images: ["/images", "library.empty.generateImage"],videos: ["/video", "library.empty.generateVideo"],audio: ["/audio", "library.empty.generateAudio"],models: ["/studio", "library.empty.trainModel"],@@ -825,11 +826,20 @@ function LibraryView({ search }: { search: LibrarySearch }) {}if (!(tab in EMPTY_LINKS)) return uploadButton;const [to, label] = EMPTY_LINKS[tab as keyof typeof EMPTY_LINKS];- return (+ const generate = (<Button variant="muted" className="rounded-full" onClick={() => void navigate({ to })}>{t(label)}</Button>);+ if (tab === "images" || tab === "videos") {+ return (+ <div className="flex flex-wrap items-center justify-center gap-2">+ {uploadButton}+ {generate}+ </div>+ );+ }+ return generate;}function renderFavorites() {diff --git a/studio/frontend/src/features/tour/components/guided-tour.tsx b/studio/frontend/src/features/tour/components/guided-tour.tsxindex 90f5fe10842..54698f21962 100644--- a/studio/frontend/src/features/tour/components/guided-tour.tsx+++ b/studio/frontend/src/features/tour/components/guided-tour.tsx@@ -99,17 +99,19 @@ export function GuidedTour({let raf = 0;let t = 0;- function findTarget(): HTMLElement | null {- const found = document.querySelector(sel);- if (!(found instanceof HTMLElement)) return null;- return found;- }-function isUsableTarget(candidate: HTMLElement): boolean {const r = candidate.getBoundingClientRect();return r.width >= 6 && r.height >= 6;}+ // First visible match: Images and Video share Train targets, and a hidden page stays mounted earlier in the DOM.+ function findTarget(): HTMLElement | null {+ const found = [...document.querySelectorAll(sel)].filter(+ (c): c is HTMLElement => c instanceof HTMLElement,+ );+ return found.find(isUsableTarget) ?? found[0] ?? null;+ }+function rectChanged(a: Rect | null, b: Rect): boolean {if (!a) return true;return (diff --git a/studio/frontend/src/features/video/tour/index.ts b/studio/frontend/src/features/video/tour/index.tsindex 5cc046172ab..0afbd62c298 100644--- a/studio/frontend/src/features/video/tour/index.ts+++ b/studio/frontend/src/features/video/tour/index.ts@@ -1,4 +1,4 @@// 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 { videoTourSteps } from "./steps";+export { buildVideoTourSteps } from "./steps";diff --git a/studio/frontend/src/features/video/tour/steps.tsx b/studio/frontend/src/features/video/tour/steps.tsxindex 87e1cc18787..17395ca6513 100644--- a/studio/frontend/src/features/video/tour/steps.tsx+++ b/studio/frontend/src/features/video/tour/steps.tsx@@ -1,9 +1,37 @@// 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 { buildImagesTourSteps } from "@/features/images/tour/steps";import type { TourStep } from "@/features/tour";-export const videoTourSteps: TourStep[] = [+const modeStep: TourStep = {+ id: "mode",+ target: "video-mode",+ title: "Create or Train",+ body: (+ <>+ Create generates videos. Train fine-tunes a diffusion LoRA with the same+ trainer as Images, and finished image LoRAs load in Images.+ </>+ ),+};++export function buildVideoTourSteps({+ pageMode,+}: {+ pageMode: "create" | "train";+}): TourStep[] {+ return pageMode === "train"+ ? [+ modeStep,+ ...buildImagesTourSteps({ pageMode: "train" }).filter(+ (step) => step.id !== "mode",+ ),+ ]+ : [modeStep, ...createSteps];+}++const createSteps: TourStep[] = [{id: "model",target: "video-model",diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsxindex 14bd6948dbb..f5505728106 100644--- a/studio/frontend/src/features/video/video-page.tsx+++ b/studio/frontend/src/features/video/video-page.tsx@@ -14,6 +14,7 @@ import {FlimSlateIcon,ImageCropIcon,InformationCircleIcon,+ SparklesIcon,} from "@hugeicons/core-free-icons";import { ReloadIcon } from "@/lib/reload-icon";import { Volume02Icon } from "@/lib/volume-icons";@@ -23,13 +24,21 @@ import { AdvancedDisclosure } from "@/components/advanced-disclosure";import { GalleryItemMenu, GalleryPinBadge } from "@/components/gallery-item-menu";import { MediaRailResizeHandle } from "@/components/media-rail-resize-handle";import { MediaViewer } from "@/components/media-viewer";-import { MessageCircleIcon } from "@/lib/hugeicons-derived";+import { MessageCircleIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";import { MEDIA_RAIL_ROOT_ATTR, useMediaRailWidth } from "@/hooks/use-media-rail-width";import { StripDropLine } from "@/components/gallery-strip-reorder";import { useStripReorder } from "@/hooks/use-strip-reorder";import { ImageDropzone } from "@/components/image-dropzone";import { MediaApiButton } from "@/components/media-api-button";-import { LibraryPageLink } from "@/components/media-page-link";+import { LibraryPageLink, SiblingMediaPageLink } from "@/components/media-page-link";+import { PillTabs } from "@/features/model-picker/components/model-selector/pill-tabs";+import { useImageWorkflowStore } from "@/features/images/stores/image-workflow-store";+// Images' trainer already covers the video families.+import { DiffusionTrainPanel } from "@/features/images/train/diffusion-train-panel";+import {+ TrainBaseSelector,+ type TrainFamilyOption,+} from "@/features/images/train/train-base-selector";import { translate, useT } from "@/i18n";import {chatAboutMedia,@@ -38,7 +47,7 @@ import {useRevealLabel,} from "@/features/library";import { GuidedTour, useGuidedTourController } from "@/features/tour";-import { videoTourSteps } from "./tour";+import { buildVideoTourSteps } from "./tour";import { useSettingsDialogStore } from "@/features/settings/stores/settings-dialog-store";import {applyPin,@@ -1145,10 +1154,19 @@ function VideoGenerator({const { familyOverride, setFamilyOverride, familySelect, opaqueKind, selectorModelId } = useFamilyOverride(status, status?.supported_families);// Controlled so the body-portaled selector force-closes when off-tab.const [selectorOpen, setSelectorOpen] = useState(false);+ const [pageMode, setPageMode] = useState<"create" | "train">("create");+ // Mounted on first visit, then hidden rather than unmounted, so switching to Create keeps the training form.+ const [trainMounted, setTrainMounted] = useState(false);+ if (pageMode === "train" && !trainMounted) setTrainMounted(true);+ const [trainFamilies, setTrainFamilies] = useState<TrainFamilyOption[]>([]);+ const [trainFamilyName, setTrainFamilyName] = useState("flux.1");+ const [trainBaseChoice, setTrainBaseChoice] = useState("");+ const navigateToImages = useNavigate();+ const tourSteps = useMemo(() => buildVideoTourSteps({ pageMode }), [pageMode]);const [pendingH3Load, setPendingH3Load] = useState<PendingH3Load | null>(null);const tour = useGuidedTourController({id: "video",- steps: videoTourSteps,+ steps: tourSteps,enabled: active,});const {@@ -2241,6 +2259,19 @@ function VideoGenerator({setQuant(null);}, [refreshStatus, dropResidentState]);+ // Starting a training run unloads the video model, so re-read it on the way back to Create. Status only:+ // dropResidentState would cancel the poll of a load still running from before the switch.+ const leftForTrain = useRef(false);+ useEffect(() => {+ if (pageMode === "train") {+ leftForTrain.current = true;+ return;+ }+ if (!active || !leftForTrain.current) return;+ leftForTrain.current = false;+ void refreshStatus();+ }, [active, pageMode, refreshStatus]);+// Track mount so a long generate stops issuing GPU work when the page is truly unmounted.useEffect(() => {isMounted.current = true;@@ -3751,6 +3782,17 @@ function VideoGenerator({>{/* min-w-0: without it a long resident model name pushes the Library link off a phone screen. */}<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)]">+ {pageMode === "train" ? (+ <TrainBaseSelector+ families={trainFamilies}+ familyName={trainFamilyName}+ base={trainBaseChoice}+ onSelect={(family, repo) => {+ setTrainFamilyName(family);+ setTrainBaseChoice(repo);+ }}+ />+ ) : (<ModelSelectortriggerDataTour="video-model"models={videoModels}@@ -3770,10 +3812,11 @@ function VideoGenerator({open={active && selectorOpen}onOpenChange={(o) => setSelectorOpen(active && o)}/>+ )}{/* The load's own cancel, beside the selector rather than inside it: the selector's eject needsa resident model, so it is hidden for exactly the span a first load runs. A real button,so it is keyboard reachable. Says "load", never "download": that Cancel stops another job. */}- {busy === "loading" && (+ {pageMode !== "train" && busy === "loading" && (<Tooltip><TooltipTrigger asChild={true}><Button@@ -3792,8 +3835,8 @@ function VideoGenerator({)}</div></div>- <div className="grid h-full min-w-0 grid-cols-[minmax(0,1fr)_auto] gap-2">- {status?.loaded && (+ <div className="grid h-full min-w-0 grid-cols-[1fr_auto_auto] gap-2 @[50rem]:grid-cols-[1fr_auto_1fr] @[50rem]:gap-0">+ {pageMode !== "train" && status?.loaded && (<div className="pointer-events-auto col-start-1 mt-[var(--studio-chat-header-padding-top,11px)] flex h-[var(--studio-chat-control-height,34px)] min-w-0 flex-wrap content-start gap-x-3 overflow-hidden pl-4 text-ui-11 leading-[var(--studio-chat-control-height,34px)]">{status.family && <StatusChip label="Family" value={status.family} />}{status.engine && <StatusChip label="Engine" value={status.engine} />}@@ -3804,24 +3847,56 @@ function VideoGenerator({{status.speed_mode && <StatusChip label="Speed" value={status.speed_mode} />}</div>)}- <div className="pointer-events-none col-start-2 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">+ <div className="pointer-events-auto col-start-2 row-start-1 justify-self-center pt-[var(--studio-chat-header-padding-top,11px)]">+ <PillTabs+ dataTour="video-mode"+ ariaLabel="Page mode"+ value={pageMode}+ onValueChange={(v) => setPageMode(v as "create" | "train")}+ fit={true}+ className="h-[calc(34px*var(--ui-space-scale,1))] [&>button]:h-[calc(34px*var(--ui-space-scale,1))] [&>button]:px-7 @[68rem]:[&>button]:px-14 @max-[30rem]:[&>button]:px-2.5 @max-[30rem]:[&>button>[data-pill-tab-label]]:sr-only"+ 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>+ {/* The chat header's right inset. */}+ <div className="pointer-events-none col-start-3 row-start-1 flex min-w-0 items-start justify-end pr-[calc(var(--thread-scrollbar-gutter,10px)+0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))] pt-[var(--studio-chat-header-padding-top,11px)]">+ <div className="pointer-events-auto flex min-w-0 items-center gap-1"><MediaApiButtonkind="video"model={status?.loaded ? (status.repo_id ?? null) : null}/>- <LibraryPageLink- tab="videos"- labelClassName="hidden @[50rem]:inline"- arrowClassName="hidden @[50rem]:block"- />+ <LibraryPageLink tab="videos" iconOnly={true} />+ <SiblingMediaPageLink to="/images" /></div></div></div></div>- {/* overflow-x-hidden: an unset overflow-x computes to auto beside overflow-y-auto, letting a- wide row pan the page sideways on a phone. */}+ {trainMounted && (+ <div className={pageMode === "train" ? "contents" : "hidden"} inert={pageMode !== "train" || undefined}>+ <DiffusionTrainPanel+ active={active && pageMode === "train"}+ loadedFamily={null}+ loadedBaseRepo={null}+ onTrainingComplete={() => useImageWorkflowStore.getState().noteTrainingComplete()}+ onDeploy={(args) => {+ useImageWorkflowStore.getState().requestDeploy(args);+ void navigateToImages({ to: "/images" });+ }}+ familyName={trainFamilyName}+ onFamilyNameChange={setTrainFamilyName}+ baseChoice={trainBaseChoice}+ onBaseChoiceChange={setTrainBaseChoice}+ onFamiliesChange={setTrainFamilies}+ />+ </div>+ )}+ {pageMode !== "train" && (+ /* overflow-x-hidden: an unset overflow-x computes to auto beside overflow-y-auto, letting a+ wide row pan the page sideways on a phone. */<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"><divdata-tour="video-settings"@@ -4425,7 +4500,7 @@ function VideoGenerator({disabled={busy !== null}onClick={handleReapply}>- <HugeiconsIcon icon={ReloadIcon} className="mr-2 size-4" />+ <HugeiconsIcon icon={ReloadIcon} className="size-4" />Reapply</Button></TooltipTrigger>@@ -4781,6 +4856,7 @@ function VideoGenerator({</div></div>+ )}{loadAnywayDialog}</div>);diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 98d7c8f49eb..48cfb2e8e81 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -4548,6 +4548,7 @@ export const ar = {modelsTitle: "لا توجد نماذج مضبوطة بعد",modelsDescription: "تظهر هنا النماذج التي تدربها أو تصدّرها في Unsloth.",createFolder: "إنشاء مجلد",+ generateImage: "إنشاء صورة",generateVideo: "إنشاء فيديو",generateAudio: "إنشاء صوت",trainModel: "تدريب نموذج",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 3af8420dd32..c0723e8a4fc 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -4623,6 +4623,7 @@ export const de = {modelsTitle: "Noch keine feinabgestimmten Modelle",modelsDescription: "Modelle, die Sie in Unsloth trainieren oder exportieren, erscheinen hier.",createFolder: "Ordner erstellen",+ generateImage: "Bild generieren",generateVideo: "Video generieren",generateAudio: "Audio generieren",trainModel: "Modell trainieren",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 723e5d97dd3..b4fd293640d 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -4616,6 +4616,7 @@ export const en = {modelsTitle: "No fine-tuned models yet",modelsDescription: "Models you train or export in Unsloth show up here.",createFolder: "Create folder",+ generateImage: "Generate an image",generateVideo: "Generate a video",generateAudio: "Generate audio",trainModel: "Train a model",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex b8fb294223d..a2a4b82a348 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -4622,6 +4622,7 @@ export const es = {modelsTitle: "Aún no hay modelos ajustados",modelsDescription: "Los modelos que entrenes o exportes en Unsloth aparecen aquí.",createFolder: "Crear carpeta",+ generateImage: "Generar una imagen",generateVideo: "Generar un vídeo",generateAudio: "Generar audio",trainModel: "Entrenar un modelo",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex d8af533e2a6..d003b900b44 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -4634,6 +4634,7 @@ export const fr = {modelsTitle: "Aucun modèle affiné pour l'instant",modelsDescription: "Les modèles que vous entraînez ou exportez dans Unsloth apparaissent ici.",createFolder: "Créer un dossier",+ generateImage: "Générer une image",generateVideo: "Générer une vidéo",generateAudio: "Générer de l'audio",trainModel: "Entraîner un modèle",diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.tsindex bc2d2234f27..bd1804d158a 100644--- a/studio/frontend/src/i18n/locales/he.ts+++ b/studio/frontend/src/i18n/locales/he.ts@@ -4689,6 +4689,7 @@ export const he = {modelsTitle: "אין עדיין מודלים מכווננים",modelsDescription: "מודלים שתאמן או תייצא ב-Unsloth יופיעו כאן.",createFolder: "צור תיקייה",+ generateImage: "יצירת תמונה",generateVideo: "צור סרטון",generateAudio: "צור אודיו",trainModel: "אמן מודל",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 590ea686c5e..beb66a31d56 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -4559,6 +4559,7 @@ export const hi = {modelsTitle: "अभी कोई फ़ाइन-ट्यून किया गया मॉडल नहीं",modelsDescription: "Unsloth में आप जो मॉडल ट्रेन या एक्सपोर्ट करते हैं, वे यहाँ दिखते हैं।",createFolder: "फ़ोल्डर बनाएँ",+ generateImage: "इमेज बनाएँ",generateVideo: "वीडियो जनरेट करें",generateAudio: "ऑडियो जनरेट करें",trainModel: "मॉडल ट्रेन करें",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 02ecd096755..995e597427d 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -4623,6 +4623,7 @@ export const it = {modelsTitle: "Ancora nessun modello con fine-tuning",modelsDescription: "I modelli che addestri o esporti in Unsloth compaiono qui.",createFolder: "Crea cartella",+ generateImage: "Genera un'immagine",generateVideo: "Genera un video",generateAudio: "Genera audio",trainModel: "Addestra un modello",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 8d2e1ba5608..306c81b526d 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -4498,6 +4498,7 @@ export const ja = {modelsTitle: "ファインチューニング済みモデルはまだありません",modelsDescription: "Unsloth でトレーニングまたはエクスポートしたモデルがここに表示されます。",createFolder: "フォルダを作成",+ generateImage: "画像を生成",generateVideo: "動画を生成",generateAudio: "音声を生成",trainModel: "モデルをトレーニング",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex 08f8f5ef38d..369a82553a8 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -4539,6 +4539,7 @@ export const ko = {modelsTitle: "아직 파인튜닝된 모델이 없습니다",modelsDescription: "Unsloth에서 학습하거나 내보낸 모델이 여기에 표시됩니다.",createFolder: "폴더 만들기",+ generateImage: "이미지 생성",generateVideo: "동영상 생성",generateAudio: "오디오 생성",trainModel: "모델 학습",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 2adc4395b92..0124f8c5d1c 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -4582,6 +4582,7 @@ export const ptBR = {modelsTitle: "Nenhum modelo ajustado ainda",modelsDescription: "Os modelos que você treina ou exporta no Unsloth aparecem aqui.",createFolder: "Criar pasta",+ generateImage: "Gerar uma imagem",generateVideo: "Gerar um vídeo",generateAudio: "Gerar áudio",trainModel: "Treinar um modelo",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex df06a0fdb84..88c555516eb 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -4580,6 +4580,7 @@ export const ru = {modelsTitle: "Дообученных моделей пока нет",modelsDescription: "Здесь появляются модели, которые вы обучаете или экспортируете в Unsloth.",createFolder: "Создать папку",+ generateImage: "Создать изображение",generateVideo: "Сгенерировать видео",generateAudio: "Сгенерировать аудио",trainModel: "Обучить модель",diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.tsindex 99f113018f1..72322840057 100644--- a/studio/frontend/src/i18n/locales/sv.ts+++ b/studio/frontend/src/i18n/locales/sv.ts@@ -4831,6 +4831,7 @@ export const sv = {modelsDescription:"Modeller som du tränar eller exporterar i Unsloth visas här.",createFolder: "Skapa mapp",+ generateImage: "Generera en bild",generateVideo: "Generera en video",generateAudio: "Generera ljud",trainModel: "Träna en modell",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex c18147428be..bc418bec9be 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -4450,6 +4450,7 @@ export const zhCN = {modelsTitle: "还没有微调模型",modelsDescription: "你在 Unsloth 中训练或导出的模型会显示在这里。",createFolder: "创建文件夹",+ generateImage: "生成图像",generateVideo: "生成视频",generateAudio: "生成音频",trainModel: "训练模型",diff --git a/studio/frontend/tests/media-header-links.test.ts b/studio/frontend/tests/media-header-links.test.tsnew file mode 100644index 00000000000..8522ce59f8e--- /dev/null+++ b/studio/frontend/tests/media-header-links.test.ts@@ -0,0 +1,108 @@+// 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 LINK = readSrc("components/media-page-link.tsx");+const API = readSrc("components/media-api-button.tsx");+const IMAGES = readSrc("features/images/images-page.tsx");+const VIDEO = readSrc("features/video/video-page.tsx");+const STORE = readSrc("features/images/stores/image-workflow-store.ts");++test("media header links are the chat header's icon buttons, without a divider", () => {+ assert.match(+ LINK,+ /export const HEADER_ICON_BUTTON =\s*"flex size-\[calc\(30px\*var\(--ui-space-scale,1\)\)\] shrink-0 cursor-pointer items-center justify-center rounded-\[10px\] text-nav-fg/,+ );+ const iconOnly = LINK.slice(+ LINK.indexOf("if (iconOnly) {"),+ LINK.indexOf(" return (\n <>"),+ );+ assert.match(iconOnly, /className=\{cn\(\s*HEADER_ICON_BUTTON,/);+ assert.match(iconOnly, /className="size-icon"/);+ assert.doesNotMatch(iconOnly, /w-px|labelClassName/);+ assert.match(API, /className=\{HEADER_ICON_BUTTON\}/);+ assert.doesNotMatch(API, /@\[84rem\]/);+});++test("API, Library, then the other media page with an arrow, at the chat header's inset", () => {+ assert.match(+ IMAGES,+ /<MediaApiButton\s+kind="images"[\s\S]{0,120}\/>\s*<LibraryPageLink tab="images" iconOnly=\{true\} \/>\s*<SiblingMediaPageLink to="\/video" \/>/,+ );+ assert.match(+ VIDEO,+ /<MediaApiButton\s+kind="video"[\s\S]{0,120}\/>\s*<LibraryPageLink tab="videos" iconOnly=\{true\} \/>\s*<SiblingMediaPageLink to="\/images" \/>/,+ );+ assert.match(+ LINK,+ /icon=\{to === "\/images" \? Image03Icon : FlimSlateIcon\}/,+ );+});++test("Video has Create and Train, Train being Images' trainer", () => {+ assert.match(VIDEO, /dataTour="video-mode"/);+ assert.match(VIDEO, /\{ value: "train", label: "Train"/);+ assert.match(VIDEO, /\{trainMounted && \(\s*<div className=\{pageMode === "train" \? "contents" : "hidden"\}[^>]*>\s*<DiffusionTrainPanel/);+ assert.match(VIDEO, /\{pageMode === "train" \? \(\s*<TrainBaseSelector/);+ assert.match(+ VIDEO,+ /useImageWorkflowStore\.getState\(\)\.requestDeploy\(args\);\s*void navigateToImages\(\{ to: "\/images" \}\);/,+ );+ assert.match(+ IMAGES,+ /const request = useImageWorkflowStore\.getState\(\)\.takeDeploy\(\);\s*if \(request\) handleDeployAdapter\(request\);/,+ );+ assert.match(+ IMAGES,+ /if \(trainingCompletions > 0\) setLoraRefreshKey\(\(k\) => k \+ 1\);/,+ );+ assert.match(+ STORE,+ /takeDeploy: \(\) => \{\s*const request = get\(\)\.pendingDeploy;\s*if \(request\) set\(\{ pendingDeploy: null \}\);/,+ );+});++test("the sibling link keeps its icon where the square button puts it and trails an arrow", () => {+ assert.match(+ LINK,+ /iconArrow &&\s*"w-auto gap-1\.5 pr-2 pl-\[calc\(\(30px\*var\(--ui-space-scale,1\)-var\(--icon-size\)\)\/2\)\]"/,+ );+ assert.match(+ LINK,+ /\{iconArrow && \(\s*<>[\s\S]{0,200}<span className="hidden min-w-0 truncate text-ui-13 font-medium @\[50rem\]:inline">\s*\{label\}\s*<\/span>\s*<ArrowRightIcon className="size-3\.5 shrink-0 opacity-60" \/>/,+ );+ for (const page of [IMAGES, VIDEO]) {+ assert.match(+ page,+ /justify-end pr-\[calc\(var\(--thread-scrollbar-gutter,10px\)\+0\.5rem\*var\(--ui-space-scale,1\)\+var\(--studio-chat-header-right-inset,var\(--studio-window-control-inset,0px\)\)\)\]/,+ );+ }+});++test("Library's empty Images and Videos offer Upload and Generate", () => {+ const library = readSrc("features/library/library-page.tsx");+ assert.match(+ library,+ /images: \["\/images", "library\.empty\.generateImage"\]/,+ );+ assert.match(+ library,+ /if \(tab === "images" \|\| tab === "videos"\) \{[\s\S]{0,200}\{uploadButton\}\s*\{generate\}/,+ );+});++test("Create and Train get roomy tabs on Images and Video", () => {+ for (const page of [IMAGES, VIDEO]) {+ assert.match(page, /\[&>button\]:px-7 @\[68rem\]:\[&>button\]:px-14/);+ }+});++test("Reapply's icon sits at the button's own gap", () => {+ for (const page of [IMAGES, VIDEO]) {+ assert.match(page, /<HugeiconsIcon icon=\{ReloadIcon\} className="size-4" \/>\s*Reapply/);+ }+});diff --git a/studio/frontend/tests/video-train-deploy-tour.test.ts b/studio/frontend/tests/video-train-deploy-tour.test.tsnew file mode 100644index 00000000000..cf7e03e261f--- /dev/null+++ b/studio/frontend/tests/video-train-deploy-tour.test.ts@@ -0,0 +1,56 @@+// 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("video-family adapters get no Deploy to Create", () => {+ const src = readSrc("features/images/train/diffusion-train-panel.tsx");+ assert.match(src, /\?\.is_video === true/);+ assert.match(+ src,+ /viewRun\.catalog_path && !isVideoFamily\(viewRun\.family \|\| ""\) && \(\s*<Button[\s\S]{0,400}onDeploy\?\.\(/,+ );+ assert.match(+ src,+ /status\?\.catalog_path && !isVideoFamily\(status\.family \|\| family\?\.name \|\| ""\) && \(\s*<Button type="button" size="sm" onClick=\{onDeployClick\}>/,+ );+ assert.match(readSrc("features/images/api.ts"), /is_video\?: boolean;/);+});++test("the tour attaches to the first visible target, not a hidden page's", () => {+ const src = readSrc("features/tour/components/guided-tour.tsx");+ assert.match(src, /document\.querySelectorAll\(sel\)/);+ assert.match(src, /found\.find\(isUsableTarget\) \?\? found\[0\] \?\? null/);+ assert.doesNotMatch(src, /document\.querySelector\(sel\)/);+});++test("Video re-reads its model status when returning from Train to Create", () => {+ const src = readSrc("features/video/video-page.tsx");+ assert.match(+ src,+ /if \(pageMode === "train"\) \{\s*leftForTrain\.current = true;\s*return;\s*\}\s*if \(!active \|\| !leftForTrain\.current\) return;\s*leftForTrain\.current = false;\s*void refreshStatus\(\);\s*\}, \[active, pageMode, refreshStatus\]\);/,+ );+});++test("Images re-reads its model status when returning from Train to Create", () => {+ const src = readSrc("features/images/images-page.tsx");+ assert.match(+ src,+ /if \(pageMode === "train"\) \{\s*leftForTrain\.current = true;\s*return;\s*\}\s*if \(!active \|\| !leftForTrain\.current\) return;\s*leftForTrain\.current = false;\s*void refreshStatus\(\);\s*\}, \[active, pageMode, refreshStatus\]\);/,+ );+});++for (const page of ["features/images/images-page.tsx", "features/video/video-page.tsx"]) {+ test(`${page} hides the Train panel instead of unmounting it`, () => {+ const src = readSrc(page);+ assert.match(src, /if \(pageMode === "train" && !trainMounted\) setTrainMounted\(true\);/);+ assert.match(+ src,+ /\{trainMounted && \(\s*<div className=\{pageMode === "train" \? "contents" : "hidden"\} inert=\{pageMode !== "train" \|\| undefined\}>\s*<DiffusionTrainPanel/,+ );+ assert.match(src, /\/>\s*<\/div>\s*\)\}\s*\{pageMode !== "train" && \(/);+ assert.doesNotMatch(src, /\{pageMode === "train" \? \(\s*<DiffusionTrainPanel/);+ });+}