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.

Studio: store the full build and workflow in each image recipe and show them in the Recipe popover (#12091)

Sourav Rajvi16c11290682a
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.py
index 63961bcf64e..a51c19b2d16 100644
--- a/studio/backend/core/inference/diffusion.py
+++ b/studio/backend/core/inference/diffusion.py
@@ -9242,6 +9242,11 @@ class DiffusionBackend:
"text_encoder_quant": state.text_encoder_quant,
"memory_mode": state.memory_mode,
"offload_policy": state.offload_policy,
+ # Read after the deferred speed / step-cache toggles, so this is what ran.
+ "speed_mode": state.speed_mode,
+ "attention_backend": state.attention_backend,
+ "transformer_cache": state.transformer_cache,
+ "cpu_offload": state.cpu_offload,
# Adapters baked in at LOAD time: disabling them at generate time is not the same build, so they
# belong to the build record.
"baked_loras": _baked_lora_names(state.pipe),
diff --git a/studio/backend/core/inference/image_gallery.py b/studio/backend/core/inference/image_gallery.py
index e9fe920365d..9b53a99e243 100644
--- a/studio/backend/core/inference/image_gallery.py
+++ b/studio/backend/core/inference/image_gallery.py
@@ -31,6 +31,8 @@ logger = get_logger(__name__)
# PNG text-chunk key holding our structured recipe JSON.
_META_KEY = "unsloth"
+# Absent on PNGs written before it existed.
+RECIPE_SCHEMA_VERSION = 1
# Image ids are file stems; restrict to safe chars so a crafted id can't escape the directory.
_ID_RE = re.compile(r"^[A-Za-z0-9_-]{1,128}$")
@@ -85,6 +87,7 @@ def _png_bytes(image: Any, meta: dict[str, Any]) -> bytes:
def save(image: Any, meta: dict[str, Any]) -> dict[str, Any]:
"""Persist a PIL image with its recipe embedded; return the gallery record."""
image_id = uuid.uuid4().hex
+ meta = {**meta, "schema_version": RECIPE_SCHEMA_VERSION}
# Encoded before the folder is looked up: a Settings move during the encode would otherwise
# finish first, and the image land in the folder it left.
data = _png_bytes(image, meta)
diff --git a/studio/backend/core/inference/sd_cpp_backend.py b/studio/backend/core/inference/sd_cpp_backend.py
index b25261c2204..df958248c36 100644
--- a/studio/backend/core/inference/sd_cpp_backend.py
+++ b/studio/backend/core/inference/sd_cpp_backend.py
@@ -3755,6 +3755,8 @@ class SdCppDiffusionBackend:
"offload_policy": (
"active" if without_device_backend_flags(state.offload_flags) else "none"
),
+ "speed_mode": state.native_speed,
+ "cpu_offload": bool(without_device_backend_flags(state.offload_flags)),
"workflow": workflow if conditioned else "txt2img",
"reference_resolution": None,
"localized_edit": getattr(localized_edit, "mode", None)
diff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.py
index 5fec97e9831..db9d28d5d2d 100644
--- a/studio/backend/models/inference.py
+++ b/studio/backend/models/inference.py
@@ -4339,11 +4339,12 @@ class DiffusionGenerateRequest(BaseModel):
"after init_image and in this order. The loaded family bounds the total including "
"init_image (FLUX.2: 4, Qwen-Image-2.1: 10); more is refused, never truncated.",
)
- workflow: Optional[Literal["edit", "reference"]] = Field(
+ workflow: Optional[Literal["edit", "reference", "outpaint"]] = Field(
None,
description = "Explicit image-conditioned workflow. edit: follow the prompt as an "
"instruction over init_image (and reference_images); reference: generate a new image "
- "guided by them. Omitted keeps the workflow implied by the other fields.",
+ "guided by them; outpaint: runs as inpaint over the padded init_image + mask_image and "
+ "is recorded as outpaint. Omitted keeps the workflow implied by the other fields.",
)
reference_resolution: Optional[int] = Field(
None,
@@ -4478,6 +4479,30 @@ class GalleryImage(BaseModel):
description = "Offload policy actually engaged: none | group | model | sequential. Part of "
"the build: an offloaded pipeline declines the torchao text-encoder modes.",
)
+ speed_mode: Optional[str] = Field(
+ None,
+ description = "Speed profile engaged for this generation (eager | default | max | off), after "
+ "any deferred compile. Absent on records written before this existed.",
+ )
+ attention_backend: Optional[str] = Field(
+ None,
+ description = "Attention backend engaged for this generation, or null for default SDPA. "
+ "Absent on records written before this existed.",
+ )
+ transformer_cache: Optional[str] = Field(
+ None,
+ description = "Step cache engaged for this generation (fbcache | static), or null when off. "
+ "Absent on records written before this existed.",
+ )
+ cpu_offload: Optional[bool] = Field(
+ None,
+ description = "Whether CPU offload was active for this generation. Absent on records written "
+ "before this existed.",
+ )
+ schema_version: Optional[int] = Field(
+ None,
+ description = "Recipe format version embedded in the PNG unsloth chunk. Absent on older images.",
+ )
baked_loras: list[str] = Field(
default_factory = list,
description = "Adapter ids baked into the transformer AT LOAD TIME (before quantize + "
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index b988fb80ae7..15627c5bc98 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -42402,7 +42402,7 @@ async def generate_diffusion_image(
strength = request.strength,
upscale = request.upscale,
reference_images = request.reference_images,
- workflow = request.workflow,
+ workflow = None if request.workflow == "outpaint" else request.workflow,
reference_resolution = request.reference_resolution,
localized_edit = localized_edit,
# Owner only: on Windows an oversized run spills into RAM instead of raising OOM, so a managed
@@ -42497,6 +42497,10 @@ async def generate_diffusion_image(
"text_encoder_quant": result.get("text_encoder_quant"),
"memory_mode": result.get("memory_mode"),
"offload_policy": result.get("offload_policy"),
+ "speed_mode": result.get("speed_mode"),
+ "attention_backend": result.get("attention_backend"),
+ "transformer_cache": result.get("transformer_cache"),
+ "cpu_offload": result.get("cpu_offload"),
"baked_loras": list(result.get("baked_loras") or []),
# The adapters APPLIED to this generation. A baked-but-disabled adapter is recorded above as part of the build instead.
"loras": [f"{l.id}:{l.weight:g}" for l in request.loras or []],
@@ -42509,7 +42513,12 @@ async def generate_diffusion_image(
),
# The conditioned workflows keep their scalar settings here. The source, mask, reference and control IMAGES are
# deliberately not persisted (user uploads with their own lifetime), so the client asks for them again on restore.
- "workflow": result.get("workflow"),
+ "workflow": (
+ "outpaint"
+ if request.workflow == "outpaint"
+ and result.get("workflow") == "inpaint"
+ else result.get("workflow")
+ ),
"strength": request.strength,
"upscale": request.upscale,
"controlnet_guidance": (
@@ -43401,7 +43410,15 @@ async def _generate_openai_images(
"model_kind": result.get("model_kind"),
"gguf_filename": result.get("gguf_filename"),
"transformer_quant": result.get("transformer_quant"),
+ "text_encoder_quant": result.get("text_encoder_quant"),
+ "memory_mode": result.get("memory_mode"),
+ "offload_policy": result.get("offload_policy"),
+ "speed_mode": result.get("speed_mode"),
+ "attention_backend": result.get("attention_backend"),
+ "transformer_cache": result.get("transformer_cache"),
+ "cpu_offload": result.get("cpu_offload"),
"baked_loras": list(result.get("baked_loras") or []),
+ "workflow": result.get("workflow"),
"created_at": float(created),
}
# The diffusers batch shares one seed; the native batch uses a distinct seed per image, so record each image's own seed.
diff --git a/studio/backend/tests/test_saved_image_metadata_precision_contract.py b/studio/backend/tests/test_saved_image_metadata_precision_contract.py
index 9ddc2cd1f13..f49ead04870 100644
--- a/studio/backend/tests/test_saved_image_metadata_precision_contract.py
+++ b/studio/backend/tests/test_saved_image_metadata_precision_contract.py
@@ -30,6 +30,7 @@ from __future__ import annotations
import contextlib
import importlib.machinery
+import base64
import io
import json
import sys
@@ -55,6 +56,13 @@ _FRONTEND = Path(__file__).resolve().parents[2] / "frontend" / "src"
# baked_loras belongs here for the same reason the other three do: promoting any of them into
# image_gallery._REQUIRED_META would stop every PNG written before it existed from listing.
_BUILD_KEYS = ("model_kind", "gguf_filename", "transformer_quant", "baked_loras")
+# Generation-time build knobs; additive like _BUILD_KEYS.
+_RUNTIME_BUILD_KEYS = (
+ "speed_mode",
+ "attention_backend",
+ "transformer_cache",
+ "cpu_offload",
+)
# ── stub runtime (pared-down twin of test_diffusion_backend's) ────────────────
@@ -652,8 +660,184 @@ def test_the_recipe_popover_renders_the_build_fields():
src = (_FRONTEND / "features" / "images" / "images-page.tsx").read_text(encoding = "utf-8")
popover = src[src.index("function RecipePopover(") :]
popover = popover[: popover.index("\ntype Busy")]
- assert '<RecipeRow label="Quant" value={image.transformer_quant} />' in popover
+ assert '<RecipeRow label="Transformer" value={image.transformer_quant} />' in popover
assert '<RecipeRow label="File" value={image.gguf_filename} mono />' in popover
+ assert '<RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />' in popover
+ assert "image.speed_mode" in popover
+ assert "image.attention_backend" in popover
+ assert "image.transformer_cache" in popover
# Rendered conditionally, so an older PNG without them shows the rest of the recipe.
for key in ("transformer_quant", "gguf_filename"):
assert f"image.{key} ?" in popover
+
+
+def recipe_e2e_client(monkeypatch, tmp_path):
+ """Full HTTP path: generate -> gallery list -> PNG file bytes, with real image_gallery.save."""
+
+ class _Backend(_EngagedBackend):
+ def generate(
+ self,
+ *,
+ seed = None,
+ batch_size = 1,
+ prompts = None,
+ seeds = None,
+ **kwargs,
+ ):
+ pytest.importorskip("PIL")
+ from PIL import Image
+
+ if not self.loaded:
+ raise RuntimeError("No diffusion model is loaded.")
+ self.last_workflow = kwargs.get("workflow")
+ return {
+ "images": [Image.new("RGB", (512, 512), (40, 80, 120)) for _ in range(batch_size)],
+ "seed": seed if seed is not None else 4242,
+ "repo_id": "x/z-image",
+ "model_kind": "gguf",
+ "gguf_filename": "z-image-Q4_K_M.gguf",
+ "transformer_quant": self.engaged,
+ "text_encoder_quant": "fp8",
+ "memory_mode": "balanced",
+ "offload_policy": "model",
+ "speed_mode": "default",
+ "attention_backend": "_native_cudnn",
+ "transformer_cache": "fbcache",
+ "cpu_offload": True,
+ "baked_loras": [],
+ "workflow": "inpaint" if kwargs.get("mask_image") else "img2img",
+ "reference_resolution": None,
+ "localized_edit": None,
+ }
+
+ backend = _Backend()
+ monkeypatch.setattr(diffusion_module, "get_diffusion_backend", lambda: backend)
+ import core.inference.diffusion_engine_router as engine_router
+
+ monkeypatch.setattr(engine_router, "select_and_activate_engine", lambda fam, **kw: backend)
+ monkeypatch.setattr(engine_router, "get_active_diffusion_engine", lambda: backend)
+ monkeypatch.setattr(engine_router, "predict_engine", lambda fam, **kw: "diffusers")
+ monkeypatch.setattr(engine_router, "_active_engine_name", "diffusers")
+ monkeypatch.setattr(engine_router, "_fallback_reason", None)
+ monkeypatch.setattr(gpu_arbiter, "_owner", None)
+ monkeypatch.setitem(gpu_arbiter._EVICTORS, gpu_arbiter.CHAT, lambda: None)
+ monkeypatch.setitem(gpu_arbiter._EVICTORS, gpu_arbiter.DIFFUSION, lambda: None)
+ monkeypatch.setattr(gallery, "studio_root", lambda: tmp_path)
+
+ app = FastAPI()
+ app.include_router(studio_router, prefix = "/api/inference")
+ app.dependency_overrides[get_current_subject] = lambda: "test-user"
+ app.dependency_overrides[authenticated_via_api_key] = lambda: False
+ return TestClient(app), backend
+
+
+def test_recipe_e2e_generate_response_png_and_file_endpoint_agree(recipe_e2e_client):
+ """HTTP smoke: wire JSON, embedded PNG chunk, and gallery file download match."""
+ pytest.importorskip("PIL")
+ from PIL import Image
+
+ from core.inference.image_gallery import RECIPE_SCHEMA_VERSION
+
+ client, _backend = recipe_e2e_client
+ assert (
+ client.post(
+ "/api/inference/images/load",
+ json = {
+ "model_path": "unsloth/Z-Image-Turbo-GGUF",
+ "gguf_filename": "z-image-Q4_K_M.gguf",
+ },
+ ).status_code
+ == 200
+ )
+
+ gen = client.post(
+ "/api/inference/images/generate",
+ json = {
+ "prompt": "a sloth in a recipe test",
+ "seed": 99,
+ "steps": 4,
+ "guidance": 1.0,
+ "strength": 0.55,
+ },
+ )
+ assert gen.status_code == 200, gen.text
+ wire = gen.json()["images"][0]
+ image_id = wire["id"]
+ assert wire["schema_version"] == RECIPE_SCHEMA_VERSION
+
+ for key, expected in (
+ ("speed_mode", "default"),
+ ("attention_backend", "_native_cudnn"),
+ ("transformer_cache", "fbcache"),
+ ("cpu_offload", True),
+ ("workflow", "img2img"),
+ ("transformer_quant", _EngagedBackend.engaged),
+ ("text_encoder_quant", "fp8"),
+ ):
+ assert (
+ wire.get(key) == expected
+ ), f"generate response {key}={wire.get(key)!r}, want {expected!r}"
+
+ listed = client.get("/api/inference/images/gallery").json()["images"]
+ assert any(row["id"] == image_id for row in listed)
+
+ png_resp = client.get(f"/api/inference/images/gallery/{image_id}/file")
+ assert png_resp.status_code == 200
+ assert png_resp.headers["content-type"].startswith("image/png")
+ embedded = json.loads(Image.open(io.BytesIO(png_resp.content)).text["unsloth"])
+ assert embedded["schema_version"] == RECIPE_SCHEMA_VERSION
+ assert embedded["speed_mode"] == "default"
+ assert embedded["workflow"] == "img2img"
+ assert embedded["prompt"] == "a sloth in a recipe test"
+
+
+def test_png_recipe_stamps_schema_version(tmp_gallery):
+ pytest.importorskip("PIL")
+ from PIL import Image
+
+ from core.inference.image_gallery import RECIPE_SCHEMA_VERSION
+
+ meta = {**_old_schema_meta(), "model_kind": "pipeline"}
+ record = gallery.save(Image.new("RGB", (16, 16), (10, 20, 30)), meta)
+ raw = (gallery.gallery_dir() / f"{record['id']}.png").read_bytes()
+ with Image.open(io.BytesIO(raw)) as im:
+ embedded = json.loads(im.text["unsloth"])
+ assert embedded["schema_version"] == RECIPE_SCHEMA_VERSION
+ for key in _RUNTIME_BUILD_KEYS:
+ assert key not in embedded
+
+
+def test_extend_is_recorded_as_outpaint_but_runs_as_inpaint(recipe_e2e_client):
+ pytest.importorskip("PIL")
+ from PIL import Image
+
+ client, backend = recipe_e2e_client
+ load = {"model_path": "unsloth/Z-Image-Turbo-GGUF", "gguf_filename": "z-image-Q4_K_M.gguf"}
+ assert client.post("/api/inference/images/load", json = load).status_code == 200
+ buf = io.BytesIO()
+ Image.new("RGB", (64, 64)).save(buf, format = "PNG")
+ png = base64.b64encode(buf.getvalue()).decode()
+ body = {
+ "prompt": "p",
+ "seed": 1,
+ "steps": 4,
+ "init_image": png,
+ "mask_image": png,
+ "strength": 1.0,
+ }
+
+ inpaint = client.post("/api/inference/images/generate", json = body)
+ assert inpaint.status_code == 200, inpaint.text
+ assert inpaint.json()["images"][0]["workflow"] == "inpaint"
+
+ extend = client.post("/api/inference/images/generate", json = {**body, "workflow": "outpaint"})
+ assert extend.status_code == 200, extend.text
+ assert backend.last_workflow is None
+ image_id = extend.json()["images"][0]["id"]
+ assert extend.json()["images"][0]["workflow"] == "outpaint"
+ png_resp = client.get(f"/api/inference/images/gallery/{image_id}/file")
+ assert (
+ json.loads(Image.open(io.BytesIO(png_resp.content)).text["unsloth"])["workflow"]
+ == "outpaint"
+ )
diff --git a/studio/backend/tests/test_sd_cpp_backend.py b/studio/backend/tests/test_sd_cpp_backend.py
index d6e1b0d1615..533c285f7fc 100644
--- a/studio/backend/tests/test_sd_cpp_backend.py
+++ b/studio/backend/tests/test_sd_cpp_backend.py
@@ -2250,6 +2250,8 @@ def test_generate_reports_the_build_the_recipe_persists():
assert out["offload_policy"] == b.status()["offload_policy"]
assert out["transformer_quant"] is None and out["text_encoder_quant"] is None
assert out["memory_mode"] is None
+ assert out["cpu_offload"] is True and out["cpu_offload"] == b.status()["cpu_offload"]
+ assert out["speed_mode"] == b.status()["speed_mode"]
def test_a_completed_native_generation_stops_advertising_itself_as_cancellable(monkeypatch):
diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.ts
index 3da79cdad37..3cbf95c4b8a 100644
--- a/studio/frontend/src/features/images/api.ts
+++ b/studio/frontend/src/features/images/api.ts
@@ -176,7 +176,7 @@ export interface DiffusionGenerateRequest {
allow_oversized?: boolean;
// Additional images after init_image, in order, for the reference and edit workflows.
reference_images?: string[];
- workflow?: "edit" | "reference";
+ workflow?: "edit" | "reference" | "outpaint";
reference_resolution?: number;
// Unified edit only: annotate/paint composite onto the source, mask is sent as Image 2.
localized_edit?: { mode: LocalizedEditMode; image: string };
@@ -251,6 +251,11 @@ export interface GalleryImage {
text_encoder_quant?: string | null;
memory_mode?: string | null;
offload_policy?: string | null;
+ speed_mode?: string | null;
+ attention_backend?: string | null;
+ transformer_cache?: string | null;
+ cpu_offload?: boolean | null;
+ schema_version?: number | null;
baked_loras?: string[];
loras?: string[];
controlnet?: string | null;
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 3d3c50fff38..f837e24b2cb 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -135,7 +135,12 @@ import {
} 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";
+import {
+ WORKFLOW_EXAMPLE_PROMPTS,
+ WORKFLOW_TABS,
+ recipeWorkflowLabel,
+ type WorkflowId,
+} from "./workflows";
import { ParamSlider } from "@/features/chat";
import { ModelLoadDescription } from "@/features/chat/components/model-load-status";
import {
@@ -298,6 +303,7 @@ function useImageModels(
const CONDITIONED_WORKFLOW_INPUTS: Record<string, string> = {
img2img: "the source image",
inpaint: "the source image and mask",
+ outpaint: "the source image",
upscale: "the source image",
edit: "the source image",
reference: "the source and reference images",
@@ -1139,7 +1145,7 @@ function RecipePopover({
repo id alone does not say which quant ran. */}
{image.gguf_filename ? <RecipeRow label="File" value={image.gguf_filename} mono /> : null}
{image.transformer_quant ? (
- <RecipeRow label="Quant" value={image.transformer_quant} />
+ <RecipeRow label="Transformer" value={image.transformer_quant} />
) : null}
{/* The ENGAGED text-encoder precision and memory placement: the encoder is often the largest
resident component, and the memory mode decides whether torchao modes could run at all. */}
@@ -1156,9 +1162,55 @@ function RecipePopover({
value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
/>
) : null}
+ {image.speed_mode ? (
+ <RecipeRow
+ label="Speed"
+ value={formatResolvedValue("speed_mode", image.speed_mode)}
+ />
+ ) : null}
+ {image.attention_backend ? (
+ <RecipeRow
+ label="Attention"
+ value={formatResolvedValue("attention_backend", image.attention_backend)}
+ />
+ ) : null}
+ {image.transformer_cache ? (
+ <RecipeRow
+ label="Step cache"
+ value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+ />
+ ) : null}
+ {image.cpu_offload ? (
+ <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+ ) : null}
{image.baked_loras?.length ? (
<RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
) : null}
+ {image.loras?.length ? (
+ <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+ ) : null}
+ {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+ <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />
+ {image.strength != null &&
+ (image.workflow === "img2img" ||
+ image.workflow === "edit" ||
+ image.workflow === "inpaint" ||
+ image.workflow === "upscale") ? (
+ <RecipeRow label="Strength" value={String(image.strength)} />
+ ) : null}
+ {image.upscale != null && image.workflow === "upscale" ? (
+ <RecipeRow label="Upscale" value={`${image.upscale}×`} />
+ ) : null}
+ {image.reference_image_count != null &&
+ (image.workflow === "reference" || image.workflow === "edit") ? (
+ <RecipeRow label="References" value={String(image.reference_image_count)} />
+ ) : null}
+ {image.localized_edit ? (
+ <RecipeRow
+ label="Edit mode"
+ value={image.localized_edit.charAt(0).toUpperCase() + image.localized_edit.slice(1)}
+ />
+ ) : null}
<RecipeRow label="Size" value={`${image.width} × ${image.height}`} />
<RecipeRow label="Steps" value={String(image.steps)} />
<RecipeRow label="Guidance" value={String(image.guidance)} />
@@ -4092,6 +4144,8 @@ export function ImagesPage({
condInit = built.image;
condMask = built.mask;
condStrength = 1; // the new border is blank canvas: redraw it fully
+ // Runs as inpaint; the label only keeps the recipe saying Extend.
+ condFields = { workflow: "outpaint" };
} else if (isUpscale) {
// Hires fix: the backend enlarges the source and re-denoises at this low strength, gaining
// detail without changing content.
diff --git a/studio/frontend/src/features/images/workflows.ts b/studio/frontend/src/features/images/workflows.ts
index 6528bc84243..b698bce25ec 100644
--- a/studio/frontend/src/features/images/workflows.ts
+++ b/studio/frontend/src/features/images/workflows.ts
@@ -86,6 +86,23 @@ export const WORKFLOW_TABS: Array<{
},
];
+/** Backend workflow id (what the PNG recipe stores) to the Recipe popover label. */
+export const BACKEND_WORKFLOW_RECIPE_LABELS: Record<string, string> = {
+ txt2img: "Create",
+ img2img: "Transform",
+ edit: "Edit",
+ inpaint: "Inpaint",
+ outpaint: "Extend",
+ upscale: "Upscale",
+ reference: "Reference",
+ controlnet: "ControlNet",
+};
+
+export function recipeWorkflowLabel(workflow: string | null | undefined): string {
+ if (!workflow || workflow === "txt2img") return "Create";
+ return BACKEND_WORKFLOW_RECIPE_LABELS[workflow] ?? workflow;
+}
+
/** Placeholder hint per workflow, showing what each one is for. */
export const WORKFLOW_EXAMPLE_PROMPTS: Record<WorkflowId, string> = {
create:
diff --git a/studio/frontend/tests/loaded-build-panel-rows.test.ts b/studio/frontend/tests/loaded-build-panel-rows.test.ts
index 36965772686..36356c0ab15 100644
--- a/studio/frontend/tests/loaded-build-panel-rows.test.ts
+++ b/studio/frontend/tests/loaded-build-panel-rows.test.ts
@@ -27,10 +27,10 @@ test("the Memory recipe row renders on an offload with no memory mode", () => {
test("sd.cpp attention is not reported as Native SDPA", () => {
// Its attention is chosen by native flags, not by the diffusers/PyTorch dispatcher.
- const attention = source.slice(
- source.indexOf('label="Attention"'),
- source.indexOf('label="Attention"') + 700,
- );
+ // The Recipe popover has its own Attention row; this one is the panel's BuildRow.
+ const start = source.search(/<BuildRow\s+label="Attention"/);
+ assert.ok(start >= 0, "the Loaded-build panel must keep its Attention row");
+ const attention = source.slice(start, start + 700);
assert.ok(
attention.includes("isNativeEngineStatus(status)"),
"the fallback must distinguish the native engine before naming SDPA",
diff --git a/studio/frontend/tests/recipe-workflow-label.test.ts b/studio/frontend/tests/recipe-workflow-label.test.ts
new file mode 100644
index 00000000000..e714cf64368
--- /dev/null
+++ b/studio/frontend/tests/recipe-workflow-label.test.ts
@@ -0,0 +1,22 @@
+// 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 { recipeWorkflowLabel } from "../src/features/images/workflows.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+test("recipeWorkflowLabel maps backend workflow ids to UI labels", () => {
+ assert.equal(recipeWorkflowLabel(null), "Create");
+ assert.equal(recipeWorkflowLabel("txt2img"), "Create");
+ assert.equal(recipeWorkflowLabel("img2img"), "Transform");
+ assert.equal(recipeWorkflowLabel("outpaint"), "Extend");
+ assert.equal(recipeWorkflowLabel("reference"), "Reference");
+});
+
+test("restoring an Extend recipe still asks for its source image", () => {
+ const src = readSrc("features/images/images-page.tsx");
+ const table = src.slice(src.indexOf("const CONDITIONED_WORKFLOW_INPUTS"));
+ assert.match(table.slice(0, table.indexOf("};")), /\boutpaint: "the source image",/);
+});