Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(create): Studio-Integration ueber P1 bis P8 zusammenfuehren (P9)

purplea788f93791ea
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 838d6cf7..1b869e8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,26 @@ All notable changes to Locally Uncensored are documented here.
A GPU without a measured free reading gets a safer plan, and Linux/AppImage
installs stop losing environment variables to it.
+### Added
+
+- **Create-Studio, a new guided path on the cloud track.** A preset shelf next
+ to the usual Create tab walks a render from image to motion to sound, in
+ steps, each backed by any model that can do that step's job. Each step's
+ controls come straight from the picked model's own provider schema, and the
+ price shown is the one the provider actually confirms before Start, never a
+ formula guessed on this side. This needs a server change that has not
+ shipped on lu-labs.ai yet; until it does, Create shows "This feature needs a
+ newer LU Cloud server. Try again later." instead of guessing a price or
+ booking one.
+- **Cloud video renders now offer exactly the clip lengths the picked model
+ actually supports**, read from the live catalog, instead of a fixed 5s/8s
+ pair for every model.
+- **A cloud render without a prompt (a presenter reading a script, for
+ example) still gets a real name in the gallery**, instead of an empty tile.
+- **Character LoRAs in Create now only offer the models actually trained for
+ that character's family**, so the picker cannot suggest a combination that
+ would fail to generate.
+
### Fixed
- **The local engine now picks its CPU code path at startup**, so older
diff --git a/e2e/create-studio.spec.ts b/e2e/create-studio.spec.ts
new file mode 100644
index 00000000..102ae9c7
--- /dev/null
+++ b/e2e/create-studio.spec.ts
@@ -0,0 +1,161 @@
+import { test, expect, type Page } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME, type TauriMockOptions } from './support/tauri-mock'
+import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch, type CloudScenario } from './support/cloud-mock'
+
+/**
+ * P9 Integration: das Studio auf der Wolken-Spur, und sein Fehlen ueberall
+ * sonst (Portplan Abschnitt 5, P9 "offen fuer P9" der Pakete P4/P6).
+ *
+ * (a) Cloud-Spur mit Studio-Katalog: die Preset-Schiene erscheint, ein Klick
+ * oeffnet die Werkstatt, Preis erscheint, Escape UND das X schliessen sie.
+ * (b) lokale Spur: keine Schiene, der Expert-Abschnitt bleibt, wie er war
+ * (e2e/create-expert-section.spec.ts ist der eigentliche Beweis dafuer;
+ * hier nur die Randbedingung, dass das Studio ihn nicht verdraengt).
+ * (c) ein aelterer Server (Katalog ohne `quote_required` auf irgendeinem
+ * Eintrag) zeigt keine Schiene — Erkennung laeuft nur ueber das Feld,
+ * nie eine Versionsnummer (Portplan Abschnitt 4).
+ * (d) `studio-quote` antwortet 404: Start bleibt gesperrt, der feste Satz
+ * steht da, nie ein Rueckfall auf die eigene Formel.
+ * (e) die Laengen-Knoepfe im Composer folgen `clip.durations` aus dem
+ * Katalog, nicht einem festen 5s/8s-Paar (dd29f359).
+ */
+
+const WINDOWS_OPTS: TauriMockOptions = {
+ assistantReply: DEFAULT_ASSISTANT_REPLY,
+ modelName: DEFAULT_MODEL_NAME,
+ platform: 'windows',
+}
+
+async function bootIntoCloudCreate(page: Page, scenario: CloudScenario) {
+ await page.addInitScript(tauriMockInit, WINDOWS_OPTS)
+ await seedOnboardingDone(page)
+ await routeCloud(page, scenario)
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
+ await signInViaGate(page)
+ await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
+ await page.getByRole('button', { name: /^Create$/ }).click()
+}
+
+async function bootIntoLocalCreate(page: Page, scenario: CloudScenario) {
+ await page.addInitScript(tauriMockInit, WINDOWS_OPTS)
+ await seedOnboardingDone(page)
+ await routeCloud(page, scenario) // still mocked: nothing here should be reached
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
+ await page.getByRole('button', { name: /^Create$/ }).click()
+}
+
+const presetShelf = (page: Page) => page.locator('aside[aria-label="Presets"]')
+const expandPresets = (page: Page) => page.getByRole('button', { name: 'Expand presets' })
+
+test('cloud track with a Studio catalog: the shelf appears, opens the workshop, prices, and both Escape and the X close it', async ({ page }) => {
+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })
+
+ await expect(presetShelf(page)).toBeVisible({ timeout: 15_000 })
+ await expandPresets(page).click()
+ await expect(page.getByText('Song from Words')).toBeVisible()
+
+ await page.getByRole('button', { name: /Song from Words/ }).click()
+ const dialog = page.getByRole('dialog', { name: 'Song from Words' })
+ await expect(dialog).toBeVisible({ timeout: 15_000 })
+
+ await page.getByLabel('Preset prompt').fill('a bright acoustic tune about a summer road trip')
+ await expect(page.getByText('1,500 credits')).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByRole('button', { name: /^Generate$/ })).toBeEnabled()
+
+ await page.keyboard.press('Escape')
+ await expect(dialog).toBeHidden()
+
+ // Reopen the same preset for the X case — Escape's own test above already
+ // proved it, this proves the OTHER half of the popup house rule
+ // (feedback-sampling-popup-mit-x.md: a popup is X AND Escape, never just
+ // one of the two). The shelf itself is still expanded (Escape only closed
+ // the dialog on top of it), so no second "Expand presets" click here.
+ await page.getByRole('button', { name: /Song from Words/ }).click()
+ await expect(dialog).toBeVisible({ timeout: 15_000 })
+ await dialog.getByRole('button', { name: 'Close' }).click()
+ await expect(dialog).toBeHidden()
+})
+
+test('local track: no shelf at all, even with a Studio catalog on the wire', async ({ page }) => {
+ await bootIntoLocalCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })
+
+ await expect(presetShelf(page)).toHaveCount(0)
+ // The expert section still opens on the local track exactly as before —
+ // the Studio port replaces AdvancedDrawer's body only behind a Studio
+ // pick (backend === 'cloud' AND a resolved Studio model), never on local.
+ await page.getByRole('radio', { name: 'Image', exact: true }).click()
+ await page.getByRole('button', { name: 'Advanced settings' }).click()
+ await expect(page.getByRole('button', { name: 'Expert', exact: true })).toBeVisible({ timeout: 15_000 })
+})
+
+test('an older server (catalog with no quote_required entry) shows no shelf', async ({ page }) => {
+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true }) // studioCatalog left unset
+
+ await expect(page.getByRole('radio', { name: /Enhance Image/i })).toBeVisible({ timeout: 15_000 })
+ await expect(presetShelf(page)).toHaveCount(0)
+})
+
+test('studio-quote answers 404: start stays locked, the version-gap message shows, never a fallback price', async ({ page }) => {
+ await bootIntoCloudCreate(page, {
+ license: 'active', access: true, mediaLive: true, studioCatalog: true, studioQuoteStatus: 404,
+ })
+
+ await expandPresets(page).click()
+ await page.getByRole('button', { name: /Song from Words/ }).click()
+ const dialog = page.getByRole('dialog', { name: 'Song from Words' })
+ await expect(dialog).toBeVisible({ timeout: 15_000 })
+
+ await page.getByLabel('Preset prompt').fill('a bright acoustic tune about a summer road trip')
+ await expect(page.getByRole('alert')).toHaveText('This feature needs a newer LU Cloud server. Try again later.', { timeout: 15_000 })
+ await expect(page.getByRole('button', { name: /^Generate$/ })).toBeDisabled()
+ // The dialog still shows its own client-side PREVIEW ("≈ NNN credits",
+ // studio-contract.ts's formula) — that is allowed, it is clearly marked
+ // as an estimate and never what the run would book. What must NOT appear
+ // is a CONFIRMED price (no "≈"): that string only ever comes from a
+ // successful studio-quote() call, and would mean the app fell back to
+ // booking its own formula, exactly what Portplan Abschnitt 4/7 (Risiko 1)
+ // forbids.
+ await expect(dialog.getByText(/^[\d,]+ credits$/)).toHaveCount(0)
+ await expect(dialog.getByText(/^≈ [\d,]+ credits$/)).toBeVisible()
+})
+
+test('the presenter picker opens inline, not as a popup (P4, offen fuer P9)', async ({ page }) => {
+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })
+
+ await expandPresets(page).click()
+ await page.getByRole('button', { name: 'Explore individual cloud models' }).click()
+ await page.getByRole('option', { name: 'HeyGen Presenter' }).click()
+
+ const dialog = page.getByRole('dialog', { name: 'HeyGen Presenter' })
+ await expect(dialog).toBeVisible({ timeout: 15_000 })
+
+ // AvatarPicker (SchemaControl's 'avatar' field) is a field that opens in
+ // the normal document flow below its button, not a floating dialog of its
+ // own — the popup house rule (X + Escape) only applies where the source
+ // actually renders a floating overlay, and this field never did (P4's
+ // report on AvatarPicker.tsx). Proven two ways: no second dialog appears,
+ // and Escape here closes the WORKSHOP dialog, not just a picker inside it.
+ await expect(page.getByRole('dialog')).toHaveCount(1)
+ await page.keyboard.press('Escape')
+ await expect(dialog).toBeHidden()
+})
+
+test('the cloud Length control follows clip.durations from the catalog, not a fixed 5s/8s pair', async ({ page }) => {
+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })
+
+ await page.getByRole('radio', { name: /^Video$/ }).click()
+ // Segmented (Composer.tsx's LabeledControl) does not wire an aria-label
+ // onto the "Length" radiogroup itself — "Length" is a sibling <span>, not
+ // an aria-labelledby target — so the three second-values themselves are
+ // the only reliable locator; they read as plain "Ns" nowhere else on the
+ // Create surface (the Size control's options are "Xp", the steps slider
+ // has no radio role at all).
+ await expect(page.getByRole('radio', { name: '4s' })).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByRole('radio', { name: '6s' })).toBeVisible()
+ await expect(page.getByRole('radio', { name: '9s' })).toBeVisible()
+ // The old fixed pair is gone, not just outnumbered.
+ await expect(page.getByRole('radio', { name: '5s' })).toHaveCount(0)
+ await expect(page.getByRole('radio', { name: '8s' })).toHaveCount(0)
+})
diff --git a/e2e/support/cloud-mock.ts b/e2e/support/cloud-mock.ts
index ba7db75f..8d41a0b3 100644
--- a/e2e/support/cloud-mock.ts
+++ b/e2e/support/cloud-mock.ts
@@ -31,8 +31,55 @@ export interface CloudScenario {
* sagt es hier.
*/
paidPlan?: boolean
+ /**
+ * P9: the extended /api/jobs/catalog contract the Create-Studio port reads
+ * (Portplan Abschnitt 4, Punkt 5): a Studio model entry carrying
+ * `api_schema`/`pricing`/`quote_required`, plus `clip.durations` and
+ * `credits.by_duration` on the classic video entry (dd29f359). The Preset
+ * shelf and StudioParams gate purely on `quote_required` being present on
+ * AT LEAST ONE entry (never a version number, Portplan Abschnitt 4) —
+ * leaving this unset reproduces an OLDER server's catalog (no entry knows
+ * Studio at all), the shelf must stay hidden.
+ */
+ studioCatalog?: boolean
+ /**
+ * Status /api/jobs/studio-quote answers with. 200 (default) returns a
+ * flat, deterministic price; 404 reproduces "the route exists but this
+ * server build predates Studio" (Portplan Abschnitt 4: "This feature needs
+ * a newer LU Cloud server. Try again later."); 'unreachable' does not
+ * register the route at all, reproducing the pre-P0 CORS gap the same way
+ * (both collapse to the identical client-side message).
+ */
+ studioQuoteStatus?: 200 | 404 | 'unreachable'
}
+// P9: one Studio model, shaped like a real /api/jobs/catalog entry once P0's
+// CORS fix and the live server both carry the Studio fields. `minimax-music`
+// matches a real STUDIO_MODELS id (src/lib/render/studio-models.json) so the
+// app's own bundled provider schema (SchemaControl's source of truth, never
+// the server) renders the same fields a live run would use: a flat-rate
+// model with a bare `prompt` input, no upload, the simplest full booking path
+// for an e2e run. `pricing`/`api_schema` mirror studio-contract.ts's own
+// StudioModel/Schema shape (Portplan Abschnitt 2.1) — present on the wire so
+// a future server-truth switch is a data change, not a contract change; nothing
+// on the client reads them yet (studioQuote() is the price source of record).
+const STUDIO_CATALOG_MODEL = {
+ id: 'minimax-music',
+ label: 'MiniMax Music',
+ kind: 'audio' as const,
+ edit: false,
+ cfg: false,
+ negative_prompt: false,
+ quote_required: true,
+ pricing: { mode: 'flat', rates: { default: 0.15 } },
+ api_schema: {
+ type: 'object',
+ properties: { prompt: { type: 'string', description: 'Prompt for the music generation.' } },
+ required: ['prompt'],
+ },
+}
+
+
const CORS: Record<string, string> = {
'access-control-allow-origin': '*',
'access-control-allow-headers': '*',
@@ -120,7 +167,19 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v
models: [
{ id: 'flux-schnell', label: 'Flux Schnell (fast)', kind: 'image', edit: false, cfg: true, negative_prompt: false, credits: { base: 300 } },
{ id: 'flux-dev', label: 'Flux Dev (quality)', kind: 'image', edit: true, cfg: true, negative_prompt: false, credits: { base: 1200 } },
- { id: 'wan-2.2-720p', label: 'Wan 2.2 720p', kind: 'video', edit: false, cfg: false, negative_prompt: true, clip: { short: 5, long: 8 }, credits: { base: 40000, long: 64000 } },
+ {
+ id: 'wan-2.2-720p', label: 'Wan 2.2 720p', kind: 'video', edit: false, cfg: false, negative_prompt: true,
+ // dd29f359: clip.durations/credits.by_duration let a model book
+ // any advertised length, not just a fixed short/long pair.
+ // 4/6/9 are deliberately NOT the 5/8 short/long pair, so a spec
+ // asserting these three buttons proves the Length control
+ // really reads the catalog and not a hardcoded fallback.
+ clip: scenario.studioCatalog ? { short: 5, long: 8, durations: [4, 6, 9] } : { short: 5, long: 8 },
+ credits: scenario.studioCatalog
+ ? { base: 40000, long: 64000, by_duration: { '4': 32000, '6': 48000, '9': 72000 } }
+ : { base: 40000, long: 64000 },
+ },
+ ...(scenario.studioCatalog ? [STUDIO_CATALOG_MODEL] : []),
],
ops: { removebg: 1000, eraser: 2500, upscale_image: 1000, upscale_video_per_s: 500, upscale_video_min: 2500 },
voice: { stt: 600, tts_per_1k_chars: 8000 },
@@ -131,6 +190,28 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v
)
}
+ // P9: POST /api/jobs/studio-quote, the provider-confirmed price a Studio
+ // run asks for before it books (Portplan Abschnitt 4, Punkt 1). A flat,
+ // deterministic number — real per-model pricing is studio-contract.ts's
+ // job, not this mock's.
+ if (path === '/api/jobs/studio-quote') {
+ if (scenario.studioQuoteStatus === 404) return route.fulfill(json(404, { error: 'not found' }))
+ // 'unreachable': the pre-P0 state (no withCors/OPTIONS at all) — the
+ // browser never lets a response reach the app, so the mock aborts
+ // instead of fulfilling, the same failure shape a real CORS block
+ // produces (studio.ts's own comment: this collapses to the identical
+ // "newer LU Cloud server" text as a 404).
+ if (scenario.studioQuoteStatus === 'unreachable') return route.abort('failed')
+ return route.fulfill(json(200, { credits: 1500 }))
+ }
+
+ // P9: GET /api/jobs/runtime (Portplan Abschnitt 4, Punkt 2). Empty is a
+ // valid, common answer (MIN_SAMPLES: silence over a guess) — no spec
+ // needs a populated runtime map, so this mock never returns one.
+ if (path === '/api/jobs/runtime') {
+ return route.fulfill(json(200, { runtimes: {} }))
+ }
+
if (path === '/api/inference/v1/models') {
return route.fulfill(
json(200, {
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index 962d5496..2476635a 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -36,6 +36,7 @@ const PresetWorkshop = lazy(() =>
import('./PresetWorkshop').then((m) => ({ default: m.PresetWorkshop })),
)
import { INTENT_MAP, isIntentAvailable } from './intents'
+import { intentRoles, isStudioModel, resolveIntentPick } from '../../../lib/render/create-studio'
import { modelForOp } from '../../../stores/cloudCatalogStore'
import { stageShowsSetupCard, laneModelCount } from './stageGate'
import { isMlxImageHost } from '../../../api/mlx-image'
@@ -72,6 +73,27 @@ function CreateExperimentalInner() {
const motionModelList = useCreateStore((s) => s.motionModelList)
const { modelLoadError, connected, modelsLoaded, mlxMissing, comfyOnCpu, comfyCpuBanner } = useCreateExp()
+ // P9: AdvancedDrawer needs the same studioModel Composer.tsx derives
+ // (Portplan Abschnitt 3b), so the Expert drawer shows StudioParams instead
+ // of WorkflowFinder+ParamGroups whenever a Studio pick is active. P7's
+ // report flagged this as still open: Composer computes studioPick itself
+ // and never passed it up, so CreateExperimental rendered AdvancedDrawer
+ // with no studioModel at all and the drawer always fell back to the
+ // ComfyUI expert block even on a Studio pick. Same read-only derivation as
+ // Composer.tsx, kept in sync by hand (both read the same store getters and
+ // pure functions, no new state).
+ const intent = useCreateStore((s) => s.intent())
+ const characterTab = useCreateStore((s) => s.characterTab)
+ const cloudOpModel = useCreateStore((s) => s.cloudOpModel)
+ // characterUse never resolves to a Studio pick (Composer.tsx: roleIntent
+ // excludes it outright, character-use stays on its fixed -lora family via
+ // resolveCharacterModel), so this derivation does not need
+ // selectedCharacter at all.
+ const characterUse = intent === 'character' && characterTab === 'use'
+ const roleIntent = backend === 'cloud' && !characterUse && intentRoles(intent).length > 0
+ const rolePick = roleIntent ? resolveIntentPick(intent, cloudOpModel) : undefined
+ const studioPick = rolePick && isStudioModel(rolePick) ? rolePick : undefined
+
const [shownId, setShownId] = useState<string | null>(null)
const [advancedOpen, setAdvancedOpen] = useState(false)
const [maskOpen, setMaskOpen] = useState(false)
@@ -182,8 +204,8 @@ function CreateExperimentalInner() {
}, [gallery])
// Switching intent/mode returns the Stage to empty — the newest gallery item
- // must not reappear just because the axis changed.
- const intent = useCreateStore((s) => s.intent())
+ // must not reappear just because the axis changed. (`intent` is read once,
+ // near the top of the component, for the studioModel derivation below.)
useEffect(() => { setShownId(null) }, [intent])
const displayed = shownId ? gallery.find((g) => g.id === shownId) : undefined
@@ -417,7 +439,7 @@ function CreateExperimentalInner() {
onOpenWorkflows={() => { setWorkflowsOpen(true); setManagerNoticeSeen(true) }}
/>
- <AdvancedDrawer open={advancedOpen} onClose={() => setAdvancedOpen(false)} />
+ <AdvancedDrawer open={advancedOpen} onClose={() => setAdvancedOpen(false)} studioModel={studioPick} />
<WorkflowsModal open={workflowsOpen} onClose={() => setWorkflowsOpen(false)} />
<MaskEditor open={maskOpen} onClose={() => setMaskOpen(false)} />
diff --git a/src/components/create/experimental/PresetWorkshop.tsx b/src/components/create/experimental/PresetWorkshop.tsx
index 709a5431..cc4b5872 100644
--- a/src/components/create/experimental/PresetWorkshop.tsx
+++ b/src/components/create/experimental/PresetWorkshop.tsx
@@ -8,7 +8,8 @@ import { humanRuntime, type ModelRuntime } from '../../../lib/render/runtime-for
import { selectedVideoSeconds, videoDurations } from '../../../lib/render/video-duration'
import { studioQuote, modelRuntimes, StudioQuoteChangedError } from '../../../api/cloud/studio'
import { uploadInput, submitCloudJob, pollJob, getJob, cancelJob, QuoteChangedError, type CloudJob, type CloudJobParams } from '../../../api/cloud/jobs'
-import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
+import { galleryItemFromJob } from '../../../lib/render/cloud-jobs'
+import { useCreateStore } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
import { SchemaControl, baseFieldClass as fieldClass } from './SchemaControl'
import { Select } from '../ui/Select'
@@ -17,36 +18,6 @@ import { errorText } from '../../../types/json-guards'
const label = (s: string) => s.replaceAll('_', ' ').replace(/^./, (c) => c.toUpperCase())
-/** Web-Aequivalent `galleryItemFromJob` (lib/render/cloud-jobs.ts) wurde von
- * P5 nicht mitportiert — Desktop-`useCloudCreate.ts` (P7) baut Galerie-
- * Eintraege bisher selbst inline, dort ebenfalls ohne gemeinsame Funktion
- * (siehe studio-p5.md, "Offen fuer P9"). Dieselbe Bauart hier: ein fertiger
- * `CloudJob` traegt keine der lokalen Render-Felder (Sampler, Steps, ...),
- * die bleiben auf ihren neutralen Nullwerten. */
-function galleryItemFromJob(job: CloudJob): Omit<GalleryItem, 'prompt' | 'label'> {
- return {
- id: job.id,
- type: job.kind,
- filename: '',
- subfolder: '',
- negativePrompt: '',
- model: job.model,
- modelType: 'unknown',
- seed: 0,
- steps: 0,
- cfgScale: 0,
- sampler: '',
- scheduler: '',
- width: 0,
- height: 0,
- batchSize: 1,
- createdAt: Date.now(),
- remoteUrl: job.result_url ?? undefined,
- attestation: job.attestation,
- jobId: job.id,
- }
-}
-
export function PresetWorkshop({preset,onClose,onGenerate}:{preset:CreatePreset;onClose:()=>void;onGenerate:()=>void}) {
const [index,setIndex]=useState(0),[prompt,setPrompt]=useState(''),[options,setOptions]=useState<Record<string,unknown>>({})
const [paths,setPaths]=useState<Record<string,string|string[]>>({}),[completed,setCompleted]=useState<Record<number,CloudJob>>({})
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index e1237691..9d16acf2 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -23,6 +23,7 @@ import { useDownloadStore } from '../../../stores/downloadStore'
import { getLoraModels } from '../../../api/comfyui'
import { isWindows, isMacOS } from '../../../api/backend'
import { musicTakesLyrics, musicHowtoLines } from '../../../lib/render/music-ui'
+import { galleryLabelShort } from '../../../lib/render/gallery-label'
import { TRAIN_PRESETS, trainStepsNote } from '../../../lib/trainer-presets'
import { trainerPathPlaceholder } from '../../../lib/trainer-path-placeholder'
import { trainerRootHint } from '../../../lib/trainer-root-hint'
@@ -1204,14 +1205,22 @@ function CloudExtendControls() {
setExtendSource({
jobId: g.jobId as string,
url: g.remoteUrl ?? '',
- label: g.prompt.slice(0, 40) || 'Cloud video',
+ // P9: 'Cloud video' was the old blanket notname
+ // gallery-label.ts's own header comment names as the
+ // problem it fixes (David, 19.09.2026: "everything
+ // after that is just Cloud videos"). A prompt-less
+ // entry here is routinely a Studio step (sharpen,
+ // extend, a preset step) — galleryLabelShort names
+ // those from their model/label instead of a blank
+ // notname.
+ label: galleryLabelShort(g, 40),
})
setOpen(false)
}}
className="w-full flex items-center gap-2 t-control text-gray-300 px-2.5 py-1.5 rounded-md hover:bg-white/[0.06]"
>
<Film size={12} />
- <span className="truncate">{g.prompt || 'Cloud video'}</span>
+ <span className="truncate">{galleryLabelShort(g, 60)}</span>
</button>
))}
</motion.div>
diff --git a/src/components/create/experimental/__tests__/mask-hint.test.ts b/src/components/create/experimental/__tests__/mask-hint.test.ts
index e2ae5577..33ab583b 100644
--- a/src/components/create/experimental/__tests__/mask-hint.test.ts
+++ b/src/components/create/experimental/__tests__/mask-hint.test.ts
@@ -29,11 +29,11 @@ describe('the mask instruction', () => {
expect(COMPOSER).not.toMatch(/text-amber-\d00 dark:text-amber/)
})
- // P8-Notiz: dieser Fall gehoert inhaltlich zu Paket P7 (Composer.tsx ist dort
- // exklusiv, hier nicht angefasst). Im P8-Zweig hat der Desktop-Composer die
- // Studio-Anbindung noch nicht, darum fehlt der Ersatztext fuer den Radiergummi
- // noch. P9 fuehrt P7 und P8 zusammen; dort greift dieser Fall wieder.
- it.skip('still says something for a run that has no prompt field at all', () => {
+ // P8-Notiz: dieser Fall gehoerte inhaltlich zu Paket P7 (Composer.tsx war dort
+ // exklusiv). P7s Bericht bestaetigt, dass der Ersatztext fuer den Radiergummi
+ // inzwischen in Composer.tsx steht. P9 fuehrt P7 und P8 zusammen, hier
+ // scharfgeschaltet.
+ it('still says something for a run that has no prompt field at all', () => {
// Sonst stuende beim Radiergummi ein leerer Kasten ueber der Leiste.
expect(COMPOSER).toContain('Mask ready. Hit Create.')
expect(COMPOSER).toContain('Paint over what should go, then hit Create.')
diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.ts
index cc116c16..1bc5f5f0 100644
--- a/src/hooks/useCloudCreate.ts
+++ b/src/hooks/useCloudCreate.ts
@@ -12,7 +12,7 @@
import { useCallback } from 'react'
import { useCreateStore, type GalleryItem } from '../stores/createStore'
-import { intentToJob } from '../lib/render/cloud-jobs'
+import { intentToJob, galleryItemFromJob } from '../lib/render/cloud-jobs'
import {
cancelJob,
getJob,
@@ -552,15 +552,10 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
st.setProgressPhase('complete')
st.setProgress(100, 'Complete!')
st.addToGallery({
- id: job.id,
- type: kind,
- filename: '',
- subfolder: '',
+ ...galleryItemFromJob(job),
prompt: OP_GALLERY_LABEL[op] ?? s.prompt,
label,
negativePrompt: s.negativePrompt,
- model,
- modelType: 'unknown',
seed: runSeed,
steps: s.steps,
cfgScale: s.cfgScale,
@@ -568,11 +563,6 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
scheduler: s.scheduler,
width: s.width,
height: s.height,
- batchSize: 1,
- createdAt: Date.now(),
- remoteUrl: job.result_url,
- attestation: job.attestation,
- jobId: job.id,
intent,
})
} else if (job.status === 'canceled') {
@@ -681,26 +671,8 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
st.setProgress(100, 'Voice ready!')
const label = text.length > 40 ? `${text.slice(0, 40)}…` : text
st.addToGallery({
- id: job.id,
- type: 'audio',
- filename: '',
- subfolder: '',
+ ...galleryItemFromJob(job),
prompt: text,
- negativePrompt: '',
- model,
- modelType: 'unknown',
- seed: 0,
- steps: 0,
- cfgScale: 0,
- sampler: '',
- scheduler: '',
- width: 0,
- height: 0,
- batchSize: 1,
- createdAt: Date.now(),
- remoteUrl: job.result_url,
- attestation: job.attestation,
- jobId: job.id,
intent: 'lipsync',
})
st.setVoiceFromJob({ jobId: job.id, label })
diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.ts
index 0735cac1..a8639fc2 100644
--- a/src/lib/release-notes.ts
+++ b/src/lib/release-notes.ts
@@ -316,6 +316,32 @@ export const RELEASE_NOTES: ReleaseNote[] = [
title: 'The model picker no longer crashes when grouping by family.',
detail: 'The model picker no longer crashes when grouping models by family, a custom OpenAI compatible endpoint now receives Top K, a model name is no longer cut off at its first colon, and a newly added provider starts with no value pre filled.',
},
+ // P9 (19.09.-20.09.2026, Portplan Abschnitt 5): das Studio aus dem
+ // Web nach Desktop 3.0.1 portiert. Vier Zeilen, jede zeichengleich
+ // mit einem Punkt der Auftragsvorgabe: Presets+gefuehrter Weg,
+ // Anbieterschema+bestaetigter Preis, Cliplaengen je Modell,
+ // Charakter-LoRA-Passung. Keine ueber die Quelle hinausgehenden
+ // Erwachsenenvokabeln, kein Tokens-je-Euro, und das Versprechen
+ // haengt ehrlich an der Server-CORS-Lage (Portplan Abschnitt 4:
+ // "Nie eine Serverversion fest verdrahten", die Erkennung laeuft
+ // ausschliesslich ueber die Anwesenheit von quote_required im
+ // Katalog).
+ {
+ title: 'Create-Studio: a new guided path on the cloud track.',
+ detail: 'A preset shelf next to the usual Create tab walks a render from image to motion to sound, in steps, each backed by any model that can do that step\'s job. Each step\'s controls come straight from the picked model\'s own provider schema, and the price shown is the one the provider actually confirms before Start, never a formula guessed on this side. This needs a server change that has not shipped on lu-labs.ai yet; until it does, Create shows "This feature needs a newer LU Cloud server. Try again later." instead of guessing a price or booking one.',
+ },
+ {
+ title: 'Cloud video renders now offer exactly the lengths a model actually supports.',
+ detail: 'Cloud video renders now offer exactly the clip lengths the picked model actually supports, read from the live catalog, instead of a fixed 5s/8s pair for every model.',
+ },
+ {
+ title: 'A cloud render without a prompt still gets a real name in the gallery.',
+ detail: 'A cloud render without a prompt (a presenter reading a script, for example) still gets a real name in the gallery, instead of an empty tile.',
+ },
+ {
+ title: 'Character LoRAs now only offer models trained for that character.',
+ detail: 'Character LoRAs in Create now only offer the models actually trained for that character\'s family, so the picker cannot suggest a combination that would fail to generate.',
+ },
],
},
{
diff --git a/src/lib/render/__tests__/cloud-jobs.test.ts b/src/lib/render/__tests__/cloud-jobs.test.ts
index 77756c8c..fdc5e575 100644
--- a/src/lib/render/__tests__/cloud-jobs.test.ts
+++ b/src/lib/render/__tests__/cloud-jobs.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { intentToJob } from '../cloud-jobs'
+import { intentToJob, galleryItemFromJob } from '../cloud-jobs'
import type { CreateIntent } from '../../../stores/createStore'
describe('intentToJob', () => {
@@ -27,3 +27,51 @@ describe('intentToJob', () => {
}
})
})
+
+// P9: galleryItemFromJob was built twice independently (PresetWorkshop.tsx,
+// P6; inline in useCloudCreate.ts, P7) because P5 did not port the web's
+// version — folded here into the one place the portplan names for it, so
+// both PresetWorkshop and useCloudCreate now build a gallery entry the same
+// way (studio-p5.md/studio-p6.md, "Offen fuer P9").
+describe('galleryItemFromJob', () => {
+ it('carries the job identity through, with every local render field neutral', () => {
+ const item = galleryItemFromJob({
+ id: 'job-1',
+ kind: 'video',
+ model: 'flashvsr',
+ result_url: 'https://lu-labs.ai/e2e/result.mp4',
+ attestation: { quote: 'q', verify_url: 'https://lu-labs.ai/verify' },
+ })
+ expect(item.id).toBe('job-1')
+ expect(item.jobId).toBe('job-1')
+ expect(item.type).toBe('video')
+ expect(item.model).toBe('flashvsr')
+ expect(item.remoteUrl).toBe('https://lu-labs.ai/e2e/result.mp4')
+ expect(item.attestation).toEqual({ quote: 'q', verify_url: 'https://lu-labs.ai/verify' })
+ // Neutral: a Studio/preset job never carries ComfyUI sampler state.
+ expect(item.sampler).toBe('')
+ expect(item.scheduler).toBe('')
+ expect(item.seed).toBe(0)
+ expect(item.steps).toBe(0)
+ expect(item.cfgScale).toBe(0)
+ expect(item.width).toBe(0)
+ expect(item.height).toBe(0)
+ expect(item.filename).toBe('')
+ expect(item.subfolder).toBe('')
+ expect(item.negativePrompt).toBe('')
+ expect(item.batchSize).toBe(1)
+ expect(item.modelType).toBe('unknown')
+ })
+
+ it('turns a missing result_url into an undefined remoteUrl, not a null one', () => {
+ const item = galleryItemFromJob({ id: 'job-2', kind: 'audio', model: 'minimax-music', result_url: null, attestation: null })
+ expect(item.remoteUrl).toBeUndefined()
+ expect(item.attestation).toBeNull()
+ })
+
+ it('leaves prompt and label out entirely, the caller supplies both', () => {
+ const item = galleryItemFromJob({ id: 'job-3', kind: 'image', model: 'preset-chroma', result_url: null, attestation: null })
+ expect('prompt' in item).toBe(false)
+ expect('label' in item).toBe(false)
+ })
+})
diff --git a/src/lib/render/cloud-jobs.ts b/src/lib/render/cloud-jobs.ts
index d5c7f849..d553ffcd 100644
--- a/src/lib/render/cloud-jobs.ts
+++ b/src/lib/render/cloud-jobs.ts
@@ -82,3 +82,48 @@ export function intentToJob(intent: CreateIntentLike): { kind: RenderKind; op: R
return { kind: 'image', op: 'generate' }
}
}
+
+/** The neutral gallery-entry shape a finished cloud job produces before the
+ * caller layers its own fields on top (prompt, label, and — for the
+ * Composer's classic path — the actual local render params: sampler, steps,
+ * seed, cfgScale, width, height, intent).
+ *
+ * Web equivalent: lib/render/cloud-jobs.ts's `galleryItemFromJob`, which P5
+ * did not port (studio-p5.md, "Offen fuer P9"). It ended up built twice
+ * independently instead: once in PresetWorkshop.tsx (P6) and once inline in
+ * useCloudCreate.ts (P7). P9 folds both into this single function, the one
+ * place the portplan names for it.
+ *
+ * Typed structurally against the job fields it actually reads, not against
+ * `CloudJob` from api/cloud/jobs.ts: that file already imports RenderKind/
+ * RenderOp FROM this one, so a type import back here would close a module
+ * cycle (same reasoning as CreateIntentLike above). */
+export function galleryItemFromJob(job: {
+ id: string
+ kind: RenderKind
+ model: string
+ result_url: string | null
+ attestation: { quote: string; verify_url: string } | null
+}) {
+ return {
+ id: job.id,
+ type: job.kind,
+ filename: '',
+ subfolder: '',
+ negativePrompt: '',
+ model: job.model,
+ modelType: 'unknown' as const,
+ seed: 0,
+ steps: 0,
+ cfgScale: 0,
+ sampler: '',
+ scheduler: '',
+ width: 0,
+ height: 0,
+ batchSize: 1,
+ createdAt: Date.now(),
+ remoteUrl: job.result_url ?? undefined,
+ attestation: job.attestation,
+ jobId: job.id,
+ }
+}
diff --git a/src/lib/render/create-presets.ts b/src/lib/render/create-presets.ts
index 727dfccb..d1223c4d 100644
--- a/src/lib/render/create-presets.ts
+++ b/src/lib/render/create-presets.ts
@@ -1,7 +1,7 @@
import { STUDIO_MODELS, studioBaseCredits } from './studio-contract'
import { runCredits } from '../../stores/cloudCatalogStore'
-import { type PresetOp, type StepRole } from './preset-models'
-import type { RenderKind } from './cloud-jobs'
+import { type StepRole } from './preset-models'
+import type { RenderKind, RenderOp } from './cloud-jobs'
// `role` is what the step DOES. The model named here is the preset's
// suggestion; the role decides which other models the customer may pick
// instead. See lib/render/preset-models.ts.
@@ -9,7 +9,7 @@ import type { RenderKind } from './cloud-jobs'
// ein. 19.09.2026, Entscheid von David: bei Horror passen Prefect Pony und
// Neta Lumina nicht, auch wenn sie offen sind. Die Rolle bleibt, was sie ist;
// der Schritt sagt, welche ihrer Mitglieder er wirklich verantworten kann.
-export interface PresetStep { model: string; kind: RenderKind; op: PresetOp; title: string; role: StepRole; models?: string[] }
+export interface PresetStep { model: string; kind: RenderKind; op: RenderOp; title: string; role: StepRole; models?: string[] }
export interface CreatePreset { id: string; title: string; summary: string; category: 'Character'|'Horror'|'Product'|'Video'|'Audio'; adult: boolean; accent: string; steps: PresetStep[]; note?: string }
const image = (model:string,models?:string[]): PresetStep => ({model:'preset-'+model,kind:'image',op:'studio',title:'Create the image',role:'image',...(models?{models}:{})})
const animate = (model:string): PresetStep => ({model:'preset-'+model,kind:'video',op:'studio',title:'Bring it to life',role:'animate'})
diff --git a/src/lib/render/create-studio.ts b/src/lib/render/create-studio.ts
index 5ad0984b..19572a6a 100644
--- a/src/lib/render/create-studio.ts
+++ b/src/lib/render/create-studio.ts
@@ -15,15 +15,21 @@ import { STUDIO_MODELS, studioBaseCredits, studioPreviewCredits } from './studio
import { presetModels, requiredRoleInputs, roleInputs, type PresetModel, type StepRole } from './preset-models'
import { opPickerModels } from '../../stores/cloudCatalogStore'
-// Desktop port (P2): the web's CreateIntent already carries 'video_upscale'
-// as a distinct intent from the plain 'upscale' (image upscale). The
-// desktop's CreateIntent (in stores/createStore.ts, P5's file) has a single
-// 'upscale' that serves BOTH image and video upscale today via the older
-// utility-op path; splitting it into its own value is a store/Composer
-// decision (P5/P7), not this package's. StudioIntent stands in locally so
-// tsc stays green without touching createStore.ts. P9: once P5/P7 decide how
-// video upscale reaches the Composer (new CloudOp, or a kind check on
-// 'upscale'), fold this back into CreateIntent and drop the shim below.
+// Desktop port (P2, checked again in P9): the web's CreateIntent already
+// carries 'video_upscale' as a distinct intent from the plain 'upscale'
+// (image upscale). The desktop's CreateIntent (in stores/createStore.ts,
+// P5's file, merged) still has a single 'upscale' that serves BOTH image and
+// video upscale via the older utility-op path. This is not a leftover type
+// gap: components/create/experimental/intents.ts documents (comment at the
+// 'upscale' intent, predates the Studio port) that a separate video-upscale
+// intent is "a feature decision for David ... out of scope here" — it needs
+// a new IntentBar tile and Composer wiring, a UI feature addition, not an
+// integration fold. StudioIntent stays as the local shim until that decision
+// is made; the video_upscale role list below (STUDIO_MODELS entries
+// video-upscaler, flashvsr, video-upscaler-pro, ultimate-video-upscaler,
+// crystal-upscaler, flux-3-upscale) is correctly wired and tested, but
+// reachable only by calling these functions directly with 'video_upscale',
+// which no UI path does today.
export type StudioIntent = CreateIntent | 'video_upscale'
/** Die Rolle, die eine Create-Unterkategorie faehrt. Absichten ohne Eintrag
diff --git a/src/lib/render/preset-models.ts b/src/lib/render/preset-models.ts
index 459a41fd..913488df 100644
--- a/src/lib/render/preset-models.ts
+++ b/src/lib/render/preset-models.ts
@@ -13,14 +13,6 @@ import { STUDIO_MODELS, studioSchema } from './studio-contract'
import { cloudModelById, cloudModelsFor, i2vModels, runCredits } from '../../stores/cloudCatalogStore'
import type { RenderKind, RenderOp } from './cloud-jobs'
-// Desktop port (P2): the web's RenderOp union already carries 'studio' (see
-// lib/render/provider.ts in the portplan). The desktop's RenderOp (in
-// cloud-jobs.ts) does not yet: that file is P5's exclusively, and 'studio'
-// lands there when P5 merges. Until then this local union stands in so tsc
-// stays green without touching a file this package does not own. P9: fold
-// PresetOp away once cloud-jobs.ts's RenderOp includes 'studio'.
-export type PresetOp = RenderOp | 'studio'
-
export type StepRole =
| 'image' | 'animate' | 'soundtrack' | 'speech' | 'music' | 'talking' | 'presenter'
| 'duo' | 'extend' | 'motion' | 'restyle' | 'angles' | 'edit' | 'upscale'
@@ -29,13 +21,13 @@ export interface PresetModel {
id: string
label: string
kind: RenderKind
- op: PresetOp
+ op: RenderOp
adult: boolean
}
/** The op a NON-studio member of this role runs under. Studio members always
* run under 'studio' and carry their own schema. */
-const ROLE_OP: Record<StepRole, PresetOp> = {
+const ROLE_OP: Record<StepRole, RenderOp> = {
image: 'generate', animate: 'animate', soundtrack: 'studio', speech: 'tts',
music: 'music', talking: 'lipsync', presenter: 'studio', duo: 'studio',
extend: 'extend', motion: 'motion', restyle: 'studio', angles: 'studio',
diff --git a/src/stores/__tests__/cloudCatalogStore-studio-price.test.ts b/src/stores/__tests__/cloudCatalogStore-studio-price.test.ts
index 797a32cd..f093a995 100644
--- a/src/stores/__tests__/cloudCatalogStore-studio-price.test.ts
+++ b/src/stores/__tests__/cloudCatalogStore-studio-price.test.ts
@@ -64,6 +64,20 @@ describe('runCredits, Studio-Zweig', () => {
useCloudCatalogStore.getState().setCatalog(studioCatalog)
expect(runCredits('video', 'generate', 'wan-9', 5, 1)).toBe(8000)
})
+
+ // P9: the guard used to sit before every op branch, so a Studio-originated
+ // video reaching the gallery Lightbox's separate "Sharpen/Enhance" action
+ // (Lightbox.tsx: runCredits('video', 'upscale', item.model, ...)) fell
+ // through to the caller's fallback too, hiding the real per-second
+ // WaveSpeed rate for a wholly unrelated endpoint. The guard now sits only
+ // in front of the generic model-credits branch it was written to protect;
+ // 'upscale'/'eraser'/'removebg'/'music' price from the flat `ops` table or
+ // their own per_s/base fields, never from a Studio model's own formula, so
+ // they must stay reachable even for a quote_required model.
+ it('a Studio-originated video still prices the classic video-upscale enhance action', () => {
+ useCloudCatalogStore.getState().setCatalog(studioCatalog)
+ expect(runCredits('video', 'upscale', 'preset-horror', 8, 777_777)).toBe(4000)
+ })
})
describe('runCredits, by_duration', () => {
diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.ts
index 8a7c5ba0..93ab7590 100644
--- a/src/stores/cloudCatalogStore.ts
+++ b/src/stores/cloudCatalogStore.ts
@@ -181,15 +181,6 @@ export function runCredits(
fallback: number,
resolution?: string,
): number {
- // P3, Studio-Zweig: a Studio model (`quote_required` on the catalog entry)
- // prices live from POST /api/jobs/studio-quote, see studio.ts and
- // studio-contract.ts's own `studioCredits()` formula, which is a PREVIEW,
- // not this function's job. Computing anything below for one would drift
- // from the provider's real price the moment it changes there, and a run
- // must never book a different number than what got shown, so this guard
- // sits before every other branch and returns the caller's own fallback
- // instead of guessing (Portplan Abschnitt 7, Risiko 1).
- if (cloudModelById(pickedModel)?.quote_required) return fallback
const { ops } = useCloudCatalogStore.getState()
// Music bills per second: catalog per_s × the requested duration (60 s
// default, mirroring the server's MUSIC_SECONDS fallback).
@@ -211,7 +202,32 @@ export function runCredits(
return rate ?? fallback
}
const model = modelForOp(kind, op, pickedModel)
- const credits = cloudModelById(model)?.credits
+ const entry = cloudModelById(model)
+ // P3, Studio-Zweig (P9 rescoped): a Studio model (`quote_required` on the
+ // catalog entry) prices its OWN generation run live from POST
+ // /api/jobs/studio-quote, see studio.ts and studio-contract.ts's own
+ // `studioCredits()` formula, which is a PREVIEW, not this function's job.
+ // Computing this generic base/long/by_duration figure for a Studio
+ // generation would drift from the provider's real price the moment it
+ // changes there, and a run must never book a different number than what
+ // got shown (Portplan Abschnitt 7, Risiko 1) — no UI path does this today
+ // (Composer/CreditsMeter route a Studio pick around runCredits entirely,
+ // preset-models.ts/create-presets.ts only call runCredits for non-studio
+ // steps), this guard is the safety net for the day one of them slips.
+ //
+ // The guard sits HERE, not before the op branches above, on purpose: a
+ // Studio-originated video can still reach the generic video-upscale
+ // 'enhance' action from the gallery Lightbox — a wholly separate WaveSpeed
+ // utility endpoint, priced from the flat per-second `ops` rate table, not
+ // from this model's own Studio price. Blocking that call too (the
+ // original, wider guard did) forced the enhance-credits gate onto the
+ // quota's generic per-kind fallback for every Studio-originated clip,
+ // silently hiding the real per-second rate. Scoping the guard to only the
+ // generic-model-credits branch below fixes that and is what actually makes
+ // Lightbox's `runCredits('video', 'upscale', item.model, ...)` call
+ // correct for a Studio clip.
+ if (entry?.quote_required) return fallback
+ const credits = entry?.credits
if (!credits) return fallback
// P3, by_duration: dd29f359 lets a video model book any advertised length,
// not just the short/long pair; an exact catalog price for the requested