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: show example prompts as placeholder hints (#11931)
Michael Hane5fcd4cb71a4
diff --git a/studio/frontend/src/features/audio/audio-page.tsx b/studio/frontend/src/features/audio/audio-page.tsxindex 0755d41a0c7..d696807dd90 100644--- a/studio/frontend/src/features/audio/audio-page.tsx+++ b/studio/frontend/src/features/audio/audio-page.tsx@@ -314,7 +314,7 @@ export function AudioPage({const [status, setStatus] = useState<InferenceStatusResponse | null>(null);// Starts from the last text generated with.- const [prompt, setPrompt] = useState(() => readLastPrompt("audio", ""));+ const [prompt, setPrompt] = useState(() => readLastPrompt("audio"));const [audioInstructions, setAudioInstructions] = useState("");const [audioLanguage, setAudioLanguage] = useState("");const [temperature, setTemperature] = useState(0.6);diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsxindex 9250b336b69..665c84a0e38 100644--- a/studio/frontend/src/features/images/images-page.tsx+++ b/studio/frontend/src/features/images/images-page.tsx@@ -106,7 +106,12 @@ import {sortGalleryItems,subscribeGalleryChanged,} from "@/lib/gallery-flags";-import { readLastPrompt, saveLastPrompt } from "@/lib/last-prompt";+import {+ dismissExample,+ isExampleDismissed,+ readLastPrompt,+ saveLastPrompt,+} from "@/lib/last-prompt";import { usePersistedToggle } from "@/hooks/use-persisted-toggle";import { useImageWorkflowStore } from "./stores/image-workflow-store";import { WORKFLOW_EXAMPLE_PROMPTS, WORKFLOW_TABS, type WorkflowId } from "./workflows";@@ -1247,15 +1252,18 @@ export function ImagesPage({const imageModels = useImageModels(hostClass, denseQuantSchemes);const { rootStyle: railRootStyle } = useMediaRailWidth("images");const [quant, setQuant] = useState<string | null>(galleryCache.quant);- // One prompt per workflow: each starts from its example, then the last one generated with.+ // One prompt per workflow, starting from the last one generated with.const [prompts, setPrompts] = useState<Record<WorkflowId, string>>(() =>Object.fromEntries(- WORKFLOW_TABS.map(({ id }) => [- id,- readLastPrompt(`images:${id}`, WORKFLOW_EXAMPLE_PROMPTS[id]),- ]),+ WORKFLOW_TABS.map(({ id }) => [id, readLastPrompt(`images:${id}`)]),) as Record<WorkflowId, string>,);+ // Workflows whose example hint is gone: it shows as a placeholder until the box is first focused.+ const [examplesDismissed, setExamplesDismissed] = useState<Record<WorkflowId, boolean>>(() =>+ Object.fromEntries(+ WORKFLOW_TABS.map(({ id }) => [id, isExampleDismissed(`images:${id}`)]),+ ) as Record<WorkflowId, boolean>,+ );const setPromptFor = useCallback((id: WorkflowId, next: SetStateAction<string>) => {setPrompts((prev) => ({...prev,@@ -4981,9 +4989,14 @@ export function ImagesPage({<Textarearows={4}placeholder={- workflow === "edit" ? "Describe the edit, e.g. make the sky sunset orange" : undefined+ examplesDismissed[workflow] ? undefined : WORKFLOW_EXAMPLE_PROMPTS[workflow]}value={prompt}+ onFocus={() => {+ if (examplesDismissed[workflow]) return;+ dismissExample(`images:${workflow}`);+ setExamplesDismissed((prev) => ({ ...prev, [workflow]: true }));+ }}onChange={(e) => setPrompt(e.target.value)}/></Field>diff --git a/studio/frontend/src/features/images/workflows.ts b/studio/frontend/src/features/images/workflows.tsindex 5eac5957c2f..6528bc84243 100644--- a/studio/frontend/src/features/images/workflows.ts+++ b/studio/frontend/src/features/images/workflows.ts@@ -86,7 +86,7 @@ export const WORKFLOW_TABS: Array<{},];-/** Starter prompt per workflow, showing what each one is for. */+/** Placeholder hint per workflow, showing what each one is for. */export const WORKFLOW_EXAMPLE_PROMPTS: Record<WorkflowId, string> = {create:"A cozy wooden cabin on a snowy mountain at dusk, warm light glowing from the windows, pine trees and gently falling snow. Cinematic photo, soft golden light.",diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsxindex 748983e85cf..0142fd85c32 100644--- a/studio/frontend/src/features/video/video-page.tsx+++ b/studio/frontend/src/features/video/video-page.tsx@@ -38,7 +38,13 @@ import {sortGalleryItems,subscribeGalleryChanged,} from "@/lib/gallery-flags";-import { readLastPrompt, saveLastPrompt } from "@/lib/last-prompt";+import {+ dismissExample,+ isExampleDismissed,+ readLastPrompt,+ saveLastPrompt,+} from "@/lib/last-prompt";+import { useDiffusionGpuChoices } from "@/hooks/use-gpu-info";import { useHardwareInfo } from "@/hooks/use-hardware-info";import { usePersistedToggle } from "@/hooks/use-persisted-toggle";@@ -193,6 +199,10 @@ import {} from "./api";import { videoThumbnailQueue, withThumbnailRetries } from "./thumbnail-request-queue";+/** Placeholder hint until the prompt box is first focused. */+const VIDEO_EXAMPLE_PROMPT =+ "A slow cinematic shot down a quiet Kyoto street at sunrise, cherry blossom petals drifting in the air, a shopkeeper opening a wooden storefront, warm natural light.";+// Curated models come from the shared catalog, one group per model with a format second level,// which also surfaces LTX-2.3 in Recommended since its HF pipeline_tag is image-to-video.// Host-dependent: a Mac gets only GGUF rows. The load kind per artifact comes from loadSpecFor.@@ -908,13 +918,9 @@ function VideoGenerator({const denseQuantSchemes = useDenseQuantSchemes();const videoModels = useVideoModels(hostClass, denseQuantSchemes);const [quant, setQuant] = useState<string | null>(galleryCache.quant);- // Starts from the last prompt generated with, else a short example.- const [prompt, setPrompt] = useState(() =>- readLastPrompt(- "video",- "A slow cinematic shot down a quiet Kyoto street at sunrise, cherry blossom petals drifting in the air, a shopkeeper opening a wooden storefront, warm natural light.",- ),- );+ // Starts from the last prompt generated with; the example is only a placeholder.+ const [prompt, setPrompt] = useState(() => readLastPrompt("video"));+ const [exampleDismissed, setExampleDismissed] = useState(() => isExampleDismissed("video"));const [negativePrompt, setNegativePrompt] = useState("");const [negativeOpen, setNegativeOpen] = useState(false);const [steps, setSteps] = useState(DEFAULT_GEN.steps);@@ -3694,7 +3700,13 @@ function VideoGenerator({<Field label="Prompt"><Textarearows={4}+ placeholder={exampleDismissed ? undefined : VIDEO_EXAMPLE_PROMPT}value={prompt}+ onFocus={() => {+ if (exampleDismissed) return;+ dismissExample("video");+ setExampleDismissed(true);+ }}onChange={(e) => setPrompt(e.target.value)}/></Field>diff --git a/studio/frontend/src/lib/last-prompt.ts b/studio/frontend/src/lib/last-prompt.tsindex 9d25e4707b1..902a05e2e8f 100644--- a/studio/frontend/src/lib/last-prompt.ts+++ b/studio/frontend/src/lib/last-prompt.ts@@ -2,17 +2,18 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0/**- * The last prompt a media page generated with, kept across reloads. Storage failures fall back to- * the page's example, so the box is never left without one.+ * Prompt boxes on the media pages: the last prompt generated with, kept across reloads, and whether+ * the box's example hint was dismissed. Storage failures read as nothing saved.*/-// An "unsloth" key, so another account signing in clears it (transitionBrowserAccount).+// "unsloth" keys, so another account signing in clears them (transitionBrowserAccount).const PREFIX = "unsloth_last_prompt:";+const DISMISSED_PREFIX = "unsloth_example_prompt_dismissed:";-export function readLastPrompt(key: string, fallback: string): string {+export function readLastPrompt(key: string): string {try {- return localStorage.getItem(PREFIX + key) ?? fallback;+ return localStorage.getItem(PREFIX + key) ?? "";} catch {- return fallback;+ return "";}}@@ -23,3 +24,21 @@ export function saveLastPrompt(key: string, prompt: string): void {// storage unavailable}}++/** Whether the box's example placeholder is gone for good. */+export function isExampleDismissed(key: string): boolean {+ try {+ return localStorage.getItem(DISMISSED_PREFIX + key) !== null;+ } catch {+ return false;+ }+}++/** Called when the box is first focused, so the example hint does not come back. */+export function dismissExample(key: string): void {+ try {+ localStorage.setItem(DISMISSED_PREFIX + key, "1");+ } catch {+ // storage unavailable+ }+}diff --git a/studio/frontend/tests/last-prompt.test.ts b/studio/frontend/tests/last-prompt.test.tsindex f770fbdaff8..be64f081f46 100644--- a/studio/frontend/tests/last-prompt.test.ts+++ b/studio/frontend/tests/last-prompt.test.ts@@ -8,7 +8,12 @@ import {BROWSER_ACCOUNT_KEY,transitionBrowserAccount,} from "../src/lib/account-transition.ts";-import { readLastPrompt, saveLastPrompt } from "../src/lib/last-prompt.ts";+import {+ dismissExample,+ isExampleDismissed,+ readLastPrompt,+ saveLastPrompt,+} from "../src/lib/last-prompt.ts";import { WORKFLOW_EXAMPLE_PROMPTS, WORKFLOW_TABS } from "../src/features/images/workflows.ts";function withStorage(storage: unknown, run: () => void) {@@ -22,22 +27,33 @@ function withStorage(storage: unknown, run: () => void) {}}-test("the last prompt survives a reload and falls back to the example", () => {+function memoryStorage() {const store = new Map<string, string>();- const storage = {+ return {getItem: (k: string) => store.get(k) ?? null,setItem: (k: string, v: string) => void store.set(k, v),};- withStorage(storage, () => {- assert.equal(readLastPrompt("images:edit", "example"), "example");+}++test("the last prompt survives a reload, per page and workflow", () => {+ withStorage(memoryStorage(), () => {+ assert.equal(readLastPrompt("images:edit"), "");saveLastPrompt("images:edit", "make it blue");- assert.equal(readLastPrompt("images:edit", "example"), "make it blue");- // Keys are separate per page and workflow.- assert.equal(readLastPrompt("images:create", "example"), "example");+ assert.equal(readLastPrompt("images:edit"), "make it blue");+ assert.equal(readLastPrompt("images:create"), "");+ });+});++test("an example hint dismissed once stays dismissed for that box", () => {+ withStorage(memoryStorage(), () => {+ assert.equal(isExampleDismissed("images:edit"), false);+ dismissExample("images:edit");+ assert.equal(isExampleDismissed("images:edit"), true);+ assert.equal(isExampleDismissed("images:create"), false);});});-test("unavailable storage still yields the example", () => {+test("unavailable storage reads as nothing saved and the hint shown", () => {const broken = {getItem: () => {throw new Error("denied");@@ -48,7 +64,9 @@ test("unavailable storage still yields the example", () => {};withStorage(broken, () => {saveLastPrompt("video", "x");- assert.equal(readLastPrompt("video", "example"), "example");+ dismissExample("video");+ assert.equal(readLastPrompt("video"), "");+ assert.equal(isExampleDismissed("video"), false);});});@@ -89,10 +107,14 @@ function accountBrowser(account: string) {test("another account signing in does not see the previous account's prompts", async () => {const { browser, localStorage } = accountBrowser("alice");- withStorage(localStorage, () => saveLastPrompt("images:create", "alice's prompt"));+ withStorage(localStorage, () => {+ saveLastPrompt("images:create", "alice's prompt");+ dismissExample("images:create");+ });await transitionBrowserAccount("bob", "/images", () => {}, browser);withStorage(localStorage, () => {- assert.equal(readLastPrompt("images:create", "example"), "example");+ assert.equal(readLastPrompt("images:create"), "");+ assert.equal(isExampleDismissed("images:create"), false);});});@@ -101,7 +123,7 @@ test("the same account signing in again keeps its prompts", async () => {withStorage(localStorage, () => saveLastPrompt("video", "alice's clip"));await transitionBrowserAccount("alice", "/video", () => {}, browser);withStorage(localStorage, () => {- assert.equal(readLastPrompt("video", "example"), "alice's clip");+ assert.equal(readLastPrompt("video"), "alice's clip");});});