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: keep the prompt upsampler client out of the startup chunks, reset the startup budget to the build (#14168)
Daniel Han69dbf9e1cc58
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.tsindex 80cc57172cf..0ce288b8425 100644--- a/studio/frontend/scripts/check-bundle-budget.ts+++ b/studio/frontend/scripts/check-bundle-budget.ts@@ -229,8 +229,19 @@ export const BUDGET = {// (6,809,493 -> 6,809,821 B raw, 2,049,157 -> 2,049,294 B transfer against a6da154b3, one machine and build,// Node 24, chunk count unchanged at 95): the matcher runs on every keydown from the first screen, so there is// no separate module to lazy-load. Raised by that growth.- transferBytes: 2_051_727,- rawBytes: 6_819_206,+ // Main was still over after those raises (2fee36ffa3: 6,825,378 B raw / 2,053,999 B transfer against 6,818,878 /+ // 2,051,590): each was sized from its PR's own delta on top of a limit that already sat below the build, so the+ // shortfall carried forward (it starts at #14073, whose limit was 92 B of transfer under its own build). Moving the+ // FLUX.3 prompt upsampler client (#14137) out of images/api.ts, which startup chunks import, saves 4,372 B raw /+ // 1,291 B transfer. With #14113 on top that leaves 6,821,334 B raw / 2,052,857 B transfer (78e5eefa4d plus this+ // change). Three more PRs landed while main was over, without raising the limit: the darker picker toggle (#14183,+ // +76 B raw / -243 B transfer), one tooltip design everywhere (#14172, +3,897 B raw / +1,376 B transfer: the shared+ // tooltip is in the eager shell) and pinning FLUX.3 Klein in the Images picker (#14184, +418 B raw / +82 B+ // transfer). That gives 6,825,725 B raw / 2,054,072 B transfer at b227654927 plus this change (one machine and+ // build, Node 24, chunk count unchanged at 95; CI has matched this machine to the byte). Both limits are reset to+ // that build plus a 160 B raw / 189 B transfer margin, measured absolutely rather than by delta.+ transferBytes: 2_054_261,+ rawBytes: 6_825_885,};// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering thediff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.tsindex 329d4f7fdc0..170d0836bba 100644--- a/studio/frontend/src/features/images/api.ts+++ b/studio/frontend/src/features/images/api.ts@@ -10,13 +10,7 @@ import {MEMORY_REFUSAL_HEADER,MemoryEstimateRefusalError,} from "./lib/memory-refusal";-import {- parsePromptUpsamplerStatus,- PROMPT_UPSAMPLER_ROUTES,- type PromptEnhancement,- type PromptUpsamplerPreviewRequest,- type PromptUpsamplerStatus,-} from "./lib/prompt-enhance";+import type { PromptEnhancement } from "./lib/prompt-enhance";// One Advanced control's resolved value and provenance, for the Advanced-panel badges. `value` is the engaged// value (null when off), `requested` is what the caller asked for (null = left to the backend), `source` is "auto"@@ -522,43 +516,6 @@ export async function unloadDiffusionModel(): Promise<DiffusionStatus> {return parseJson(await authFetch("/api/inference/images/unload", { method: "POST" }));}-export async function getPromptUpsamplerStatus(signal?: AbortSignal): Promise<PromptUpsamplerStatus> {- return parsePromptUpsamplerStatus(- await parseJson<unknown>(await authFetch(PROMPT_UPSAMPLER_ROUTES.status, { signal })),- );-}--/** Start the background download of the prompt upsampler. Progress is read back from the status route. */-export async function startPromptUpsamplerDownload(hfToken?: string): Promise<void> {- await parseJson<unknown>(- await authFetch(PROMPT_UPSAMPLER_ROUTES.download, {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify(hfToken ? { hf_token: hfToken } : {}),- }),- );-}--/** Stop the download. Partial files stay cached, so a later download resumes. */-export async function cancelPromptUpsamplerDownload(): Promise<void> {- await parseJson<unknown>(- await authFetch(PROMPT_UPSAMPLER_ROUTES.cancel, { method: "POST" }),- );-}--/** Rewrite a prompt without generating, so the caption can be read or edited first. */-export async function previewEnhancedPrompt(- body: PromptUpsamplerPreviewRequest,-): Promise<{ enhanced_prompt: string }> {- return parseJson(- await authFetch(PROMPT_UPSAMPLER_ROUTES.preview, {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify(body),- }),- );-}-/** List diffusion LoRA adapters, optionally filtered to a model family. */export async function listDiffusionLoras(family?: string): Promise<DiffusionLoraInfo[]> {const qs = family ? `?family=${encodeURIComponent(family)}` : "";diff --git a/studio/frontend/src/features/images/prompt-enhance-panel.tsx b/studio/frontend/src/features/images/prompt-enhance-panel.tsxindex b41b3256487..51c812a3a62 100644--- a/studio/frontend/src/features/images/prompt-enhance-panel.tsx+++ b/studio/frontend/src/features/images/prompt-enhance-panel.tsx@@ -22,7 +22,7 @@ import {getPromptUpsamplerStatus,previewEnhancedPrompt,startPromptUpsamplerDownload,-} from "./api";+} from "./prompt-upsampler-api";import {ENHANCE_PROMPT_HINT,ENHANCE_PROMPT_LABEL,diff --git a/studio/frontend/src/features/images/prompt-upsampler-api.ts b/studio/frontend/src/features/images/prompt-upsampler-api.tsnew file mode 100644index 00000000000..4ec9f6bb09a--- /dev/null+++ b/studio/frontend/src/features/images/prompt-upsampler-api.ts@@ -0,0 +1,59 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// The prompt upsampler's routes, kept out of api.ts: startup screens import api.ts (loaded models, hub+// companion bytes), and only the lazily loaded Images page uses these, so they stay out of the startup chunks.++import { authFetch } from "@/features/auth";+import { readFastApiError } from "@/lib/format-fastapi-error";++import {+ parsePromptUpsamplerStatus,+ PROMPT_UPSAMPLER_ROUTES,+ type PromptUpsamplerPreviewRequest,+ type PromptUpsamplerStatus,+} from "./lib/prompt-enhance";++async function parseJson<T>(response: Response): Promise<T> {+ if (!response.ok) {+ throw new Error(await readFastApiError(response));+ }+ return (await response.json()) as T;+}++export async function getPromptUpsamplerStatus(signal?: AbortSignal): Promise<PromptUpsamplerStatus> {+ return parsePromptUpsamplerStatus(+ await parseJson<unknown>(await authFetch(PROMPT_UPSAMPLER_ROUTES.status, { signal })),+ );+}++/** Start the background download of the prompt upsampler. Progress is read back from the status route. */+export async function startPromptUpsamplerDownload(hfToken?: string): Promise<void> {+ await parseJson<unknown>(+ await authFetch(PROMPT_UPSAMPLER_ROUTES.download, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(hfToken ? { hf_token: hfToken } : {}),+ }),+ );+}++/** Stop the download. Partial files stay cached, so a later download resumes. */+export async function cancelPromptUpsamplerDownload(): Promise<void> {+ await parseJson<unknown>(+ await authFetch(PROMPT_UPSAMPLER_ROUTES.cancel, { method: "POST" }),+ );+}++/** Rewrite a prompt without generating, so the caption can be read or edited first. */+export async function previewEnhancedPrompt(+ body: PromptUpsamplerPreviewRequest,+): Promise<{ enhanced_prompt: string }> {+ return parseJson(+ await authFetch(PROMPT_UPSAMPLER_ROUTES.preview, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(body),+ }),+ );+}