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): ein Character-Bereich nach den Skizzen v2 (3.1.0 Teil B)

purplea2b56974bf61
diff --git a/e2e/character-hub.spec.ts b/e2e/character-hub.spec.ts
new file mode 100644
index 00000000..7da4ad86
--- /dev/null
+++ b/e2e/character-hub.spec.ts
@@ -0,0 +1,380 @@
+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 } from './support/cloud-mock'
+import { characterPill, openCharacterHub } from './support/character-hub'
+
+/**
+ * The Character area of Create (3.1.0 part B, David's sketches v2): one pill
+ * "Character" instead of Character, Motion, Lipsync and Swap. Step 1 Who?
+ * (every character), step 2 What? (Image, Swap, Motion, Talk with their
+ * price), step 3 the panel. The head line switches character and action.
+ * Swap, the sound choice and the lip sync step need the account switch of
+ * the server (features.characterHub); without it Swap says "Coming soon".
+ *
+ * Tauri stubbed, cloud mocked, Create is never pressed. LU_HUB_SHOTS_DIR,
+ * when set, receives the screens in the dark and the light theme, at 1296
+ * and at 375 px; LU_HUB_MEDIA_DIR brings real pictures and clips (clip.webm,
+ * podcast.webm, mr-bean.png, sam-altman.png, oma.png, frame-new.jpg).
+ */
+
+const PNG_1PX = Buffer.from(
+ 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==',
+ 'base64',
+)
+
+const SWAP_CATALOG = [
+ ['scail-2', 'SCAIL 2'],
+ ['kling-v3-pro-motion-control', 'Kling 3.0 Pro • Motion Control'],
+ ['openjutsu-character-swap', 'OpenJutsu Character Swap'],
+ ['wan-2.2-animate-replace', 'Wan 2.2 Animate Replace'],
+].map(([id, label]) => ({ id, label, kind: 'video', ops: ['studio'], quote_required: true, t2v: false, i2v: false }))
+ .concat([{ id: 'nano-banana-pro-edit', label: 'Nano Banana Pro', kind: 'image', ops: ['studio'], quote_required: true, t2v: false, i2v: false }])
+ .concat([{ id: 'flux-dev-lora-ultra-fast', label: 'Flux Dev LoRA', kind: 'image', lora: true, credits: { base: 3000 } } as never])
+ .concat([{
+ id: 'latentsync', label: 'LatentSync', kind: 'video', ops: ['lipsync'], quote_required: false, t2v: false, i2v: false,
+ credits: { base: 9000, length: { basis: 'audio', block: 1, per_block: 3000, min: 3, max: 300, quote: 10 } },
+ } as never])
+
+const LORAS = [
+ { id: '11111111-1111-4111-8111-111111111111', name: 'Bean', trigger_word: 'beanchar', base_family: 'flux', created_at: '2026-11-01T10:00:00Z', source: 'trained', preview_url: null, base_url: 'https://lu-labs.ai/e2e/char/mr-bean.png' },
+ { id: '22222222-2222-4222-8222-222222222222', name: 'Mila', trigger_word: 'milachar', base_family: 'qwen-image', created_at: '2026-11-02T10:00:00Z', source: 'trained', preview_url: null, base_url: null },
+]
+
+const CORS = { 'access-control-allow-origin': '*', 'access-control-allow-headers': '*', 'access-control-allow-methods': 'GET,POST,OPTIONS' }
+
+async function media(name: string, mimeType: string) {
+ const dir = process.env.LU_HUB_MEDIA_DIR
+ if (dir) {
+ const { readFileSync, existsSync } = await import('node:fs')
+ if (existsSync(`${dir}/${name}`)) return { name, mimeType, buffer: readFileSync(`${dir}/${name}`) }
+ }
+ return { name, mimeType, buffer: PNG_1PX }
+}
+
+/** A short clip the WebView can decode: a real one from the media folder,
+ * else one recorded from a canvas in the page. */
+async function clip(page: Page, file: string, shownAs: string) {
+ const dir = process.env.LU_HUB_MEDIA_DIR
+ if (dir) {
+ const { readFileSync, existsSync } = await import('node:fs')
+ if (existsSync(`${dir}/${file}`)) return { name: shownAs, mimeType: 'video/webm', buffer: readFileSync(`${dir}/${file}`) }
+ }
+ const b64 = await page.evaluate(async () => {
+ const canvas = document.createElement('canvas')
+ canvas.width = 320; canvas.height = 180
+ const ctx = canvas.getContext('2d')!
+ const paint = (t: number) => {
+ ctx.fillStyle = '#d8d4cc'; ctx.fillRect(0, 0, 320, 180)
+ ctx.fillStyle = '#6b4f3a'; ctx.beginPath(); ctx.arc(120 + t, 70, 28, 0, Math.PI * 2); ctx.fill()
+ ctx.fillStyle = '#2f2a28'; ctx.beginPath(); ctx.arc(215 - t, 76, 28, 0, Math.PI * 2); ctx.fill()
+ }
+ paint(0)
+ const rec = new MediaRecorder(canvas.captureStream(15), { mimeType: 'video/webm' })
+ const parts: Blob[] = []
+ rec.ondataavailable = (e) => parts.push(e.data)
+ const done = new Promise<void>((r) => { rec.onstop = () => r() })
+ rec.start()
+ for (let i = 0; i < 12; i++) { paint(i); await new Promise((r) => setTimeout(r, 60)) }
+ rec.stop()
+ await done
+ const bytes = new Uint8Array(await new Blob(parts, { type: 'video/webm' }).arrayBuffer())
+ let bin = ''
+ for (const x of bytes) bin += String.fromCharCode(x)
+ return btoa(bin)
+ })
+ return { name: shownAs, mimeType: 'video/webm', buffer: Buffer.from(b64, 'base64') }
+}
+
+interface Boot { hub: boolean; width?: number; height?: number; mock?: Partial<TauriMockOptions>; local?: boolean }
+
+async function boot(page: Page, { hub, width = 1296, height = 900, mock = {}, local = false }: Boot): Promise<{ submits: unknown[] }> {
+ const narrow = width < 600 ? { width, height } : null
+ await page.setViewportSize(narrow ? { width: 1296, height: 900 } : { width, height })
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, ...mock })
+ await seedOnboardingDone(page)
+ await routeCloud(page, { license: 'active', access: true, mediaLive: true, extraCatalogModels: SWAP_CATALOG, characterHub: hub, loras: LORAS })
+ const seen = { submits: [] as unknown[] }
+ const pictures: Record<string, string> = { 'mr-bean.png': 'image/png' }
+ await page.route('https://lu-labs.ai/**', async (route) => {
+ const req = route.request()
+ const path = new URL(req.url()).pathname
+ if (req.method() === 'OPTIONS') return route.fallback()
+ // Nothing may book: any submit is recorded and refused.
+ if (path === '/api/jobs' && req.method() === 'POST') {
+ seen.submits.push(req.postDataJSON())
+ return route.fulfill({ status: 400, headers: { ...CORS, 'content-type': 'application/json' }, body: JSON.stringify({ error: 'e2e: no runs' }) })
+ }
+ const pic = /^\/e2e\/char\/(.+)$/.exec(path)?.[1]
+ if (pic && pictures[pic]) {
+ const m = await media(pic, pictures[pic])
+ return route.fulfill({ status: 200, headers: { ...CORS, 'content-type': m.mimeType }, body: m.buffer })
+ }
+ return route.fallback()
+ })
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
+ if (!local) {
+ await signInViaGate(page)
+ await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
+ }
+ await page.getByRole('button', { name: /^Create$/ }).click()
+ // A phone-wide window: the app is opened wide (its head folds its tabs into
+ // the menu there), then the window narrows.
+ if (narrow) await page.setViewportSize({ width: narrow.width, height: narrow.height })
+ return seen
+}
+
+async function shoot(page: Page, name: string, focus?: string) {
+ const dir = process.env.LU_HUB_SHOTS_DIR
+ if (!dir) return
+ // The area from its top, as the sketches show it.
+ await page.locator('[data-character-hub] .overflow-y-auto').first().evaluate((el) => { el.scrollTop = 0 }).catch(() => undefined)
+ if (focus) await page.locator(focus).first().evaluate((el) => el.scrollIntoView({ block: 'end' }))
+ for (const theme of ['dark', 'light'] as const) {
+ await page.evaluate((t) => {
+ document.documentElement.classList.toggle('dark', t === 'dark')
+ document.documentElement.classList.toggle('light', t === 'light')
+ }, theme)
+ await page.waitForTimeout(300)
+ await page.screenshot({ path: `${dir}/desktop-hub-v2-${name}-${theme}.png` })
+ }
+ await page.evaluate(() => {
+ document.documentElement.classList.add('dark')
+ document.documentElement.classList.remove('light')
+ })
+}
+
+/** Two saved photo characters, made the way a customer makes them. */
+async function savePhotoCharacter(page: Page, name: string, file: string, copies: number) {
+ const photo = await media(file, 'image/png')
+ await page.locator('input[aria-label="Upload photos or a LoRA file"]').setInputFiles(
+ Array.from({ length: copies }, (_, i) => ({ ...photo, name: `${name}-${i + 1}.png` })),
+ )
+ await page.getByRole('textbox', { name: 'Name of the new character' }).fill(name)
+ await page.getByRole('button', { name: 'Save', exact: true }).click()
+ await expect(page.locator(`[data-hub-character^="saved:"]`, { hasText: name })).toBeVisible()
+}
+
+/** A tap on the first frame at a share of its width and height. */
+async function tapFrame(page: Page, x: number, y: number) {
+ const frame = page.getByRole('group', { name: /First frame of your video/ })
+ const box = await frame.boundingBox()
+ if (!box) throw new Error('first frame not on screen')
+ await frame.click({ position: { x: box.width * x, y: box.height * y } })
+}
+
+test('one pill, three steps: who, what, the panel, and the head line switches both', async ({ page }) => {
+ const seen = await boot(page, { hub: true })
+
+ // The four old pills are one now, marked new.
+ await expect(characterPill(page)).toBeVisible()
+ await expect(characterPill(page)).toContainText('NEW')
+ for (const old of ['Motion Control', 'Talking Character', 'Swap Character', 'Character Studio']) {
+ await expect(page.getByRole('radio', { name: old, exact: true })).toHaveCount(0)
+ }
+
+ // Step 1: every source in one list, rows with their meta.
+ await openCharacterHub(page)
+ const hub = page.locator('[data-character-hub]')
+ await expect(hub).toHaveAttribute('data-character-hub', 'who')
+ await expect(page.locator('[data-hub-character="cloud:11111111-1111-4111-8111-111111111111"]')).toContainText('Trained · Flux')
+ await expect(page.locator('[data-hub-character="cloud:22222222-2222-4222-8222-222222222222"]')).toContainText('Trained · Qwen')
+ await savePhotoCharacter(page, 'Sam', 'sam-altman.png', 12)
+ await savePhotoCharacter(page, 'Oma', 'oma.png', 8)
+ await expect(page.locator('[data-hub-character^="saved:"]', { hasText: 'Sam' })).toContainText('Photos · 12')
+ await expect(page.locator('[data-hub-new]')).toHaveText(/Train from photos\s*·\s*Upload photos or LoRA\s*·\s*From my gallery/)
+ await expect(page.getByRole('button', { name: 'Just use a photo' })).toBeVisible()
+ await shoot(page, 'a-wer')
+
+ // Step 2: what Bean should do, with the catalogue's prices.
+ await page.locator('[data-hub-character^="cloud:1111"]').click()
+ await expect(hub).toHaveAttribute('data-character-hub', 'what')
+ await expect(page.getByText('What should Bean do?')).toBeVisible()
+ await expect(page.locator('[data-hub-action="swap"] [data-hub-action-meta]')).toHaveText('8k / s')
+ await expect(page.locator('[data-hub-action="image"] [data-hub-action-meta]')).toContainText('from 3k')
+ await shoot(page, 'b-was')
+
+ // Step 3: Swap, Bean on person 1.
+ await page.getByRole('radio', { name: 'Swap Character', exact: true }).click()
+ await expect(hub).toHaveAttribute('data-character-hub', 'panel')
+ await expect(page.locator('[data-swap-controls]')).toBeVisible()
+ await expect(page.getByRole('button', { name: 'Character for person 1' })).toContainText('Bean')
+ await page.locator('[data-swap-controls] input[type=file][accept^="video"]').setInputFiles(await clip(page, 'clip.webm', 'clip.mp4'))
+ await expect(page.locator('[data-hub-clip]')).toContainText('clip.mp4')
+ await expect(page.getByRole('group', { name: /First frame of your video/ })).toBeVisible({ timeout: 20_000 })
+ await tapFrame(page, 0.45, 0.33)
+ await tapFrame(page, 0.66, 0.36)
+ await expect(page.getByRole('textbox', { name: 'Who person 1 replaces' })).toHaveAttribute('placeholder', 'the person on the left')
+ await expect(page.getByRole('textbox', { name: 'Who person 2 replaces' })).toHaveAttribute('placeholder', 'the person on the right')
+ // Person 2 becomes Sam, from the list.
+ await page.getByRole('button', { name: 'Character for person 2' }).click()
+ await page.getByRole('option', { name: /^Sam/ }).click()
+ await expect(page.getByRole('button', { name: 'Character for person 2' })).toContainText('Sam')
+ // The sound: original by default, lip sync only for one person.
+ await expect(page.getByRole('radio', { name: 'Original sound' })).toHaveAttribute('aria-checked', 'true')
+ await expect(page.getByRole('radio', { name: 'New voice, lips in sync' })).toBeDisabled()
+ await page.getByRole('checkbox').check()
+ // The bar: model, length, price with its parts.
+ await expect(page.getByRole('button', { name: 'Length' })).toContainText('6 s')
+ await expect(page.locator('[data-clip-price]')).toContainText('62k')
+ await expect(page.locator('[data-clip-split]')).toContainText('frame 14k + video 48k')
+ await shoot(page, 'c-swap')
+
+ // The head line: another action keeps the character.
+ await page.getByRole('button', { name: 'Action' }).click()
+ await page.getByRole('option', { name: /^Motion/ }).click()
+ await expect(page.locator('[data-motion-controls]')).toBeVisible()
+ await expect(page.locator('[data-portrait-line]')).toContainText('Bean', { timeout: 15_000 })
+ // The video of Swap came along; the head line's X takes it away.
+ await expect(page.locator('[data-hub-clip]')).toContainText('clip.mp4')
+ await page.getByRole('button', { name: 'Remove the video' }).click()
+ await page.locator('[data-motion-controls] input[type=file][accept^="video"]').setInputFiles(await clip(page, 'podcast.webm', 'podcast.mp4'))
+ await expect(page.locator('[data-hub-clip]')).toContainText('podcast.mp4')
+ await expect(page.locator('[data-sound-controls=motion]')).toBeVisible()
+ // Another character from the head line takes the portrait's place.
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await page.getByRole('option', { name: /^Sam/ }).click()
+ await expect(page.locator('[data-portrait-line]')).toContainText('Sam', { timeout: 15_000 })
+ await shoot(page, 'e-motion')
+
+ // Talk, then back to the list.
+ await page.getByRole('button', { name: 'Action' }).click()
+ await page.getByRole('option', { name: /^Talk/ }).click()
+ await expect(page.locator('[data-talk-controls]')).toBeVisible()
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await page.getByRole('option', { name: 'All characters…' }).click()
+ await expect(hub).toHaveAttribute('data-character-hub', 'who')
+
+ // The pill goes back to the action that was open.
+ await page.getByRole('radio', { name: /^Image$/ }).click()
+ await expect(hub).toHaveCount(0)
+ await characterPill(page).click()
+ await expect(hub).toHaveAttribute('data-character-hub', 'panel')
+ await expect(page.locator('[data-talk-controls]')).toBeVisible()
+
+ expect(seen.submits).toHaveLength(0)
+})
+
+test('Image runs on the character, More options keeps its file actions', async ({ page }) => {
+ await boot(page, { hub: true })
+ await openCharacterHub(page)
+ await page.locator('[data-hub-character^="cloud:1111"]').click()
+ await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await expect(page.getByTestId('character-use-hint')).toContainText('beanchar')
+ // The prompt sits in the bar, like the chat's composer.
+ await expect(page.getByPlaceholder('Describe the scene for your character…')).toBeVisible()
+ await page.getByRole('button', { name: 'More options' }).click()
+ await expect(page.locator('[data-character-file-actions]')).toBeVisible()
+ await expect(page.getByTestId('character-download')).toBeVisible()
+})
+
+test('without the account switch: Swap says coming soon, Motion has no sound choice', async ({ page }) => {
+ const seen = await boot(page, { hub: false })
+ await openCharacterHub(page)
+ await page.getByRole('button', { name: 'Just use a photo' }).click()
+ await expect(page.locator('[data-hub-action="swap"] [data-hub-action-meta]')).toHaveText('Coming soon to your LU Cloud')
+ await shoot(page, 'ohne-schalter-b')
+ await page.getByRole('radio', { name: 'Swap Character', exact: true }).click()
+ await expect(page.locator('[data-swap-unavailable="soon"]')).toHaveText('Coming soon to your LU Cloud')
+ await expect(page.locator('[data-swap-controls]')).toHaveCount(0)
+ await expect(page.getByRole('button', { name: /^Create/ }).last()).toBeDisabled()
+ await shoot(page, 'ohne-schalter-swap')
+ await page.getByRole('button', { name: 'Action' }).click()
+ await page.getByRole('option', { name: /^Motion/ }).click()
+ await expect(page.locator('[data-motion-controls]')).toBeVisible()
+ await expect(page.locator('[data-sound-controls]')).toHaveCount(0)
+ expect(seen.submits).toHaveLength(0)
+})
+
+test('with the switch: the frame step and its check stay as they were', async ({ page }) => {
+ await boot(page, { hub: true })
+ // The built frame of the frame step, from the mock (no booking).
+ const frameNew = await media('frame-new.jpg', 'image/jpeg')
+ let frames = 0
+ await page.route('https://lu-labs.ai/**', async (route) => {
+ const req = route.request()
+ const path = new URL(req.url()).pathname
+ const json = (body: unknown, status = 200) => route.fulfill({ status, headers: { ...CORS, 'content-type': 'application/json' }, body: JSON.stringify(body) })
+ if (path === '/api/jobs/upload' && req.method() === 'POST') return json({ path: `e2e-user-1/staged-${Date.now()}.bin` })
+ if (path === '/api/jobs' && req.method() === 'POST') {
+ const body = req.postDataJSON() as { params?: { swap_step?: string } }
+ if (body.params?.swap_step !== 'frame') return json({ error: 'e2e: only the frame step is mocked' }, 400)
+ frames++
+ return json({ id: `job-frame-${frames}`, status: 'queued', created_at: new Date().toISOString(), quota: { kind: 'image', cost: 14000, used: 0, limit: 2_550_000 } }, 202)
+ }
+ const job = /^\/api\/jobs\/(job-frame-\d+)$/.exec(path)
+ if (job) {
+ return json({ job: { id: job[1], kind: 'image', model: 'nano-banana-pro-edit', provider: 'upstream', status: 'succeeded', result_url: `https://lu-labs.ai/e2e/${job[1]}.jpg`, attestation: null, cost_units: 14000, created_at: new Date().toISOString(), completed_at: new Date().toISOString(), error: null } })
+ }
+ if (/^\/e2e\/job-frame-\d+\.jpg$/.test(path)) return route.fulfill({ status: 200, headers: { ...CORS, 'content-type': frameNew.mimeType }, body: frameNew.buffer })
+ return route.fallback()
+ })
+ await openCharacterHub(page)
+ await page.locator('[data-hub-character^="cloud:1111"]').click()
+ await page.getByRole('radio', { name: 'Swap Character', exact: true }).click()
+ await page.locator('[data-swap-controls] input[type=file][accept^="video"]').setInputFiles(await clip(page, 'clip.webm', 'clip.mp4'))
+ await expect(page.getByRole('group', { name: /First frame of your video/ })).toBeVisible({ timeout: 20_000 })
+ await tapFrame(page, 0.45, 0.33)
+ await page.getByRole('checkbox').check()
+ await page.getByRole('button', { name: /Build first frame/ }).click()
+ await expect(page.getByText('Does this look right?')).toBeVisible({ timeout: 20_000 })
+ await shoot(page, 'd-swap-pruefen', '[data-swap-built]')
+ await page.getByRole('button', { name: /Continue/ }).click()
+ await expect(page.getByRole('button', { name: /^Create · / }).last()).toBeEnabled({ timeout: 15_000 })
+ expect(frames).toBe(1)
+})
+
+test('local mode: Swap is locked to the cloud, the local lanes are there', async ({ page }) => {
+ await boot(page, { hub: true, local: true, mock: { platform: 'mac', mlx: { ltx2EngineInstalled: true, installedVideos: ['ltx-2.3-q4', 'ltx-2.3-motion-control'], loras: [{ name: 'char_opa_zimage.safetensors' }] } } })
+ await openCharacterHub(page)
+ await expect(page.locator('[data-hub-character="mlx:char_opa_zimage.safetensors"]')).toContainText('Local LoRA', { timeout: 15_000 })
+ await page.locator('[data-hub-character="mlx:char_opa_zimage.safetensors"]').click()
+ await expect(page.getByRole('radio', { name: 'Swap Character, runs on LU Cloud' })).toBeVisible()
+ await expect(page.locator('[data-hub-action="motion"] [data-hub-action-meta]')).toContainText('Local')
+ await shoot(page, 'lokal-b')
+ await page.getByRole('radio', { name: 'Swap Character, runs on LU Cloud' }).click()
+ await expect(page.getByRole('dialog')).toBeVisible()
+ await page.keyboard.press('Escape')
+ await expect(page.getByRole('dialog')).toHaveCount(0)
+ // Motion runs on this Mac: the LTX-2.3 pack, no sound choice.
+ await page.getByRole('radio', { name: 'Motion Control', exact: true }).click()
+ await expect(page.locator('[data-motion-controls]')).toBeVisible()
+ await expect(page.locator('[data-sound-controls]')).toHaveCount(0)
+ await shoot(page, 'lokal-e-motion')
+})
+
+test('reuse: a training handed over from the gallery opens the area on Train', async ({ page }) => {
+ await boot(page, { hub: true })
+ // The way of SaveCharacterModal and the chat: setIntent('character') with
+ // the training tab. Here through the area's own link.
+ await openCharacterHub(page)
+ await page.getByRole('button', { name: 'Train from photos' }).click()
+ const hub = page.locator('[data-character-hub]')
+ await expect(hub).toHaveAttribute('data-character-hub', 'panel')
+ await expect(page.locator('[data-hub-head]')).toContainText('New character')
+ await expect(page.locator('[data-hub-head]')).toContainText('Train')
+ await expect(characterPill(page)).toHaveAttribute('aria-checked', 'true')
+})
+
+test('phone width: the same steps, the bar in its short form', async ({ page }) => {
+ await boot(page, { hub: true, width: 375, height: 812 })
+ await openCharacterHub(page)
+ await shoot(page, 'handy-a-wer')
+ await page.locator('[data-hub-character^="cloud:1111"]').click()
+ await shoot(page, 'handy-b-was')
+ await page.getByRole('radio', { name: 'Swap Character', exact: true }).click()
+ await page.locator('[data-swap-controls] input[type=file][accept^="video"]').setInputFiles(await clip(page, 'clip.webm', 'clip.mp4'))
+ await expect(page.getByRole('group', { name: /First frame of your video/ })).toBeVisible({ timeout: 20_000 })
+ await tapFrame(page, 0.45, 0.33)
+ await tapFrame(page, 0.66, 0.36)
+ await page.getByRole('checkbox').check()
+ await expect(page.locator('[data-hub-bar-summary]')).toContainText('SCAIL 2 · 6 s')
+ await shoot(page, 'handy-c-swap')
+ await page.locator('[data-hub-bar-summary]').click()
+ await expect(page.locator('[data-hub-bar-options]')).toBeVisible()
+ await page.locator('[data-hub-bar-summary]').click()
+ await page.getByRole('button', { name: 'Action' }).click()
+ await page.getByRole('option', { name: /^Motion/ }).click()
+ await expect(page.locator('[data-motion-controls]')).toBeVisible()
+ await shoot(page, 'handy-e-motion')
+})
diff --git a/e2e/cloud-character-download.spec.ts b/e2e/cloud-character-download.spec.ts
index 08008e67..e1b59c5f 100644
--- a/e2e/cloud-character-download.spec.ts
+++ b/e2e/cloud-character-download.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { openCharacterHub } from './support/character-hub'
/**
* A trained cloud character can be saved as a file (10.10.2026).
@@ -77,9 +78,13 @@ async function boot(page: Page, answer: Answer) {
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: /Character Studio/i }).click()
- await page.getByRole('radio', { name: 'Use character' }).click()
- await expect(page.getByText('Anna Müller')).toBeVisible({ timeout: 15_000 })
+ // The Character area: the character in step 1, Image in step 2, its file
+ // actions under More options.
+ await openCharacterHub(page)
+ await page.getByRole('button', { name: /Anna Müller/ }).click({ timeout: 15_000 })
+ await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await page.getByRole('button', { name: 'More options' }).click()
+ await expect(page.locator('[data-character-file-actions]')).toContainText('Anna Müller', { timeout: 15_000 })
return { fileAsked: () => fileAsked }
}
diff --git a/e2e/cloud-create.spec.ts b/e2e/cloud-create.spec.ts
index 59c75167..29a7e381 100644
--- a/e2e/cloud-create.spec.ts
+++ b/e2e/cloud-create.spec.ts
@@ -113,7 +113,8 @@ test('local mode: local lanes usable, cloud-only ops shown as locked teasers', a
// Character Studio joined the local lanes in 2.6.0 (musubi trainer ships
// in trainer.rs), so it renders as a plain selectable tab now.
- await expect(page.getByRole('radio', { name: 'Character Studio', exact: true })).toBeVisible()
+ // Since 3.1.0 part B it is the Character area, one pill for four tabs.
+ await expect(page.getByRole('radiogroup', { name: 'Create mode' }).getByRole('radio', { name: 'Character', exact: true })).toBeVisible()
// Enhance Image runs on local ComfyUI on Windows and Linux since 3.0.7
// (Discord wish D10), so it is a plain local tab here, not a teaser.
diff --git a/e2e/create-length-price.spec.ts b/e2e/create-length-price.spec.ts
index 13c57a5f..e06f7367 100644
--- a/e2e/create-length-price.spec.ts
+++ b/e2e/create-length-price.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { openCharacterAction } from './support/character-hub'
/**
* Billing by length in the Create tab (3.0.6).
@@ -25,7 +26,7 @@ async function boot(page: Page, lengthCatalog: boolean) {
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: /Talking Character/i }).click()
+ await openCharacterAction(page, 'Talking Character')
await page.getByRole('button', { name: /Add voice/ }).click()
await page.getByRole('button', { name: /Generate a voice/ }).click()
}
diff --git a/e2e/create-save-character.spec.ts b/e2e/create-save-character.spec.ts
index 48bc89ae..474a2754 100644
--- a/e2e/create-save-character.spec.ts
+++ b/e2e/create-save-character.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { characterPill, openCharacterTraining } from './support/character-hub'
/**
* "Use frames for a character" (Discord): frames taken evenly across a
@@ -86,7 +87,8 @@ test('frames across a video become a saved character that survives a reload', as
// Hand the photos to Character Studio: they start the training set.
await dialog.getByRole('button', { name: 'Train in Character Studio' }).click()
await expect(dialog).toHaveCount(0)
- await expect(page.getByRole('radio', { name: /Character Studio/i })).toBeChecked()
+ await expect(characterPill(page)).toBeChecked()
+ await expect(page.locator('[data-hub-head]')).toContainText('Train')
await expect(page.getByText(/^4\/30 photos\./)).toBeVisible()
// After a reload the character is still there (the boot script puts the app
@@ -95,7 +97,7 @@ test('frames across a video become a saved character that survives a reload', as
await page.reload()
await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await openCharacterTraining(page)
const chip = page.getByTitle('Add the 4 photos of Sir Aldous')
await expect(chip).toBeVisible({ timeout: 15_000 })
await chip.click()
@@ -114,6 +116,6 @@ test('the lightbox of a video offers the same action, straight into a training s
await dialog.getByRole('button', { name: 'Untick frame 1' }).click()
await dialog.getByRole('button', { name: 'Train with 7 frames' }).click()
await expect(dialog).toHaveCount(0)
- await expect(page.getByRole('radio', { name: /Character Studio/i })).toBeChecked()
+ await expect(characterPill(page)).toBeChecked()
await expect(page.getByText(/^7\/30 photos\./)).toBeVisible()
})
diff --git a/e2e/create-studio.spec.ts b/e2e/create-studio.spec.ts
index 3cd36830..cb9b3af6 100644
--- a/e2e/create-studio.spec.ts
+++ b/e2e/create-studio.spec.ts
@@ -1,6 +1,7 @@
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'
+import { openCharacterAction } from './support/character-hub'
/**
* P9 Integration: das Studio auf der Wolken-Spur, und sein Fehlen ueberall
@@ -185,7 +186,7 @@ test('an older server (no quote_required): Extend and Motion behave exactly as b
// with no local engine mocked, hence checking the TEXT, not alert count.)
await expect(page.getByText('This feature needs a newer LU Cloud server')).toHaveCount(0)
- await page.getByRole('radio', { name: 'Motion Control' }).click()
+ await openCharacterAction(page, 'Motion Control')
await expect(page.getByRole('button', { name: /Wan 2\.2 Animate/ })).toBeVisible({ timeout: 15_000 })
await expect(page.getByText('This feature needs a newer LU Cloud server')).toHaveCount(0)
diff --git a/e2e/local-train-base.spec.ts b/e2e/local-train-base.spec.ts
index d644055c..d99527d7 100644
--- a/e2e/local-train-base.spec.ts
+++ b/e2e/local-train-base.spec.ts
@@ -1,6 +1,7 @@
import { test, expect } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { seedOnboardingDone } from './support/cloud-mock'
+import { openCharacterAction, openCharacterTraining } from './support/character-hub'
/**
* GH #210 (31.10.2026, Linux, 3.0.8): on Train new the model chip still listed
@@ -21,14 +22,13 @@ test('Windows, Train new: the chip says local training uses Z-Image, Use charact
})
await page.goto('/')
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
- await page.getByRole('radio', { name: 'Train new' }).click()
+ await openCharacterTraining(page)
const chip = page.getByTestId('local-train-base')
await expect(chip).toHaveText('Local training uses Z-Image')
await expect(chip).toHaveAttribute('title', /Training for other models is in LU Cloud/)
if (SHOTS) await page.screenshot({ path: `${SHOTS}/p8-b210-1-train-chip.png` })
- await page.getByRole('radio', { name: 'Use character' }).click()
+ await openCharacterAction(page, 'Character Studio')
await expect(page.getByTestId('local-train-base')).toHaveCount(0)
})
diff --git a/e2e/mac-character-train.spec.ts b/e2e/mac-character-train.spec.ts
index af134c62..021163c8 100644
--- a/e2e/mac-character-train.spec.ts
+++ b/e2e/mac-character-train.spec.ts
@@ -2,6 +2,7 @@ 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, cloudSwitch } from './support/cloud-mock'
import { mlxCalls, comfyCalls } from './support/recorded'
+import { openCharacterTraining } from './support/character-hub'
/**
* Character training on a Mac (src-tauri/src/commands/mlx_train.rs,
@@ -32,8 +33,7 @@ async function openTrainTab(page: Page, opts: TauriMockOptions) {
await page.goto('/')
await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
- await page.getByRole('radio', { name: 'Train new', exact: true }).click()
+ await openCharacterTraining(page)
}
async function addPhotos(page: Page, n: number) {
@@ -94,8 +94,12 @@ test('mac with Z-Image Turbo: Train new trains the character locally and it land
expect(typeof start.raw.run).toBe('string')
// Through: the tab turns to Use, and the new character is on the shelf.
- await expect(page.getByRole('radio', { name: 'Use character', exact: true })).toBeChecked({ timeout: 20_000 })
- await expect(page.getByTitle('Trigger word: luxfox')).toBeVisible({ timeout: 10_000 })
+ // In the Character area: the panel turns to Image, and the new character
+ // is in the list of the head line.
+ await expect(page.getByRole('button', { name: 'Action' })).toContainText('Image', { timeout: 20_000 })
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await expect(page.getByRole('option', { name: /^luxfox/ })).toBeVisible({ timeout: 10_000 })
+ await page.keyboard.press('Escape')
await expect(page.getByText(/Training failed/)).toHaveCount(0)
// The Windows trainer and ComfyUI are never asked.
const names = await page.evaluate(() => ((window as unknown as { __TAURI_CALLS__?: Array<{ cmd: string }> }).__TAURI_CALLS__ ?? []).map((c) => c.cmd))
@@ -157,7 +161,7 @@ test('mac: frames of a video go through Use frames for a character into the Mac
await expect(dialog).toHaveCount(0)
// They land on the Train tab of the Mac, which trains them here.
- await expect(page.getByRole('radio', { name: 'Train new', exact: true })).toBeChecked()
+ await expect(page.locator('[data-hub-head]')).toContainText('Train')
const controls = page.getByTestId('mac-train-controls')
await expect(controls).toContainText('7/100 photos', { timeout: 15_000 })
await controls.getByPlaceholder('Trigger word, e.g. davechar').fill('foxclip')
@@ -169,5 +173,8 @@ test('mac: frames of a video go through Use frames for a character into the Mac
for (const s of staged) expect(Number(s.raw.bytes)).toBeGreaterThan(100)
const [start] = await calls(page, 'mlx_train_start')
expect(start.raw).toMatchObject({ set: 'foxclip', trigger: 'foxclip' })
- await expect(page.getByTitle('Trigger word: foxclip')).toBeVisible({ timeout: 20_000 })
+ // The new character is in the list of the head line of the Character area.
+ await expect(page.getByRole('button', { name: 'Action' })).toContainText('Image', { timeout: 20_000 })
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await expect(page.getByRole('option', { name: /^foxclip/ })).toBeVisible({ timeout: 10_000 })
})
diff --git a/e2e/mac-create-mlx.spec.ts b/e2e/mac-create-mlx.spec.ts
index 2b94d059..734f528f 100644
--- a/e2e/mac-create-mlx.spec.ts
+++ b/e2e/mac-create-mlx.spec.ts
@@ -2,6 +2,7 @@ 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, cloudSwitch } from './support/cloud-mock'
import { mlxCalls, comfyCalls, hfToken, requireCall } from './support/recorded'
+import { openCharacterWhat } from './support/character-hub'
/**
* macOS local Create — the MLX path (MAC-5).
@@ -88,12 +89,19 @@ test('mac local: MLX lanes run locally, cloud-only lanes stay visible as teasers
// Music is here because this Mac has no music engine: since 14.10.2026 a
// Mac with ACE-Step 1.5 installed has a local Music tab (mac-music.spec.ts),
// one without it keeps the teaser.
- for (const label of ['Enhance Image', 'Erase Object', 'Talking Character', 'Music', 'Extend Video', 'Motion Control']) {
+ for (const label of ['Enhance Image', 'Erase Object', 'Music', 'Extend Video']) {
+ await expect(page.getByRole('radio', { name: `${label}, runs on LU Cloud` })).toBeVisible()
+ }
+ // The Character area is a local tab: "Use character" (Image) runs the
+ // LoRA from the Mac's LoRA folder through MLX. Talk and Motion are its
+ // actions and show their cloud lock there.
+ await expect(page.getByRole('radiogroup', { name: 'Create mode' }).getByRole('radio', { name: 'Character', exact: true })).toBeVisible()
+ await openCharacterWhat(page)
+ for (const label of ['Talking Character', 'Motion Control']) {
await expect(page.getByRole('radio', { name: `${label}, runs on LU Cloud` })).toBeVisible()
}
- // Character Studio is a local tab: "Use character" runs the LoRA from the
- // Mac's LoRA folder through MLX.
await expect(page.getByRole('radio', { name: 'Character Studio', exact: true })).toBeVisible()
+ await page.getByRole('radio', { name: /^Image$/ }).click()
// A locked lane opens the teaser instead of switching the lane, and on a
// Mac without the music engine the teaser offers no local Music either.
diff --git a/e2e/mac-motion.spec.ts b/e2e/mac-motion.spec.ts
index 941771b5..9a9986a8 100644
--- a/e2e/mac-motion.spec.ts
+++ b/e2e/mac-motion.spec.ts
@@ -2,6 +2,7 @@ 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, cloudSwitch } from './support/cloud-mock'
import { mlxCalls, comfyCalls, requireCall } from './support/recorded'
+import { openCharacterAction, openCharacterWhat } from './support/character-hub'
/**
* Motion Control on a Mac (3.0.8). The tab runs on an LTX-2.3 pack of the
@@ -36,7 +37,7 @@ async function bootLocalCreate(page: Page, opts: TauriMockOptions) {
test('mac motion: the tab offers its LoRA once, then the lane is ready', async ({ page }) => {
await bootLocalCreate(page, { ...MAC_OPTS, mlx: { ltx2EngineInstalled: true, installedVideos: ['ltx-2.3-q4'] } })
// A plain tab, not the cloud teaser.
- await page.getByRole('radio', { name: 'Motion Control', exact: true }).click({ timeout: 15_000 })
+ await openCharacterAction(page, 'Motion Control')
await expect(page.getByText('Local motion control needs a one-time download')).toBeVisible({ timeout: 15_000 })
await expect(page.getByText(/about 650 MB/)).toBeVisible()
await page.getByRole('button', { name: /Download & install/i }).click()
@@ -52,7 +53,7 @@ test('mac motion: the tab offers its LoRA once, then the lane is ready', async (
test('mac motion: a run stages the image and the motion video and starts the LTX pack with both', async ({ page }) => {
await bootLocalCreate(page, { ...MAC_OPTS, mlx: { ltx2EngineInstalled: true, installedVideos: ['ltx-2.3-q4', 'ltx-2.3-motion-control'] } })
- await page.getByRole('radio', { name: 'Motion Control', exact: true }).click({ timeout: 15_000 })
+ await openCharacterAction(page, 'Motion Control')
await expect(page.getByText('Add driving video (dance/pose)')).toBeVisible({ timeout: 15_000 })
// The length follows the pack: 49 frames at 24 a second.
await expect(page.getByTestId('mac-video-length')).toContainText('49 frames')
@@ -78,6 +79,7 @@ test('mac motion: a run stages the image and the motion video and starts the LTX
test('mac motion: without an LTX-2.3 pack the tab stays the cloud teaser', async ({ page }) => {
await bootLocalCreate(page, { ...MAC_OPTS, mlx: { ltx2EngineInstalled: true, installedVideos: ['ltx-2.5-q4'] } })
+ await openCharacterWhat(page)
await expect(page.getByRole('radio', { name: 'Motion Control, runs on LU Cloud' })).toBeVisible({ timeout: 15_000 })
await expect(page.getByRole('radio', { name: 'Motion Control', exact: true })).toHaveCount(0)
})
diff --git a/e2e/mac-talking.spec.ts b/e2e/mac-talking.spec.ts
index 842b5093..2e594465 100644
--- a/e2e/mac-talking.spec.ts
+++ b/e2e/mac-talking.spec.ts
@@ -2,6 +2,7 @@ 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, cloudSwitch } from './support/cloud-mock'
import { mlxCalls, comfyCalls, requireCall } from './support/recorded'
+import { openCharacterAction, openCharacterWhat } from './support/character-hub'
/**
* Talking Character on a Mac (3.0.8): LTX-2.3 4-bit turns a portrait and a
@@ -54,12 +55,14 @@ async function bootLocalCreate(page: Page, opts: TauriMockOptions) {
test('mac local: without LTX-2.3 4-bit Talking Character stays the cloud teaser', async ({ page }) => {
await bootLocalCreate(page, { ...MAC_OPTS, mlx: { installedVideos: ['wan21-t2v-1.3b'] } })
+ await openCharacterWhat(page)
await expect(page.getByRole('radio', { name: 'Talking Character, runs on LU Cloud' })).toBeVisible({ timeout: 15_000 })
await expect(page.getByRole('radio', { name: 'Talking Character', exact: true })).toHaveCount(0)
})
test('mac local: Talking Character offers its own download and runs it on the video slot', async ({ page }) => {
await bootLocalCreate(page, { ...MAC_OPTS, mlx: { ltx2EngineInstalled: true, installedVideos: ['ltx-2.3-q4'] } })
+ await openCharacterWhat(page)
const tab = page.getByRole('radio', { name: 'Talking Character', exact: true })
await expect(tab).toBeVisible({ timeout: 15_000 })
await tab.click()
@@ -84,7 +87,7 @@ test('mac local: a portrait and a voice go to the a2v run of LTX-2.3 4-bit, neve
...MAC_OPTS,
mlx: { ltx2EngineInstalled: true, installedVideos: ['wan21-t2v-1.3b', 'ltx-2.3-q4'], talkingVideos: ['ltx-2.3-q4'] },
})
- await page.getByRole('radio', { name: 'Talking Character', exact: true }).click({ timeout: 15_000 })
+ await openCharacterAction(page, 'Talking Character')
await expect(page.getByTestId('mac-talking-part')).toHaveCount(0)
// No prompt field on this tab, and no clip to resync: a portrait and a voice.
await expect(page.getByText('Add portrait')).toBeVisible()
diff --git a/e2e/style-train.spec.ts b/e2e/style-train.spec.ts
index a9f2e06b..84325b0d 100644
--- a/e2e/style-train.spec.ts
+++ b/e2e/style-train.spec.ts
@@ -4,6 +4,7 @@ import { join } from 'node:path'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME, type TauriMockOptions } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, cloudSwitch } from './support/cloud-mock'
import { mlxCalls } from './support/recorded'
+import { openCharacterAction, openCharacterTraining } from './support/character-hub'
/**
* 3.0.9 P8 (Discord, 28.10.2026: "can the built-in trainer do styles,
@@ -52,8 +53,7 @@ async function openTrainTab(page: Page) {
await page.goto('/')
await expect(cloudSwitch(page)).toBeVisible({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
- await page.getByRole('radio', { name: 'Train new', exact: true }).click()
+ await openCharacterTraining(page)
}
const calls = async (page: Page, cmd: string) => (await mlxCalls(page)).filter((c) => c.cmd === cmd)
@@ -62,7 +62,8 @@ test('mac: a style is trained with content captions and lands switched on in the
await openTrainTab(page)
const controls = page.getByTestId('mac-train-controls')
await expect(controls).toBeVisible({ timeout: 15_000 })
- await expect(page.getByRole('radio', { name: 'Character', exact: true })).toBeChecked()
+ // The training's own switch (the pill bar has a "Character" too since 3.1.0).
+ await expect(controls.getByRole('radio', { name: 'Character', exact: true })).toBeChecked()
await shot(page, 'p8-1-train-tab-character')
await page.getByRole('radio', { name: 'Style / concept', exact: true }).click()
@@ -117,8 +118,7 @@ test('mac: a style is trained with content captions and lands switched on in the
// The character shelf does not list a style.
await page.keyboard.press('Escape')
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
- await page.getByRole('radio', { name: 'Use character', exact: true }).click()
+ await openCharacterAction(page, 'Character Studio')
await expect(page.getByTestId('mac-no-characters')).toBeVisible({ timeout: 15_000 })
await expect(page.getByTitle('Trigger word: p8lino')).toHaveCount(0)
})
diff --git a/e2e/support/character-hub.ts b/e2e/support/character-hub.ts
new file mode 100644
index 00000000..3e63bb6f
--- /dev/null
+++ b/e2e/support/character-hub.ts
@@ -0,0 +1,63 @@
+import { expect, type Page } from '@playwright/test'
+
+/**
+ * The Character area (3.1.0 part B): one pill "Character" for Character
+ * Studio, Talking Character, Motion Control and Swap Character. Specs that
+ * used to click those four pills go through here.
+ */
+
+/** The pill of the area. */
+export function characterPill(page: Page) {
+ // In the pill bar: the training's own switch has a radio "Character" too.
+ return page.getByRole('radiogroup', { name: 'Create mode' }).getByRole('radio', { name: 'Character', exact: true })
+}
+
+/** Opens the area (step 1 on a fresh session). */
+export async function openCharacterHub(page: Page, timeout = 15_000): Promise<void> {
+ await characterPill(page).click({ timeout })
+ await expect(page.locator('[data-character-hub]')).toBeVisible({ timeout })
+}
+
+/** Step 2 without a character ("Just use a photo"), then the action row
+ * named like the old pill: 'Character Studio', 'Swap Character',
+ * 'Motion Control', 'Talking Character' (a locked one reads
+ * "…, runs on LU Cloud"). */
+export async function openCharacterAction(page: Page, name: string, timeout = 15_000): Promise<void> {
+ await openCharacterHub(page, timeout)
+ const hub = page.locator('[data-character-hub]')
+ if ((await hub.getAttribute('data-character-hub')) === 'who') {
+ await page.getByRole('button', { name: 'Just use a photo' }).click()
+ }
+ if ((await hub.getAttribute('data-character-hub')) !== 'panel') {
+ await page.getByRole('radio', { name, exact: true }).click({ timeout })
+ } else {
+ // Already on a panel: switch the action in the head line.
+ await page.getByRole('button', { name: 'Action' }).click()
+ const label = { 'Character Studio': 'Image', 'Swap Character': 'Swap', 'Motion Control': 'Motion', 'Talking Character': 'Talk' }[name] ?? name
+ await page.getByRole('option', { name: new RegExp(`^${label}`) }).click()
+ }
+}
+
+/** "Train from photos": Character Studio's training. */
+export async function openCharacterTraining(page: Page, timeout = 15_000): Promise<void> {
+ await openCharacterHub(page, timeout)
+ const hub = page.locator('[data-character-hub]')
+ if ((await hub.getAttribute('data-character-hub')) !== 'who') {
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await page.getByRole('option', { name: /^New character/ }).click()
+ return
+ }
+ await page.getByRole('button', { name: 'Train from photos' }).click()
+}
+
+/** Step 2 without a character, where the actions and their locks show. */
+export async function openCharacterWhat(page: Page, timeout = 15_000): Promise<void> {
+ await openCharacterHub(page, timeout)
+ const hub = page.locator('[data-character-hub]')
+ if ((await hub.getAttribute('data-character-hub')) === 'panel') {
+ await page.getByRole('button', { name: 'Character', exact: true }).click()
+ await page.getByRole('option', { name: 'All characters…' }).click()
+ }
+ await page.getByRole('button', { name: 'Just use a photo' }).click()
+ await expect(hub).toHaveAttribute('data-character-hub', 'what')
+}
diff --git a/e2e/support/cloud-mock.ts b/e2e/support/cloud-mock.ts
index cb62dffc..a0bf304e 100644
--- a/e2e/support/cloud-mock.ts
+++ b/e2e/support/cloud-mock.ts
@@ -87,6 +87,16 @@ export interface CloudScenario {
* server whose model names carry words a store build may not show.
*/
extraCatalogModels?: unknown[]
+ /**
+ * 14.11.2026, the account switch of the Character area (CHARACTER_HUB on
+ * the web side). `true`: /api/me and /api/jobs/catalog carry
+ * `features.characterHub: true`, as for a released account. Unset: both
+ * answers are the ones of a server without the switch, or of an account
+ * it is not open for.
+ */
+ characterHub?: boolean
+ /** Rows of /api/loras (the cloud characters). Unset: the route answers as before. */
+ loras?: unknown[]
}
// P9: one Studio model, shaped like a real /api/jobs/catalog entry once P0's
@@ -177,13 +187,16 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v
? { status: 'active', tier, access, ...(scenario.paidPlan === undefined ? {} : { paidPlan: scenario.paidPlan }) }
: { status: 'none' },
profile: null,
- ...(scenario.createChat === undefined ? {} : { features: { createChat: scenario.createChat } }),
+ ...(scenario.createChat === undefined && !scenario.characterHub
+ ? {}
+ : { features: { ...(scenario.createChat === undefined ? {} : { createChat: scenario.createChat }), ...(scenario.characterHub ? { characterHub: true } : {}) } }),
}),
)
}
// What an order of the chat reads before it is laid out. Only with the
// scenario: every other spec keeps the mock it was written against.
+ if (scenario.loras && path === '/api/loras') return route.fulfill(json(200, { loras: scenario.loras }))
if (scenario.createChat !== undefined && path === '/api/loras') return route.fulfill(json(200, { loras: [] }))
if (scenario.createChat !== undefined && path === '/api/account/content-policy') {
return route.fulfill(json(200, { policy: 'soft', ageConfirmedAt: null, ageConfirmationRequired: true }))
@@ -249,6 +262,7 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v
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 },
media_live: scenario.mediaLive !== false,
+ ...(scenario.characterHub ? { features: { characterHub: true } } : {}),
tier,
monthly_credits: 2_550_000,
}),
diff --git a/e2e/swap-character.spec.ts b/e2e/swap-character.spec.ts
index 27e2267a..fcbca1ff 100644
--- a/e2e/swap-character.spec.ts
+++ b/e2e/swap-character.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { openCharacterAction } from './support/character-hub'
/**
* Swap Character (07.11.2026, port of the web's C52; two steps with SCAIL 2
@@ -89,7 +90,8 @@ async function openSwap(page: Page): Promise<Seen> {
await page.setViewportSize({ width: 1296, height: 900 })
await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME })
await seedOnboardingDone(page)
- await routeCloud(page, { license: 'active', access: true, mediaLive: true, extraCatalogModels: SWAP_CATALOG })
+ // An account the server released the Character area for (CHARACTER_HUB).
+ await routeCloud(page, { license: 'active', access: true, mediaLive: true, extraCatalogModels: SWAP_CATALOG, characterHub: true })
// The frame step against the mock: upload, submit, poll, and the built
// frame. Registered after routeCloud, so these answer first; anything
// else falls back to the shared mock.
@@ -130,7 +132,8 @@ async function openSwap(page: Page): Promise<Seen> {
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Swap Character', exact: true }).click()
+ // Since 3.1.0 part B an action of the Character area.
+ await openCharacterAction(page, 'Swap Character')
await expect(page.locator('[data-swap-controls]')).toBeVisible({ timeout: 15_000 })
return seen
}
@@ -170,8 +173,9 @@ test('Swap Character in two steps: marks, first frame, Continue, Kling for one p
// SCAIL 2 is the default, the notes stand grey.
await expect(panel.locator('[data-swap-tips]')).toContainText('Up to 3 people with SCAIL-2, one person with Kling (highest resolution).')
await expect(panel).toHaveAttribute('data-swap-two-step', 'true')
+ // The resolution is under More options (sketches v2).
+ await page.getByRole('button', { name: 'More options' }).click()
await expect(page.getByRole('radio', { name: '720p' })).toHaveAttribute('aria-checked', 'true')
- await expect(page.locator('[data-swap-stage]')).toBeVisible()
await expect(create).toBeDisabled()
await shoot(page, 'swap-empty')
@@ -182,15 +186,15 @@ test('Swap Character in two steps: marks, first frame, Continue, Kling for one p
await tapFrame(page, 0.45, 0.35)
await tapFrame(page, 0.68, 0.38)
await expect(page.getByRole('button', { name: 'Remove mark 2' })).toBeVisible()
- await expect(page.locator('[data-swap-frame-count]')).toHaveText('2 of 4 people marked. Tap a number to remove it.')
+ await expect(page.locator('[data-swap-frame-count]')).toHaveAttribute('data-swap-frame-count', '2')
await expect(page.getByRole('textbox', { name: 'Who person 1 replaces' })).toHaveAttribute('placeholder', /^the person on the left/)
await expect(page.getByRole('textbox', { name: 'Who person 2 replaces' })).toHaveAttribute('placeholder', /^the person on the right/)
await page.locator('[data-swap-photo-input="1"]').setInputFiles(await media('face1.png', 'image/png'))
await page.locator('[data-swap-photo-input="2"]').setInputFiles(await media('face2.png', 'image/png'))
- await expect(page.getByRole('button', { name: 'Change photo of person 2' })).toBeVisible()
- // The slider prices frame and video together.
- await expect(page.locator('[data-clip-price]')).toContainText('credits · frame + video')
- await expect(page.locator('[data-clip-split]')).toContainText('First frame 14,000')
+ await expect(page.getByRole('button', { name: 'Character for person 2' })).toContainText('Photo')
+ // The bar prices frame and video together.
+ await expect(page.locator('[data-clip-price]')).toHaveAttribute('title', /credits$/)
+ await expect(page.locator('[data-clip-split]')).toContainText('frame 14k + video')
// Kling stands greyed out for two people, SCAIL 2 is recommended.
await page.getByRole('button', { name: /SCAIL 2/ }).first().click()
@@ -230,7 +234,7 @@ test('Swap Character in two steps: marks, first frame, Continue, Kling for one p
// Kling for one person: the second mark goes, the built frame expires.
await page.getByRole('button', { name: 'Remove mark 2' }).click()
- await expect(page.locator('[data-swap-frame-count]')).toHaveText('1 of 4 people marked. Tap a number to remove it.')
+ await expect(page.locator('[data-swap-frame-count]')).toHaveAttribute('data-swap-frame-count', '1')
await expect(create).toBeDisabled()
await page.getByRole('button', { name: /SCAIL 2/ }).first().click()
await expect(page.getByRole('option', { name: /Kling 3.0 Pro/ })).toBeEnabled()
@@ -245,7 +249,8 @@ test('Swap Character in two steps: marks, first frame, Continue, Kling for one p
expect(seen.submits[1].params.image_paths).toHaveLength(2)
await page.getByRole('button', { name: /Continue/ }).click()
await expect(create).toBeEnabled({ timeout: 15_000 })
- await expect(page.locator('[data-clip-split]')).toContainText('16,800/s')
+ // Kling: 16,800 credits a second, at least its billed minimum.
+ await expect(page.locator('[data-clip-split]')).toHaveText(/^frame 14k \+ video \d+k$/)
await shoot(page, 'swap-kling-one-person', '[data-swap-built]')
// Nothing but the frame step ever went to the queue.
@@ -274,7 +279,7 @@ test('Swap Character with OpenJutsu: one step, people up to four, consent before
// No frame step on OpenJutsu: Create is armed and names its price.
await expect(page.locator('[data-swap-built]')).toHaveCount(0)
await expect(create).toBeEnabled({ timeout: 15_000 })
- await expect(page.locator('[data-clip-price]')).toContainText('credits')
+ await expect(page.locator('[data-clip-price]')).toHaveAttribute('title', /credits$/)
await page.getByRole('button', { name: /Add person/ }).click()
await page.getByRole('button', { name: /Add person/ }).click()
@@ -316,7 +321,7 @@ test('Sound in Swap: original by default, lip sync greyed out for two people, a
await expect(page.locator('[data-sound-lipsync]')).toBeVisible()
await page.locator('[data-sound-lipsync] input[type=file][accept="audio/*"]').setInputFiles(voiceWav(8))
await expect(page.locator('[data-sound-price]')).toContainText('+ lip sync')
- await expect(page.locator('[data-clip-price]')).toContainText('credits · frame + video + lip sync')
+ await expect(page.locator('[data-clip-split]')).toContainText('frame 14k + video')
await expect(page.locator('[data-clip-split]')).toContainText('lip sync')
await page.getByRole('checkbox').check()
await page.getByRole('button', { name: /Build first frame/ }).click()
@@ -331,7 +336,7 @@ test('Sound in Swap: original by default, lip sync greyed out for two people, a
await tapFrame(page, 0.68, 0.38)
await expect(lipsync).toBeDisabled()
await expect(lipsync).toHaveAttribute('title', 'Lip sync works with one person')
- await expect(page.locator('[data-sound-note=lipsync-blocked]')).toHaveText('Lip sync works with one person')
+ await expect(page.locator('[data-sound-note=lipsync-blocked]')).toHaveText('one person only')
await expect(page.getByRole('radio', { name: 'Original sound' })).toHaveAttribute('aria-checked', 'true')
await shoot(page, 'swap-lipsync-blocked-two-people', '[data-sound-controls]', 'desktop-ton')
@@ -341,7 +346,7 @@ test('Sound in Swap: original by default, lip sync greyed out for two people, a
test('Sound in Motion: on the cloud lanes only', async ({ page }) => {
await openSwap(page)
- await page.getByRole('radio', { name: 'Motion Control', exact: true }).click()
+ await openCharacterAction(page, 'Motion Control')
const sound = page.locator('[data-sound-controls=motion]')
await expect(sound).toBeVisible({ timeout: 15_000 })
await expect(page.getByRole('radio', { name: 'Original sound' })).toHaveAttribute('aria-checked', 'true')
diff --git a/e2e/trainer-error-readable.spec.ts b/e2e/trainer-error-readable.spec.ts
index bff3f8cd..0dbefea4 100644
--- a/e2e/trainer-error-readable.spec.ts
+++ b/e2e/trainer-error-readable.spec.ts
@@ -1,6 +1,7 @@
import { test, expect } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, cloudSwitch } from './support/cloud-mock'
+import { openCharacterTraining } from './support/character-hub'
for (const ready of [false, true]) {
test(`trainer failure remains readable with environment ready=${ready}`, async ({ page }) => {
@@ -28,7 +29,7 @@ for (const ready of [false, true]) {
await page.goto('/')
await expect(cloudSwitch(page)).toBeVisible()
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await openCharacterTraining(page)
await page.getByRole('button', { name: ready ? 'Reinstall trainer' : 'Set up trainer', exact: true }).click()
// Z5: "Reinstall trainer" oeffnet jetzt nur den Bestaetigungsdialog; der
// Install-Befehl feuert erst nach "Reinstall" darin, nicht beim ersten Klick.
diff --git a/e2e/trainer-reinstall-confirm.spec.ts b/e2e/trainer-reinstall-confirm.spec.ts
index bd9eff05..12df260c 100644
--- a/e2e/trainer-reinstall-confirm.spec.ts
+++ b/e2e/trainer-reinstall-confirm.spec.ts
@@ -2,6 +2,7 @@ import { resolve } from 'node:path'
import { test, expect } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, cloudSwitch } from './support/cloud-mock'
+import { openCharacterTraining } from './support/character-hub'
/**
* Z5 (box-gruen/b BERICHT.md, Zusatzpunkt Z5, e2e Windows 18.09.2026): auf
@@ -69,7 +70,7 @@ async function gotoReadyTrainer(
await page.goto('/')
await expect(cloudSwitch(page)).toBeVisible()
await page.getByRole('button', { name: /^Create$/ }).click()
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await openCharacterTraining(page)
}
async function installCalls(page: import('@playwright/test').Page): Promise<unknown[]> {
diff --git a/src/api/cloud/catalog.ts b/src/api/cloud/catalog.ts
index 97993c2f..b7588c7e 100644
--- a/src/api/cloud/catalog.ts
+++ b/src/api/cloud/catalog.ts
@@ -27,6 +27,9 @@ export interface CloudCatalog {
* server that does not send it leaves the client's own limits in place
* (lib/upload-limits.ts). */
upload_limits?: { image?: number; audio?: number; video?: number }
+ /** Only for an account the server released the Character area for
+ * (CHARACTER_HUB): `{ characterHub: true }`. Missing means no. */
+ features?: { characterHub?: boolean }
}
/** A catalog entry as the server sends it. `native_label` is the app's own
diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.ts
index 7d391f5b..dd730118 100644
--- a/src/api/cloud/jobs.ts
+++ b/src/api/cloud/jobs.ts
@@ -136,7 +136,7 @@ export interface CloudMe {
}
/** What the server has released for this account. `createChat`: Create in
* chat. Absent on an older server and for a signed out account = nothing. */
- features?: { createChat?: boolean }
+ features?: { createChat?: boolean; characterHub?: boolean }
}
/** Stage an input; returns the render-inputs storage path. Roles: 'source' /
diff --git a/src/api/cloud/loras.ts b/src/api/cloud/loras.ts
index 59811beb..fc52b131 100644
--- a/src/api/cloud/loras.ts
+++ b/src/api/cloud/loras.ts
@@ -16,6 +16,13 @@ export interface CloudLora {
/** Which generation endpoints accept it: 'flux' | 'z-image' | 'qwen-image' | 'ltx-2'. */
base_family: string
created_at: string
+ /** Trained here or uploaded as a file (server 3.0.7). Optional: older servers. */
+ source?: 'trained' | 'uploaded'
+ /** The last picture made with it, signed for an hour, or null. */
+ preview_url?: string | null
+ /** Its base look (B42), signed for an hour, or null. The Character area
+ * shows it as the picture of the character. */
+ base_url?: string | null
}
export async function listLoras(): Promise<CloudLora[]> {
diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsx
index 4670163b..d297b4a2 100644
--- a/src/components/create/experimental/Composer.tsx
+++ b/src/components/create/experimental/Composer.tsx
@@ -18,8 +18,12 @@ import { createRunModel, intentRequiredInputs, isStudioModel } from '../../../li
import { STUDIO_MODELS } from '../../../lib/render/studio-contract'
import { swapBilledPhotos, swapPricedSeconds, swapShortCredits } from '../../../lib/render/swap'
import { swapReady } from '../../../lib/create/swap-run'
+import { modelLabel } from '../../../lib/render/preset-models'
+import { SwapLength, SwapPrice, useSwapBar } from './hub/SwapBarParts'
+import { useLocalPick } from './localPick'
import { swapConfirmedFrame } from '../../../lib/create/swap-frame'
import { soundApplies, soundInputError } from '../../../lib/render/sound'
+import { useCharacterHubReleased } from '../../../lib/create/character-hub-release'
import { effectiveVideoDurations, snapToVideoDuration } from '../../../lib/render/video-duration'
import { mediaSeconds, useStudioPrice } from './useStudioPrice'
import { getJob } from '../../../api/cloud/jobs'
@@ -51,6 +55,10 @@ import { cn } from '../ui/cn'
interface Props {
onOpenAdvanced: () => void
onOpenWorkflows: () => void
+ /** The bar at the foot of the Character area (sketches v2): only the field
+ * where the action takes a prompt, and one row with the model, the length,
+ * the price and Create. The inputs stand in the area above. */
+ hub?: boolean
}
/** What the disabled Create says while the Stage offers the Mac's setup. */
@@ -70,7 +78,30 @@ const NEGATIVE_FIELD_MAX = 'min(120px, calc(9vh / var(--ui-scale, 1)))'
/** The prompt field of the Mac's local Edit tab. See the placeholder below. */
const MAC_EDIT_PLACEHOLDER = 'Describe what to change in this image. Paint a mask to change only that area…'
-export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
+/** The window is phone-wide (the Character area's bar takes m310's short form). */
+function useNarrow(): boolean {
+ const query = '(max-width: 520px)'
+ const [narrow, setNarrow] = useState(() => typeof window !== 'undefined' && !!window.matchMedia?.(query).matches)
+ useEffect(() => {
+ if (typeof window === 'undefined' || !window.matchMedia) return
+ const m = window.matchMedia(query)
+ const on = () => setNarrow(m.matches)
+ on()
+ m.addEventListener('change', on)
+ return () => m.removeEventListener('change', on)
+ }, [])
+ return narrow
+}
+
+/** The name of the local model the tab runs, for the phone's summary. */
+function useLocalPickName(): string | null {
+ const { value } = useLocalPick()
+ return value ? value.replace(/\.(safetensors|gguf|ckpt)$/i, '') : null
+}
+
+export function Composer({ onOpenAdvanced, onOpenWorkflows, hub = false }: Props) {
+ const narrow = useNarrow()
+ const [narrowOpen, setNarrowOpen] = useState(false)
const intent = useCreateStore((s) => s.intent())
const meta = INTENT_MAP[intent]
const prompt = useCreateStore((s) => s.prompt)
@@ -274,7 +305,8 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
// New voice with lips (14.11.2026): the second step belongs to the price of
// this start; button and cover check count it (lib/render/sound.ts).
const sound = useCreateStore((s) => s.sound)
- const soundOn = soundApplies(intent, backend) ? sound : undefined
+ const hubReleased = useCharacterHubReleased()
+ const soundOn = soundApplies(intent, backend, hubReleased) ? sound : undefined
const lipsyncOn = soundOn === 'lipsync'
const lipsyncExtra = useCreateStore((s) => (lipsyncOn ? s.lipsyncCredits ?? 0 : 0))
const lipsyncModel = useCreateStore((s) => s.lipsyncModel)
@@ -406,13 +438,39 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
const laneCaption = noPromptHint(meta.id, backend, backend === 'local' && isMlxImageHost(), trainKind)
// The disabled button says which input it waits for (laneHint.ts).
const missingSource = missingSourceHint({ intent, needsSource: meta.needsSource, hasSource: hasStart })
+ // The price of a cloud run in the bar of the Character area (Swap has its
+ // own parts, SwapPrice). Local runs cost nothing and show none.
+ const hubCredits = hub && backend === 'cloud'
+ ? ((studioPick ? studioPrice?.credits : (cloudStudioCredits ?? lengthShown)) ?? null) !== null
+ ? (studioPick ? studioPrice!.credits : (cloudStudioCredits ?? lengthShown)!) * imageCount + lipsyncExtra
+ : null
+ : null
+ // The phone's short summary of the bar: model, and the length on Swap.
+ const localPickName = useLocalPickName()
+ const hubModelName = backend === 'cloud' ? modelLabel(runModel) : (localPickName ?? 'Local')
+ const swapBar = useSwapBar(inputSeconds)
+ // Swap without the account switch has nothing to pick or pay; with it, the
+ // length and its price stand once there is a video to measure.
+ const swapSoon = swap && !hubReleased
+ const swapBarShown = swap && backend === 'cloud' && !swapSoon && !!videoInput
+ const hubSummary = swapBarShown ? `${hubModelName} · ${swapBar.value} s` : swapSoon ? 'Swap' : hubModelName
+ // Swap Character names its price on the button (the web's CreateButton):
+ // a paid video run, priced by its length. With a new voice the lip sync
+ // step is in the figure too. On the phone every cloud run of the area
+ // names it (m310's Create pill).
+ const createPrice = swap && backend === 'cloud' && priceSeconds !== undefined && studioPrice
+ ? swapShortCredits(studioPrice.credits + lipsyncExtra)
+ : lipsyncOn && lipsyncExtra > 0 && (studioPrice?.credits ?? cloudStudioCredits ?? lengthShown) != null
+ ? swapShortCredits((studioPrice?.credits ?? cloudStudioCredits ?? lengthShown ?? 0) + lipsyncExtra)
+ : hub && narrow && hubCredits != null ? swapShortCredits(hubCredits) : null
+
return (
// A stable min-height (bottom-anchored) so the prompt window occupies the
// same vertical space on every tab — utility modes (no LaneControls / no
// prompt) don't shrink it. That keeps the viewer + gallery row above it the
// exact SAME height across all tabs, not just within one.
- <div className="shrink-0 px-4 pb-4 pt-2 min-h-[192px] flex flex-col justify-end">
+ <div className={cn('shrink-0 flex flex-col justify-end', hub ? 'px-0 pb-3 pt-2' : 'px-4 pb-4 pt-2 min-h-[192px]')}>
{/* 660, nicht 760: dieselbe Spalte wie im Chat, und dieselbe Rechnung.
Die 760 waren hier als KOPIE von --lu-measure eingetippt; seit die
App eine --ui-scale hat, wird die Zahl mitskaliert, 760 ergaebe also
@@ -421,15 +479,22 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
Zahl hier doppelt steht statt den Token zu lesen, ist ein eigener
Befund und hier nicht behoben. */}
<div className="mx-auto w-full max-w-[660px] space-y-2.5">
- {special && <SpecialControls intent={intent} />}
+ {special && !hub && <SpecialControls intent={intent} />}
{/* Swap Character's options are its own panel above (SpecialControls). */}
- {!isUtility && !swap && <LaneControls />}
- <CharacterNote />
- {inputNote && (
+ {!isUtility && !swap && !hub && <LaneControls />}
+ {!hub && <CharacterNote />}
+ {hub && showNoPromptHint && intent === 'character' && characterTab === 'train' && (
+ // The training's one line on what to add (photos or pictures of the
+ // style), as it stood over the prompt window.
+ <p className="hub-dim hub-fs-125 text-center" data-testid="lane-input-note">{laneCaption}</p>
+ )}
+ {inputNote && !hub && (
<p className="t-body text-gray-500 text-center px-3.5" data-testid="lane-input-note">{laneCaption}</p>
)}
- <div className="rounded-[var(--radius-panel)] bg-white/[0.03] border border-white/[0.06] focus-within:border-white/15 transition-colors">
+ <div className={hub
+ ? cn('hub-bar transition-colors', narrow && 'rounded-2xl')
+ : 'rounded-[var(--radius-panel)] bg-white/[0.03] border border-white/[0.06] focus-within:border-white/15 transition-colors'}>
{needPrompt && (
// The prompt assistant (B43) sits in the field's corner, not in the
// action bar: there every pixel is the model chip's, whose whole
@@ -514,7 +579,7 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
Zustand der Maske selbst beschreibt, sonst stuende dort ein
Text, der beim Radiergummi nie zutrifft ("remove the
background"). */}
- {showNoPromptHint && !needsMask && !inputNote && (
+ {showNoPromptHint && !needsMask && !inputNote && !hub && (
<div className="px-3.5 py-3 t-body text-gray-500">
{laneCaption}
</div>
@@ -526,7 +591,31 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
)}
{/* Action bar */}
- <div className="flex items-center gap-1.5 px-2.5 py-2 border-t border-white/[0.05]">
+ {hub && narrow && narrowOpen && (
+ // The phone: the choices behind the short summary (m310's
+ // pattern; the sheet from below is theirs to bring, until then
+ // they open here, above the row).
+ <div className={cn('hub-line flex flex-wrap items-center gap-2 px-2.5 py-2', needPrompt && 'border-t')} data-hub-bar-options>
+ {!swapSoon && <ModelChip />}
+ {swapBarShown && <SwapLength videoSeconds={inputSeconds} disabled={isGenerating} />}
+ {swapBarShown && <SwapPrice videoSeconds={inputSeconds} />}
+ </div>
+ )}
+ <div className={hub
+ ? cn('flex items-center gap-1.5 pl-2.5 pr-1.5', narrow ? 'min-h-[45px] py-1.5' : 'min-h-[45px] py-[5px]', (needPrompt || (narrow && narrowOpen)) && 'hub-line border-t')
+ : 'flex items-center gap-1.5 px-2.5 py-2 border-t border-white/[0.05]'}>
+ {hub && narrow && (
+ <button
+ type="button"
+ onClick={() => setNarrowOpen(!narrowOpen)}
+ aria-expanded={narrowOpen}
+ className="hub-muted flex min-h-11 min-w-0 flex-1 items-center gap-1.5 text-left hub-fs-13"
+ data-hub-bar-summary
+ >
+ <SlidersHorizontal size={14} className="shrink-0" />
+ <span className="truncate">{hubSummary}</span>
+ </button>
+ )}
{/* Ein Schalter, der sagt, dass er einer ist. „Neg" war eine
Abkuerzung, deren Aufloesung nur im Hover-`title` stand, und
der Knopf meldete seinen Zustand an nichts ausser der
@@ -534,7 +623,7 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
also fuer einen Screenreader ein gewoehnlicher Knopf ohne
Zustand. Beides steht jetzt da, und `aria-controls` zeigt auf
das Feld, das er aufklappt. */}
- {needPrompt && !optionalPrompt && negSupported && (
+ {needPrompt && !optionalPrompt && negSupported && !(hub && narrow) && (
<button
onClick={toggleNegative}
aria-pressed={showNegative}
@@ -546,11 +635,19 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
Negative
</button>
)}
- {needPrompt && <PromptHistory onPick={setPrompt} />}
- <div className="flex-1" />
+ {needPrompt && !(hub && narrow) && <PromptHistory onPick={setPrompt} />}
+ {hub && !narrow && !isUtility && !swapSoon && <ModelChip />}
+ {hub && !narrow && swapBarShown && <SwapLength videoSeconds={inputSeconds} disabled={isGenerating} />}
+ {!(hub && narrow) && <div className="flex-1" />}
+ {hub && !narrow && swapBarShown && <SwapPrice videoSeconds={inputSeconds} />}
+ {hub && !narrow && !swap && hubCredits != null && (
+ <span className="hub-text mr-1 hub-fs-13 font-medium tabular-nums" data-hub-price title={`${hubCredits.toLocaleString('en-US')} credits`}>
+ {swapShortCredits(hubCredits)}
+ </span>
+ )}
{/* The backend axis moved to the global header switch (2.5.7) —
the Composer just reflects it via the CreditsMeter. */}
- {backend === 'cloud' && <CreditsMeter />}
+ {backend === 'cloud' && !hub && <CreditsMeter />}
{/* Portplan Abschnitt 5, Punkt 3: der Server ist die einzige
Preiswahrheit fuer ein Studio-Modell. Ist er nicht erreichbar
oder zu alt (studio.ts, OLDER_SERVER_MESSAGE), bleibt Create
@@ -613,7 +710,8 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
</div>
</Tooltip>
)}
- {!isUtility && (
+ {!isUtility && hub && <ImageCountChip />}
+ {!isUtility && !hub && (
<>
<CharacterChip />
<ModelChip />
@@ -624,20 +722,19 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {
</>
)}
{isGenerating ? (
- <Button variant="danger" size="md" icon={X} onClick={guardedCancel}>Cancel</Button>
+ <Button variant="danger" size="md" icon={X} onClick={guardedCancel} className={hub && narrow ? 'h-10 rounded-[20px]' : undefined}>Cancel</Button>
) : (
// The span carries the hint: a disabled button takes no pointer,
// so a title on the button itself would never show.
<span className="inline-flex" title={macSetupFirst ? MAC_SETUP_FIRST : (missingSource ?? (upscaleReady ? undefined : UPSCALE_MODEL_FIRST))}>
- <Button variant="primary" size="lg" icon={Sparkles} disabled={!canGenerate} onClick={guardedGenerate}>
+ <Button variant="primary" size={hub ? 'md' : 'lg'} icon={Sparkles} disabled={!canGenerate} onClick={guardedGenerate}
+ className={hub && narrow ? 'h-10 rounded-[20px] px-4' : undefined}>
{/* Swap Character names its price on the button (the web's
CreateButton): a paid video run, priced by its length. */}
{/* With a new voice the lip sync step is in the figure too. */}
- {swap && backend === 'cloud' && priceSeconds !== undefined && studioPrice
- ? `Create · ${swapShortCredits(studioPrice.credits + lipsyncExtra)}`
- : lipsyncOn && lipsyncExtra > 0 && (studioPrice?.credits ?? cloudStudioCredits ?? lengthShown) != null
- ? `Create · ${swapShortCredits((studioPrice?.credits ?? cloudStudioCredits ?? lengthShown ?? 0) + lipsyncExtra)}`
- : 'Create'}
+ {hub && narrow && createPrice
+ ? <>Create <span className="hub-fs-125 tabular-nums opacity-70">{createPrice}</span></>
+ : createPrice ? `Create · ${createPrice}` : 'Create'}
</Button>
</span>
)}
@@ -681,7 +778,7 @@ const LANE_ROW = 'flex items-center flex-wrap justify-center'
// submit "bare" (fixed server-side), so the sliders would do nothing
// • audio LOCAL (music): steps (Length lives in MusicControls)
// • audio CLOUD (music): hidden — bare submit carries only duration + lyrics
-function LaneControls() {
+export function LaneControls() {
const intent = useCreateStore((s) => s.intent())
const meta = INTENT_MAP[intent]
const backend = useCreateStore((s) => s.backend)
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index 08adf48b..f7890327 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -15,6 +15,8 @@ import { CreateExpProvider, useCreateExp } from './CreateContext'
import { IntentBar } from './IntentBar'
import { Stage } from './Stage'
import { Composer } from './Composer'
+import { CharacterHub } from './hub/CharacterHub'
+import { isHubIntent } from '../../../lib/create/character-hub'
import { CreatePanel } from './CreatePanel'
import { Lightbox } from './Lightbox'
import { SaveCharacterModal } from './SaveCharacterModal'
@@ -93,6 +95,9 @@ function CreateExperimentalInner() {
// 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())
+ // The Character area (3.1.0 part B) takes the place of the stage and the
+ // prompt window for its four intents; gallery and presets stay beside it.
+ const hubOpen = isHubIntent(intent)
const cloudOpModel = useCreateStore((s) => s.cloudOpModel)
const cloudImageModel = useCreateStore((s) => s.cloudImageModel)
const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)
@@ -476,30 +481,52 @@ function CreateExperimentalInner() {
beneath them. (Previously the Gallery ran full-height alongside both the
viewer AND the composer, so it was taller than the viewer.) */}
<div className="flex-1 min-h-0 flex overflow-hidden">
- <Stage
- displayed={displayed}
- onOpenMaskEditor={() => setMaskOpen(true)}
- onEditResult={editAvailable ? (it) => { void editResultWithMask(it) } : undefined}
- onAnimateResult={animateAvailable ? (it) => { void animateResult(it) } : undefined}
- onFullscreen={(it) => { setLightboxPrompt(false); setLightbox(it) }}
- onShowPrompt={(it) => { setLightboxPrompt(true); setLightbox(it) }}
- onSaveCharacter={setCharacterFrom}
- comfyStarting={comfyStarting}
- />
- <CreatePanel open={panelOpen} onOpenChange={setPanelOpen} activeId={shownId} onSelect={openGalleryItem} />
- <PresetShelf
- open={presetsOpen}
- onOpenChange={setPresetsOpen}
- onSelect={(p) => { setSelectedPreset(p); setPresetStarted(false); setPresetDialogOpen(true) }}
- resume={selectedPreset && presetStarted && !presetDialogOpen ? { title: selectedPreset.title, onResume: () => setPresetDialogOpen(true) } : null}
- />
+ {hubOpen ? (
+ <CharacterHub
+ stage={{
+ displayed,
+ onOpenMaskEditor: () => setMaskOpen(true),
+ onEditResult: editAvailable ? (it) => { void editResultWithMask(it) } : undefined,
+ onAnimateResult: animateAvailable ? (it) => { void animateResult(it) } : undefined,
+ onFullscreen: (it) => { setLightboxPrompt(false); setLightbox(it) },
+ onShowPrompt: (it) => { setLightboxPrompt(true); setLightbox(it) },
+ onSaveCharacter: setCharacterFrom,
+ comfyStarting,
+ }}
+ onOpenAdvanced={() => setAdvancedOpen(true)}
+ onOpenWorkflows={() => { setWorkflowsOpen(true); setManagerNoticeSeen(true) }}
+ onOpenGallery={() => setPanelOpen(true)}
+ />
+ ) : (
+ <Stage
+ displayed={displayed}
+ onOpenMaskEditor={() => setMaskOpen(true)}
+ onEditResult={editAvailable ? (it) => { void editResultWithMask(it) } : undefined}
+ onAnimateResult={animateAvailable ? (it) => { void animateResult(it) } : undefined}
+ onFullscreen={(it) => { setLightboxPrompt(false); setLightbox(it) }}
+ onShowPrompt={(it) => { setLightboxPrompt(true); setLightbox(it) }}
+ onSaveCharacter={setCharacterFrom}
+ comfyStarting={comfyStarting}
+ />
+ )}
+ {/* On a phone-wide window the Character area takes the whole width
+ (its rails would leave the column 200 px). */}
+ <div className={hubOpen ? 'contents max-[520px]:hidden' : 'contents'}>
+ <CreatePanel open={panelOpen} onOpenChange={setPanelOpen} activeId={shownId} onSelect={openGalleryItem} />
+ <PresetShelf
+ open={presetsOpen}
+ onOpenChange={setPresetsOpen}
+ onSelect={(p) => { setSelectedPreset(p); setPresetStarted(false); setPresetDialogOpen(true) }}
+ resume={selectedPreset && presetStarted && !presetDialogOpen ? { title: selectedPreset.title, onResume: () => setPresetDialogOpen(true) } : null}
+ />
+ </div>
</div>
{/* Prompt window — full width, beneath the viewer + gallery. */}
- <Composer
+ {!hubOpen && <Composer
onOpenAdvanced={() => setAdvancedOpen(true)}
onOpenWorkflows={() => { setWorkflowsOpen(true); setManagerNoticeSeen(true) }}
- />
+ />}
<AdvancedDrawer open={advancedOpen} onClose={() => setAdvancedOpen(false)} studioModel={studioPick} />
<WorkflowsModal open={workflowsOpen} onClose={() => setWorkflowsOpen(false)} />
diff --git a/src/components/create/experimental/IntentBar.tsx b/src/components/create/experimental/IntentBar.tsx
index 976a9024..d55e29c5 100644
--- a/src/components/create/experimental/IntentBar.tsx
+++ b/src/components/create/experimental/IntentBar.tsx
@@ -2,7 +2,8 @@ import { Cloud } from 'lucide-react'
import { useCreateStore } from '../../../stores/createStore'
import { useUIStore, type CloudTeaserTarget } from '../../../stores/uiStore'
import { useSettingsStore } from '../../../stores/settingsStore'
-import { isIntentLocked, visibleIntents } from './intents'
+import { isIntentLocked, pillEntries, visibleIntents, type IntentMeta } from './intents'
+import { HUB_INTENTS, isHubIntent } from '../../../lib/create/character-hub'
import { isMlxImageHost } from '../../../api/mlx-image'
import { mlxFollowsMotion, mlxTakesStartImage, mlxTalking } from '../../../api/mlx-video'
import { mlxMakesMusic } from '../../../lib/mac-music'
@@ -65,37 +66,9 @@ type TeaserIntent = Extract<CloudTeaserTarget, { surface: 'intent' }>['intent']
export function IntentBar() {
const intent = useCreateStore((s) => s.intent())
const setIntent = useCreateStore((s) => s.setIntent)
- const backend = useCreateStore((s) => s.backend)
+ const openCharacterHub = useCreateStore((s) => s.openCharacterHub)
const setCloudTeaser = useUIStore((s) => s.setCloudTeaser)
- // Every tool that can run or be previewed is in the bar. With "Show Cloud
- // features in Local mode" off, the hosted-only tools are left out of the
- // local bar (visibleIntents). The 2.5.8 lanes with hasLocalLane
- // (lipsync / music / extend / motion) are REAL local tabs, plain selectable
- // pills with NO cloud glyph (2026-07-19: the top row only carries a
- // cloud badge for the genuinely hosted-only tools). Enhance Image runs on
- // local ComfyUI since 3.0.7. Only eraser (cloudOnly, no local backend)
- // renders as a locked, cloud-tagged pill in local mode; a tap opens the
- // teaser sheet / plans gate.
- //
- // On an MLX Mac (no ComfyUI at all) those lanes have no local implementation
- // either, so they lock there too. Both rules live in intents.ts so they stay
- // pure + unit tested; this component only renders the verdict.
- const mlxHost = isMlxImageHost()
- const cloudFeatures = useSettingsStore((s) => s.settings.cloudTeasersEnabled)
- // Animate Image is a local tab on the Mac while an installed video model
- // starts from an image (the catalogue's word, carried on the list entry).
- const mlxAnimate = useCreateStore((s) => mlxTakesStartImage(s.videoModelList))
- // And Edit while an installed image model takes an image (Qwen-Image 2.1).
- const mlxEdit = useCreateStore((s) => mlxTakesEditImage(s.imageModelList))
- // And Enhance Image while an upscaler is installed (SeedVR2), and Music
- // while the music engine (ACE-Step 1.5) is installed.
- const mlxUpscale = useCreateStore((s) => s.mlxUpscale)
- const mlxMusic = useCreateStore((s) => mlxMakesMusic(s.audioModelList))
- // And Motion Control while an installed LTX-2.3 pack follows a motion video.
- const mlxMotion = useCreateStore((s) => mlxFollowsMotion(s.videoModelList))
- // And Talking Character while a video model that talks is installed.
- const mlxTalk = useCreateStore((s) => mlxTalking(s.videoModelList).tab)
- const intents = visibleIntents(backend, mlxHost, cloudFeatures, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk)
+ const { intents, lockedOf } = useIntentLanes()
return (
<div
@@ -118,9 +91,13 @@ export function IntentBar() {
// den 1,5px: darunter steht die Buehne, und die stand nie zu eng.
className="flex flex-wrap items-center justify-center gap-x-[3px] gap-y-[3px] px-3 pt-1.5 pb-[1.5px] [--text-control:9px]"
>
- {intents.map((meta) => {
- const locked = isIntentLocked(meta, backend, mlxHost, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk)
- const selected = !locked && intent === meta.id
+ {pillEntries(intents).map(({ meta, hub }) => {
+ // The Character pill locks only where none of its actions runs here
+ // (never so far: Character Studio has a lane on every host).
+ const locked = hub
+ ? intents.filter((m) => HUB_INTENTS.includes(m.id)).every((m) => lockedOf(m))
+ : lockedOf(meta)
+ const selected = !locked && (hub ? isHubIntent(intent) : intent === meta.id)
const Icon = meta.icon
return (
<button
@@ -132,7 +109,7 @@ export function IntentBar() {
onClick={() =>
locked
? setCloudTeaser({ surface: 'intent', intent: meta.id as TeaserIntent })
- : setIntent(meta.id)
+ : hub ? openCharacterHub() : setIntent(meta.id)
}
className={cn(
'relative flex items-center h-7 rounded-full border transition-[background-color,border-color,box-shadow,color] duration-200',
@@ -156,12 +133,57 @@ export function IntentBar() {
aria-hidden
/>
)}
- <span className="whitespace-nowrap t-control pl-[3px] pr-[10.5px]">
+ <span className={cn('whitespace-nowrap t-control pl-[3px]', hub ? 'pr-[5px]' : 'pr-[10.5px]')}>
{meta.short}
</span>
+ {hub && (
+ // The area is new in 3.1.0: one quiet mark, accent text on a
+ // faint accent ground, as in the sketches.
+ <span className="mr-[5px] rounded-full bg-lu-accent/15 px-[5px] py-px lu-new-mark text-lu-accent" aria-hidden>
+ NEW
+ </span>
+ )}
</button>
)
})}
</div>
)
}
+
+/** The tabs this host shows and which of them are locked cloud teasers: one
+ * answer for the bar and for step 2 of the Character area. The rules live
+ * in intents.ts (pure, unit tested); this only reads the host. */
+export function useIntentLanes(): { intents: IntentMeta[]; lockedOf: (meta: IntentMeta) => boolean } {
+ const backend = useCreateStore((s) => s.backend)
+ // Every tool that can run or be previewed is in the bar. With "Show Cloud
+ // features in Local mode" off, the hosted-only tools are left out of the
+ // local bar (visibleIntents). The 2.5.8 lanes with hasLocalLane
+ // (lipsync / music / extend / motion) are REAL local tabs, plain selectable
+ // pills with NO cloud glyph (2026-07-19: the top row only carries a
+ // cloud badge for the genuinely hosted-only tools). Enhance Image runs on
+ // local ComfyUI since 3.0.7. Only eraser (cloudOnly, no local backend)
+ // renders as a locked, cloud-tagged pill in local mode; a tap opens the
+ // teaser sheet / plans gate.
+ //
+ // On an MLX Mac (no ComfyUI at all) those lanes have no local implementation
+ // either, so they lock there too. Both rules live in intents.ts so they stay
+ // pure + unit tested; this component only renders the verdict.
+ const mlxHost = isMlxImageHost()
+ const cloudFeatures = useSettingsStore((s) => s.settings.cloudTeasersEnabled)
+ // Animate Image is a local tab on the Mac while an installed video model
+ // starts from an image (the catalogue's word, carried on the list entry).
+ const mlxAnimate = useCreateStore((s) => mlxTakesStartImage(s.videoModelList))
+ // And Edit while an installed image model takes an image (Qwen-Image 2.1).
+ const mlxEdit = useCreateStore((s) => mlxTakesEditImage(s.imageModelList))
+ // And Enhance Image while an upscaler is installed (SeedVR2), and Music
+ // while the music engine (ACE-Step 1.5) is installed.
+ const mlxUpscale = useCreateStore((s) => s.mlxUpscale)
+ const mlxMusic = useCreateStore((s) => mlxMakesMusic(s.audioModelList))
+ // And Motion Control while an installed LTX-2.3 pack follows a motion video.
+ const mlxMotion = useCreateStore((s) => mlxFollowsMotion(s.videoModelList))
+ // And Talking Character while a video model that talks is installed.
+ const mlxTalk = useCreateStore((s) => mlxTalking(s.videoModelList).tab)
+ const intents = visibleIntents(backend, mlxHost, cloudFeatures, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk)
+ const lockedOf = (meta: IntentMeta) => isIntentLocked(meta, backend, mlxHost, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk)
+ return { intents, lockedOf }
+}
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index 5e8783f5..223ca3a8 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -10,14 +10,14 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { usePopoverPlatz } from '../../../hooks/usePopoverPlatz'
import { AnimatePresence, motion } from 'framer-motion'
import {
- AudioLines, Download, Film, ImagePlus, Info, Loader2, Mic, Music2, Trash2, Upload, Wand2, X,
+ AudioLines, ChevronDown, Download, Film, Info, Loader2, Mic, Music2, Trash2, Upload, Wand2, X,
} from 'lucide-react'
import { useCreateStore, type CreateIntent, type GalleryItem, type SwapFigure } from '../../../stores/createStore'
import { useCloudCatalogStore, cloudModelById, lengthCredits, lengthPrice, modelForOp } from '../../../stores/cloudCatalogStore'
-import { listLoras, deleteLora, downloadLora, type CloudLora, type LoraDownloadProgress } from '../../../api/cloud/loras'
+import { deleteLora, downloadLora, type CloudLora, type LoraDownloadProgress } from '../../../api/cloud/loras'
import { errorText } from '../../../types/json-guards'
import {
- characterTrainerStatus, deleteLocalCharacter, installCharacterTrainer, parseLocalCharacterLora,
+ characterTrainerStatus, deleteLocalCharacter, installCharacterTrainer,
TRAINER_BASE_FILES, baseDownloadRunning, baseDownloadPercent, missingTrainerBases, missingBasesLine, aboutSize, baseBytes,
baseStartFailedNote, basesStillMissingNote, type TrainerBaseFile, type TrainerStatus,
} from '../../../api/trainer'
@@ -30,7 +30,7 @@ import { openMlxLoraFolder } from '../../../api/mlx-loras'
import { getMacTrainStatus, macTrainMissing, macTrainNote, type MacTrainStatus } from '../../../api/mlx-train'
import { useUIStore } from '../../../stores/uiStore'
import { useModelStore } from '../../../stores/modelStore'
-import { characterLoraFile, listLocalCharacters, type CharacterRef } from '../../../lib/characters'
+import { characterLoraFile } from '../../../lib/characters'
import { isWindows, isMacOS } from '../../../api/backend'
import { LOCAL_MUSIC_TEXT, SECONDS_LENGTH, musicHowtoLines, musicLength, musicText } from '../../../lib/render/music-ui'
import { MAC_MUSIC_MIN_SECONDS } from '../../../lib/mac-music'
@@ -38,18 +38,20 @@ import { createRunModel, studioShownValue } from '../../../lib/render/create-stu
import { STUDIO_MODELS, studioFields } from '../../../lib/render/studio-contract'
import { modelLabel } from '../../../lib/render/preset-models'
import {
- SWAP_AUTO_MODELS, SWAP_CONSENT_TEXT, SWAP_INTENT, SWAP_OPENJUTSU_MODEL, SWAP_TIPS, swapAutoModel, swapBilledPhotos,
- swapDefaultOptions, swapFigureRoles, swapMaxPeople, swapNeedsConsent, swapReadsRoles, swapShortCredits, swapUsesFrame,
+ SWAP_AUTO_MODELS, SWAP_CONSENT_TEXT, SWAP_INTENT, SWAP_OPENJUTSU_MODEL, SWAP_TIPS, swapAutoModel,
+ swapDefaultOptions, swapFigureRoles, swapClipLimits, swapMaxPeople, swapNeedsConsent, swapShortCredits, swapUsesFrame,
} from '../../../lib/render/swap'
-import { swapFrameCredits } from '../../../lib/create/swap-frame'
import {
- LIPSYNC_STEP_DEFAULT, LIPSYNC_STEP_MODELS, SOUND_CHOICES, SOUND_LABEL, lipsyncBlocked, lipsyncCredits, lipsyncCut,
+ LIPSYNC_ONE_PERSON, LIPSYNC_STEP_DEFAULT, LIPSYNC_STEP_MODELS, SOUND_CHOICES, SOUND_LABEL, lipsyncBlocked, lipsyncCredits, lipsyncCut,
lipsyncSeconds, soundApplies, soundClipSeconds, type SoundChoice,
} from '../../../lib/render/sound'
import { getJob } from '../../../api/cloud/jobs'
import { SwapFrameBuild, SwapFramePicker, useSwapFirstFrame } from './SwapFrameSteps'
+import { CharacterPick, HubLine, UploadLine } from './hub/HubParts'
+import { hubPortrait, hubPortraitName } from './hub/hubCharacters'
+import { HUB_SWAP_SOON } from '../../../lib/create/character-hub'
+import { useCharacterHubReleased } from '../../../lib/create/character-hub-release'
import { mediaSeconds } from './useStudioPrice'
-import { ClipLength } from './ClipLength'
import { galleryLabelShort } from '../../../lib/render/gallery-label'
import { TRAIN_VRAM_PRESETS, LOW_VRAM_NOTE, trainStepsNote, trainVramSuggestion, type TrainVramPreset } from '../../../lib/trainer-presets'
import { STYLE_MODE_NOTE, STYLE_NAME_PLACEHOLDER, STYLE_TRIGGER_HINT_OFF, STYLE_TRIGGER_HINT_ON, STYLE_TRIGGER_LABEL, TRAIN_KINDS, trainPresetsFor, type TrainKind } from '../../../lib/train-kind'
@@ -89,105 +91,14 @@ export function SpecialControls({ intent }: { intent: CreateIntent }) {
}
}
-// ── shared chip: a small labeled file slot (audio/video/image) ──────────────
-//
-// `mediaRefFrom` used to be defined right here, and the training board in
-// Stage.tsx had its own inline copy of the same two lines. Two mints, one
-// release — and it was the copy without a release. Both now come from
-// `./mediaRef`, whose counterpart in createStore is
+// The file inputs of Motion, Talk and Swap are lines of the Character area
+// (hub/HubParts UploadLine, PortraitLine and DrivingVideoLine below).
+// `mediaRefFrom` comes from `./mediaRef`, whose counterpart in createStore is
// `releaseDroppedMediaRefs`. Do NOT revoke in this file: the ref outlives the
// component, it lives in the store.
-function FileChip({
- icon: Icon,
- empty,
- value,
- accept,
- onFile,
- onClear,
-}: {
- icon: typeof Upload
- empty: string
- value: string | null
- accept: string
- onFile: (f: File) => void
- onClear: () => void
-}) {
- const inputRef = useRef<HTMLInputElement>(null)
- return (
- <div className="flex items-center">
- <input
- ref={inputRef}
- type="file"
- accept={accept}
- className="hidden"
- onChange={(e) => {
- const f = e.target.files?.[0]
- if (f) onFile(f)
- e.target.value = ''
- }}
- />
- <button
- onClick={() => inputRef.current?.click()}
- className={cn(
- 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
- value
- ? 'bg-white/[0.06] border-white/10 text-gray-200'
- : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200 hover:border-white/15',
- )}
- >
- <Icon size={12} />
- <span className="max-w-[140px] truncate">{value ?? empty}</span>
- </button>
- {value && (
- <button onClick={onClear} className="p-1 text-gray-500 hover:text-gray-300" title="Remove" aria-label="Remove">
- <X size={11} />
- </button>
- )}
- </div>
- )
-}
-
-// The character-image slot writes the shared Stage source (an ImageRef with a
-// data-URL preview — the cloud upload path re-encodes from it).
-function PortraitChip({ empty }: { empty: string }) {
- const source = useCreateStore((s) => s.source)
- const setSource = useCreateStore((s) => s.setSource)
- return (
- <FileChip
- icon={ImagePlus}
- empty={empty}
- value={source ? 'Image ready' : null}
- accept="image/*"
- onFile={(f) => { void loadImageRef(f).then(setSource) }}
- onClear={() => setSource(null)}
- />
- )
-}
-
-function DrivingVideoChip({ empty }: { empty: string }) {
- const videoInput = useCreateStore((s) => s.videoInput)
- const setVideoInput = useCreateStore((s) => s.setVideoInput)
- return (
- <FileChip
- icon={Film}
- empty={empty}
- value={videoInput?.name ?? null}
- accept="video/mp4,video/webm,video/quicktime"
- onFile={(f) => setVideoInput(mediaRefFrom(f))}
- onClear={() => setVideoInput(null)}
- />
- )
-}
-
// ── Character-Studio ────────────────────────────────────────────────────────
-const FAMILY_LABEL: Record<string, string> = {
- flux: 'Flux',
- 'z-image': 'Z-Image',
- 'qwen-image': 'Qwen',
- 'ltx-2': 'LTX video',
-}
/** Saves a trained cloud character as a file. The weights are the customer's
* own, a few hundred megabytes: the button shows how far the file is, and a
@@ -249,46 +160,23 @@ function CharacterDownload({ lora }: { lora: CloudLora }) {
function CharacterPanel() {
const backend = useCreateStore((s) => s.backend)
const characterTab = useCreateStore((s) => s.characterTab)
- const setCharacterTab = useCreateStore((s) => s.setCharacterTab)
const triggerWord = useCreateStore((s) => s.triggerWord)
const setTriggerWord = useCreateStore((s) => s.setTriggerWord)
const trainImages = useCreateStore((s) => s.trainImages)
- const selectedCharacter = useCreateStore((s) => s.selectedCharacter)
- const setSelectedCharacter = useCreateStore((s) => s.setSelectedCharacter)
- const charactersVersion = useCreateStore((s) => s.charactersVersion)
const localLane = backend !== 'cloud'
- const [shelf, setShelf] = useState<CloudLora[] | null>(null)
-
- useEffect(() => {
- if (localLane) return
- let live = true
- listLoras()
- .then((l) => { if (live) setShelf(l) })
- .catch(() => { if (live) setShelf([]) })
- return () => { live = false }
- }, [charactersVersion, localLane])
+ // In the Character area the head line picks the character and says
+ // whether this is Image (use) or a new training (sketches v2). The shelf of
+ // chips and the Train/Use switch that stood here are steps 1 and 2 now.
return (
<div className="space-y-2">
<TrainReplaceDialog />
- <div className="flex items-center justify-center">
- <Segmented
- size="sm"
- layoutId="character-tab"
- value={characterTab}
- onChange={(v) => setCharacterTab(v as 'train' | 'use')}
- options={[
- { value: 'train', label: 'Train new' },
- { value: 'use', label: 'Use character' },
- ]}
- />
- </div>
{characterTab === 'train' && localLane && isMlxImageHost() ? (
<MacTrainControls />
) : characterTab === 'train' && localLane ? (
<LocalTrainControls />
) : characterTab === 'use' && localLane ? (
- <LocalCharacterShelf />
+ <LocalCharacterNotes />
) : characterTab === 'train' ? (
<div className="flex items-center justify-center gap-2 flex-wrap">
<input
@@ -308,65 +196,24 @@ function CharacterPanel() {
</p>
</div>
) : (
- <div className="flex items-center justify-center gap-1.5 flex-wrap">
- {shelf === null && <span className="t-label text-gray-600">Loading your characters…</span>}
- {shelf?.length === 0 && (
- <span className="t-label text-gray-600">No characters yet. Train one first.</span>
- )}
- {shelf?.map((c) => {
- const active = selectedCharacter?.id === c.id
- return (
- <div key={c.id} className="flex items-center">
- <button
- onClick={() =>
- setSelectedCharacter(
- active
- ? null
- : { id: c.id, name: c.name, triggerWord: c.trigger_word, family: c.base_family },
- )
- }
- className={cn(
- 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
- active
- ? 'bg-white/10 border-white/20 text-white'
- : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200',
- )}
- title={`${c.name}, trigger word: ${c.trigger_word}`}
- >
- <span className="max-w-[110px] truncate">{c.name}</span>
- <span className="t-label text-gray-500">{FAMILY_LABEL[c.base_family] ?? c.base_family}</span>
- </button>
- <CharacterDownload lora={c} />
- <CharacterUseLocally lora={c} />
- <button
- onClick={() => {
- void deleteLora(c.id)
- .then(() => {
- if (selectedCharacter?.id === c.id) setSelectedCharacter(null)
- useCreateStore.getState().bumpCharactersVersion()
- })
- .catch(() => {})
- }}
- className="p-1 text-gray-600 hover:text-red-400"
- title="Delete character"
- aria-label="Delete character"
- >
- <Trash2 size={11} />
- </button>
- </div>
- )
- })}
- {selectedCharacter && (
- <span className="t-label text-gray-500 w-full text-center">
- Put “{selectedCharacter.triggerWord}” in your prompt to summon the character.
- </span>
- )}
- </div>
+ <CloudCharacterNotes />
)}
</div>
)
}
+/** Image with a cloud character: the one sentence the run needs. */
+function CloudCharacterNotes() {
+ const selectedCharacter = useCreateStore((s) => s.selectedCharacter)
+ return (
+ <p className="hub-dim pt-3 text-center hub-fs-125" data-testid="character-use-hint">
+ {selectedCharacter
+ ? <>Put “{selectedCharacter.triggerWord}” in your prompt to summon the character.</>
+ : 'Pick a character in the head line, or train one from photos.'}
+ </p>
+ )
+}
+
// Das Trainer-Installationspfad-Feld des Erstsetup-Gates. `status` speist nur
// `trainerRootHint`; Wert und Aenderungs-Handler gehoeren dem Aufrufer.
//
@@ -908,124 +755,40 @@ function MacTrainControls() {
)
}
-// Local Use shelf: characters are the trainer's own `char_<name>_zimage`
-// LoRA files. Picking one activates the LoRA on the normal image chain and
-// surfaces the trigger word; generation itself is the plain local image path.
-function LocalCharacterShelf() {
+// Image with a local character: the character is the trainer's own
+// `char_<name>_zimage` LoRA file, picked in step 1 (hub/hubCharacters
+// applyLocalLora puts it on the image chain and brings its model along). This
+// says what the run needs, or why it cannot run, with the way back.
+function LocalCharacterNotes() {
const selectedCharacter = useCreateStore((s) => s.selectedCharacter)
- const setSelectedCharacter = useCreateStore((s) => s.setSelectedCharacter)
- const selectedLoras = useCreateStore((s) => s.selectedLoras)
- const toggleLora = useCreateStore((s) => s.toggleLora)
- const charactersVersion = useCreateStore((s) => s.charactersVersion)
const setImageModel = useCreateStore((s) => s.setImageModel)
const { list: imageModels, value: runModel } = useLocalPick()
- const [chars, setChars] = useState<CharacterRef[] | null>(null)
- // The character the delete dialog asks about, and what went wrong if the
- // file could not be moved to the Trash or the Recycle Bin.
- const [confirmDelete, setConfirmDelete] = useState<{ file: string; trigger: string } | null>(null)
- const [deleting, setDeleting] = useState(false)
- const [deleteError, setDeleteError] = useState<string | null>(null)
-
- const removeCharacter = async (file: string) => {
- setDeleting(true)
- try {
- await deleteLocalCharacter(file)
- // The file is gone: the pick and the LoRA it rode on go with it, so the
- // next render does not ask for a file that is no longer there.
- const store = useCreateStore.getState()
- if (characterLoraFile(store.selectedCharacter) === file) store.setSelectedCharacter(null)
- if (store.selectedLoras.some((l) => l.name === file)) store.toggleLora(file)
- setConfirmDelete(null)
- // ComfyUI rereads its loras folder, then the shelf asks again.
- await refreshComfyModels().catch(() => { /* rescan is best-effort */ })
- store.bumpCharactersVersion()
- } catch (e) {
- setConfirmDelete(null)
- setDeleteError(errorText(e))
- } finally {
- setDeleting(false)
- }
- }
-
- useEffect(() => {
- let live = true
- listLocalCharacters()
- .then((l) => { if (live) setChars(l) })
- .catch(() => { if (live) setChars([]) })
- return () => { live = false }
- }, [charactersVersion])
// A character from an earlier session, or a model changed after the pick:
- // the shelf says so, with the way back. Nothing is said before the model
- // list is in, where every model would read as missing.
+ // this says so, with the way back. Nothing is said before the model list
+ // is in, where every model would read as missing.
const pickedFile = characterLoraFile(selectedCharacter)
const base = pickedFile ? characterBaseModel(pickedFile, imageModels, runModel) : null
const runType = imageModels.find((m) => m.name === runModel)?.type
const block = pickedFile && runType ? characterRunBlock(pickedFile, runType, !!base) : null
return (
- <div className="flex items-center justify-center gap-1.5 flex-wrap">
- {chars === null && <span className="t-label text-gray-600">Loading your characters…</span>}
- {chars !== null && chars.length === 0 && (isMlxImageHost() ? (
- <span className="t-label text-gray-600 w-full text-center" data-testid="mac-no-characters">
- No characters in the LoRA folder yet. A trained character is a file named {'char_<name>_zimage.safetensors'}.{' '}
- <button onClick={() => { void openMlxLoraFolder().catch(() => undefined) }} className="underline text-gray-400 hover:text-white">Open the LoRA folder</button>
+ <div className="flex flex-col items-center gap-1.5 pt-3 text-center hub-fs-125">
+ {!selectedCharacter && (isMlxImageHost() ? (
+ <span className="hub-dim" data-testid="mac-no-characters">
+ A trained character is a file named {'char_<name>_zimage.safetensors'} in the LoRA folder.{' '}
+ <button onClick={() => { void openMlxLoraFolder().catch(() => undefined) }} className="underline hub-muted">Open the LoRA folder</button>
</span>
) : (
- <span className="t-label text-gray-600">No local characters yet. Train one first.</span>
+ <span className="hub-dim">Pick a character in the head line, or train one from photos.</span>
))}
- {(chars ?? []).map((ref) => {
- const active = selectedCharacter?.id === ref.id
- const c = { file: characterLoraFile(ref) ?? '', trigger: ref.triggerWord }
- return (
- <div key={ref.id} className="flex items-center">
- <button
- onClick={() => {
- if (active) {
- setSelectedCharacter(null)
- if (selectedLoras.some((l) => l.name === c.file)) toggleLora(c.file)
- return
- }
- // One character at a time: drop other char LoRAs from the chain.
- for (const l of selectedLoras) {
- if (l.name !== c.file && parseLocalCharacterLora(l.name)) toggleLora(l.name)
- }
- if (!selectedLoras.some((l) => l.name === c.file)) toggleLora(c.file)
- // GH #161: the character brings the model it was trained for.
- const base = characterBaseModel(c.file, imageModels, runModel)
- if (base && base.name !== runModel) setImageModel(base.name, base.type)
- setSelectedCharacter(ref)
- }}
- className={cn(
- 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
- active
- ? 'bg-white/10 border-white/20 text-white'
- : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200',
- )}
- title={`Trigger word: ${c.trigger}`}
- >
- <span className="max-w-[110px] truncate">{c.trigger}</span>
- <span className="t-label text-gray-500">Z-Image</span>
- </button>
- <button
- onClick={() => setConfirmDelete(c)}
- className="p-1 text-gray-600 hover:text-red-400"
- title="Delete character"
- aria-label={`Delete character ${c.trigger}`}
- data-testid="local-character-delete"
- >
- <Trash2 size={11} />
- </button>
- </div>
- )
- })}
{selectedCharacter && !block && (
- <span className="t-label text-gray-500 w-full text-center" data-testid="character-use-hint">
+ <span className="hub-dim" data-testid="character-use-hint">
Put “{selectedCharacter.triggerWord}” in your prompt and describe the key features too. The trigger word alone often does not hold the look.
</span>
)}
{block && (
- <span role="alert" className={cn('t-label w-full text-center flex items-center justify-center gap-2 flex-wrap', HINWEIS_TEXT.fehler)} data-testid="character-model-warning">
+ <span role="alert" className={cn('flex items-center justify-center gap-2 flex-wrap', HINWEIS_TEXT.fehler)} data-testid="character-model-warning">
{block}
{base && (
<button
@@ -1038,18 +801,63 @@ function LocalCharacterShelf() {
)}
</span>
)}
- <Modal open={!!confirmDelete} onClose={() => { if (!deleting) setConfirmDelete(null) }} title="Delete character">
+ </div>
+ )
+}
+
+/** Deletes a local character file (More options of Image). The file moves to
+ * the Trash or the Recycle Bin, after a question. */
+function LocalCharacterDelete({ file, trigger }: { file: string; trigger: string }) {
+ const [asking, setAsking] = useState(false)
+ const [deleting, setDeleting] = useState(false)
+ const [deleteError, setDeleteError] = useState<string | null>(null)
+
+ const removeCharacter = async () => {
+ setDeleting(true)
+ try {
+ await deleteLocalCharacter(file)
+ // The file is gone: the pick and the LoRA it rode on go with it, so the
+ // next render does not ask for a file that is no longer there.
+ const store = useCreateStore.getState()
+ if (characterLoraFile(store.selectedCharacter) === file) store.setSelectedCharacter(null)
+ if (store.selectedLoras.some((l) => l.name === file)) store.toggleLora(file)
+ store.setHubCharacter(null)
+ store.setHubStep('who')
+ setAsking(false)
+ // ComfyUI rereads its loras folder, then the list asks again.
+ await refreshComfyModels().catch(() => { /* rescan is best-effort */ })
+ store.bumpCharactersVersion()
+ } catch (e) {
+ setAsking(false)
+ setDeleteError(errorText(e))
+ } finally {
+ setDeleting(false)
+ }
+ }
+
+ return (
+ <>
+ <button
+ onClick={() => setAsking(true)}
+ className="flex items-center gap-1 p-1 text-gray-600 hover:text-red-400"
+ title="Delete character"
+ aria-label={`Delete character ${trigger}`}
+ data-testid="local-character-delete"
+ >
+ <Trash2 size={11} /> Delete
+ </button>
+ <Modal open={asking} onClose={() => { if (!deleting) setAsking(false) }} title="Delete character">
<p className="text-[0.7rem] text-gray-600 dark:text-gray-300 mb-3">
- Delete the character <span className="text-gray-900 dark:text-white font-mono">{confirmDelete?.trigger}</span>?
+ Delete the character <span className="text-gray-900 dark:text-white font-mono">{trigger}</span>?
Its file moves to the {isMacOS() ? 'Trash' : 'Recycle Bin'}, so you can put it back from there.
</p>
<ModalActions>
- <ModalButton variant="quiet" onClick={() => setConfirmDelete(null)} disabled={deleting}>
+ <ModalButton variant="quiet" onClick={() => setAsking(false)} disabled={deleting}>
Cancel
</ModalButton>
<ModalButton
variant="danger"
- onClick={() => confirmDelete && void removeCharacter(confirmDelete.file)}
+ onClick={() => void removeCharacter()}
disabled={deleting}
data-testid="local-character-delete-confirm"
>
@@ -1065,7 +873,7 @@ function LocalCharacterShelf() {
</ModalButton>
</ModalActions>
</Modal>
- </div>
+ </>
)
}
@@ -1080,28 +888,36 @@ function LipsyncControls() {
// A Mac runs Talking Character itself (LTX-2.3 a2v): a portrait and a voice,
// never a clip to resync, whatever the cloud catalogue says about its pick.
const macLocal = useCreateStore((s) => s.backend) === 'local' && isMlxImageHost()
- // Catalog subscription so the chip row re-renders when the live catalog
+ // Catalog subscription so the rows re-render when the live catalog
// arrives and flips the picked model's source type.
useCloudCatalogStore((s) => s.fetchedAt)
const model = cloudModelById(modelForOp('video', 'lipsync', cloudOpModel))
const needsClip = !macLocal && model?.lipsync_source === 'video'
+ // Talk in the Character area (sketches v2): one line per input, the
+ // character's portrait (or the clip to re-sync), then the voice.
return (
- <div className="flex items-center justify-center gap-2 flex-wrap">
+ <div className="flex flex-col" data-talk-controls>
{macLocal && <MacTalkingPart />}
- {needsClip ? (
- <DrivingVideoChip empty="Add video to resync" />
- ) : (
- <PortraitChip empty="Add portrait" />
- )}
- <VoiceChip
- audioName={audioInput?.name ?? null}
- voiceLabel={voiceFromJob?.label ?? null}
- onAudioFile={(f) => setAudioInput(mediaRefFrom(f))}
- onPickVoice={(jobId, label) => setVoiceFromJob({ jobId, label })}
- onClear={() => { setAudioInput(null); setVoiceFromJob(null) }}
- />
- {macLocal && <MacTalkingWords />}
+ {needsClip ? <DrivingVideoLine empty="Add the clip to re-sync" label="Clip" /> : <PortraitLine empty="Add portrait" />}
+ <HubLine>
+ <span className="hub-text w-[110px] shrink-0">Voice</span>
+ <span className="flex-1" />
+ <VoiceChip
+ flat
+ audioName={audioInput?.name ?? null}
+ voiceLabel={voiceFromJob?.label ?? null}
+ onAudioFile={(f) => setAudioInput(mediaRefFrom(f))}
+ onPickVoice={(jobId, label) => setVoiceFromJob({ jobId, label })}
+ onClear={() => { setAudioInput(null); setVoiceFromJob(null) }}
+ />
+ {(audioInput || voiceFromJob) && (
+ <button onClick={() => { setAudioInput(null); setVoiceFromJob(null) }} className="hub-dim p-1" title="Remove the voice" aria-label="Remove the voice">
+ <X size={12} />
+ </button>
+ )}
+ </HubLine>
+ {macLocal && <div className="pt-2.5"><MacTalkingWords /></div>}
</div>
)
}
@@ -1187,12 +1003,15 @@ function VoiceChip({
onAudioFile,
onPickVoice,
onClear,
+ flat = false,
}: {
audioName: string | null
voiceLabel: string | null
onAudioFile: (f: File) => void
onPickVoice: (jobId: string, label: string) => void
onClear: () => void
+ /** The Character area: text with a small arrow, no box (sketches v2). */
+ flat?: boolean
}) {
const [open, setOpen] = useState(false)
const [makerOpen, setMakerOpen] = useState(false)
@@ -1232,14 +1051,19 @@ function VoiceChip({
<button
onClick={() => setOpen((o) => !o)}
className={cn(
- 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
- value
- ? 'bg-white/[0.06] border-white/10 text-gray-200'
- : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200 hover:border-white/15',
+ flat
+ ? cn('flex items-center gap-1.5 hub-fs-14 transition-colors', value ? 'hub-text font-medium' : 'hub-acc')
+ : cn(
+ 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
+ value
+ ? 'bg-white/[0.06] border-white/10 text-gray-200'
+ : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200 hover:border-white/15',
+ ),
)}
>
- <Mic size={12} />
+ {!flat && <Mic size={12} />}
<span className="max-w-[150px] truncate">{value ?? 'Add voice'}</span>
+ {flat && <ChevronDown size={13} className="hub-dim" />}
</button>
{value && (
<button onClick={onClear} className="p-1 text-gray-500 hover:text-gray-300" title="Remove voice" aria-label="Remove voice">
@@ -1735,12 +1559,67 @@ function CloudExtendControls() {
// ── Motion control ──────────────────────────────────────────────────────────
+/** The portrait line of Motion and Talk: "Character → Bean ▾". It writes the
+ * shared Stage source (an ImageRef with a data-URL preview; the cloud upload
+ * path re-encodes from it). */
+function PortraitLine({ empty }: { empty: string }) {
+ const source = useCreateStore((s) => s.source)
+ const setSource = useCreateStore((s) => s.setSource)
+ const name = hubPortraitName(source?.url)
+ return (
+ <HubLine data-portrait-line>
+ <span className="hub-text w-[110px] shrink-0">Character</span>
+ {!source && <span className="hub-dim">{empty}</span>}
+ <span className="flex-1" />
+ <CharacterPick
+ name={name}
+ image={source?.url ?? null}
+ label="Character image"
+ onPhoto={(f) => { void loadImageRef(f).then(setSource) }}
+ onCharacter={(c) => {
+ void hubPortrait(c).then((r) => { if (r) setSource(r) })
+ .catch((err: unknown) => useCreateStore.getState().setError(errorText(err)))
+ }}
+ />
+ {source && (
+ <button onClick={() => setSource(null)} className="hub-dim p-1" title="Remove" aria-label="Remove the character image">
+ <X size={12} />
+ </button>
+ )}
+ </HubLine>
+ )
+}
+
+/** The video line of Motion (and Talk's re-sync): the clip, large, once it is
+ * there; before that one line to add it. Its name and an X stand in the head
+ * line of the area. */
+function DrivingVideoLine({ empty, label }: { empty: string; label: string }) {
+ const videoInput = useCreateStore((s) => s.videoInput)
+ const setVideoInput = useCreateStore((s) => s.setVideoInput)
+ if (!videoInput) {
+ return (
+ <UploadLine
+ icon={<Film size={15} />}
+ label={empty}
+ accept="video/mp4,video/webm,video/quicktime"
+ onFile={(f) => setVideoInput(mediaRefFrom(f))}
+ />
+ )
+ }
+ return (
+ <figure className="flex flex-col items-center pt-3" data-driving-video>
+ <video src={videoInput.url} muted loop autoPlay playsInline aria-label={label} className="max-h-[min(36vh,280px)] max-w-full rounded-lg bg-black object-contain" />
+ </figure>
+ )
+}
+
function MotionControls() {
const backend = useCreateStore((s) => s.backend)
const videoInput = useCreateStore((s) => s.videoInput)
// Sound on the cloud lanes only: the local lanes have no lip sync step and
- // no worker to lay the sound under (14.11.2026, as on the web).
- const cloud = soundApplies('motion', backend)
+ // no worker to lay the sound under (14.11.2026, as on the web). And only
+ // for an account the server released it for (features.characterHub).
+ const cloud = soundApplies('motion', backend, useCharacterHubReleased())
const [measured, setMeasured] = useState<{ url: string; seconds: number | undefined } | null>(null)
useEffect(() => {
let alive = true
@@ -1749,12 +1628,13 @@ function MotionControls() {
return () => { alive = false }
}, [cloud, videoInput])
const videoSeconds = measured && videoInput && measured.url === videoInput.url ? measured.seconds : undefined
+ // Motion in the Character area (sketches v2): the character, the video
+ // whose moves it copies, the sound.
return (
- <div className="flex flex-col items-center gap-2.5">
- <div className="flex items-center justify-center gap-2 flex-wrap">
- <PortraitChip empty="Add character image" />
- <DrivingVideoChip empty="Add driving video (dance/pose)" />
- </div>
+ <div className="flex flex-col" data-motion-controls>
+ <PortraitLine empty="Add character image" />
+ <DrivingVideoLine empty="Add driving video (dance/pose)" label="Motion video" />
+ {videoInput && <p className="hub-dim pb-1 text-center hub-fs-12">Your character copies the moves of this video.</p>}
{cloud && <SoundControls intent="motion" people={1} clipSeconds={videoSeconds} withPrice />}
</div>
)
@@ -1762,11 +1642,11 @@ function MotionControls() {
// ── Sound (14.11.2026, David; port of the web's SoundControls): the original
// sound, no sound, or a new voice with the lips in sync. Swap and Motion,
-// cloud only (lib/render/sound.ts). ──
+// cloud only, released accounts only (lib/render/sound.ts). ──
function SoundControls({ intent, people, clipSeconds, withPrice = false }: {
intent: CreateIntent; people: number; clipSeconds: number | undefined
- /** Motion has no length slider: the price of the lip sync step stands here. */
+ /** Motion has no length in the bar: the price of the lip sync step stands here. */
withPrice?: boolean
}) {
const backend = useCreateStore((s) => s.backend)
@@ -1809,9 +1689,10 @@ function SoundControls({ intent, people, clipSeconds, withPrice = false }: {
const cut = active && lipsyncCut(audioSeconds, clipSeconds)
return (
- <div className="w-full space-y-1.5" data-sound-controls={intent}>
- <div className="flex flex-wrap items-center gap-2">
- <span className="t-control text-gray-400">Sound</span>
+ <div className="w-full" data-sound-controls={intent}>
+ <HubLine className="flex-wrap gap-y-1 py-1.5">
+ <span className="hub-text w-[42px] shrink-0">Sound</span>
+ <span className="contents hub-seg">
<Segmented
size="sm"
layoutId={`sound-${intent}`}
@@ -1824,14 +1705,17 @@ function SoundControls({ intent, people, clipSeconds, withPrice = false }: {
...(c === 'lipsync' && blocked ? { disabled: true, title: blocked } : {}),
}))}
/>
- </div>
- {blocked && (
- <p className="t-control text-gray-500" data-sound-note="lipsync-blocked">{blocked}</p>
- )}
+ </span>
+ {blocked && (
+ <span className="hub-dim hub-fs-11" data-sound-note="lipsync-blocked">{blocked === LIPSYNC_ONE_PERSON ? 'one person only' : blocked}</span>
+ )}
+ </HubLine>
{active && (
- <div className="space-y-1.5" data-sound-lipsync>
- <div className="flex flex-wrap items-center gap-2">
+ <div className="hub-line space-y-1.5 border-b py-2" data-sound-lipsync>
+ <div className="flex flex-wrap items-center gap-2.5 hub-fs-14">
+ <span className="hub-text w-[42px] shrink-0">Voice</span>
<VoiceChip
+ flat
audioName={audioInput?.name ?? null}
voiceLabel={voiceFromJob?.label ?? null}
onAudioFile={(f) => setAudioInput(mediaRefFrom(f))}
@@ -1839,20 +1723,20 @@ function SoundControls({ intent, people, clipSeconds, withPrice = false }: {
onClear={() => { setAudioInput(null); setVoiceFromJob(null) }}
/>
{credits != null && (
- <span className="t-control text-gray-500 tabular-nums" data-sound-price>
+ <span className="hub-dim hub-fs-125 tabular-nums" data-sound-price>
+ lip sync {withPrice ? `${credits.toLocaleString('en-US')} credits` : swapShortCredits(credits)}
{audioSeconds !== undefined ? ` (${Math.ceil(lipsyncSeconds(audioSeconds, clipSeconds)! - 1e-6)} s)` : ''}
</span>
)}
</div>
- <p className="t-control text-gray-500">After the video, a second step puts the new voice in and moves the lips to it.</p>
+ <p className="hub-dim hub-fs-125">After the video, a second step puts the new voice in and moves the lips to it.</p>
{cut && (
- <p className={cn('t-control', HINWEIS_TEXT.ruhig)} data-sound-note="cut">
+ <p className="hub-dim hub-fs-125" data-sound-note="cut">
Your voice is {Math.round(audioSeconds!)} s, the clip {Math.round(clipSeconds!)} s. The voice is cut to the clip.
</p>
)}
- <details className="t-control text-gray-500">
- <summary className="cursor-pointer select-none">More</summary>
+ <details className="hub-dim hub-fs-125">
+ <summary className="cursor-pointer select-none">Lip sync model</summary>
<div className="mt-1.5">
<Segmented
size="sm"
@@ -1871,21 +1755,21 @@ function SoundControls({ intent, people, clipSeconds, withPrice = false }: {
}
// ── Swap Character (07.11.2026, port of the web's C52; two steps since
-// 14.11.2026) ───────────────────────────────────────────────────────────────
+// 14.11.2026; in the Character area since part B, sketches v2) ──────────────
//
-// The order of the web panel: the notes first (what the models cannot do, so
-// it is not learned from a failed run), the video and the resolution, the
-// first frame to tap each person to replace, the people (photo and role each),
-// the length with its price, the consent box for the models that need it, and
-// on SCAIL 2 and Kling the frame step (build, check, Continue). Create and its
-// price stand in the Composer's action bar below.
+// The input part of the sketch: the video, its first frame with a numbered
+// mark per person to replace, one line per person ("1 the person on the left
+// → Bean ▾"), the sound, the consent in one line. The length, the model and
+// the price stand in the bar at the foot (Composer, hub). The frame step
+// (Build first frame, Does this look right?, Continue) is SwapFrameBuild as
+// it was; the one click flow replaces it later.
export function SwapControls() {
const videoInput = useCreateStore((s) => s.videoInput)
+ const setVideoInput = useCreateStore((s) => s.setVideoInput)
const figures = useCreateStore((s) => s.swapFigures)
const setFigures = useCreateStore((s) => s.setSwapFigures)
const swapSeconds = useCreateStore((s) => s.swapSeconds)
- const setSwapSeconds = useCreateStore((s) => s.setSwapSeconds)
const consent = useCreateStore((s) => s.swapConsent)
const setConsent = useCreateStore((s) => s.setSwapConsent)
const options = useCreateStore((s) => s.cloudStudioOptions)
@@ -1893,9 +1777,7 @@ export function SwapControls() {
const opModel = useCreateStore((s) => s.cloudOpModel)
const setOpModel = useCreateStore((s) => s.setCloudOpModel)
const isGenerating = useCreateStore((s) => s.isGenerating)
- const frame = useCreateStore((s) => s.swapFrame)
- // New voice with lips: its step joins the price on the slider.
- const lipsyncShown = useCreateStore((s) => (s.sound === 'lipsync' ? s.lipsyncCredits : null))
+ const released = useCharacterHubReleased()
const model = createRunModel('swap_character', { image: '', video: '', op: opModel })
// SCAIL 2 and Kling: the first frame first, then the video (SwapFrameSteps).
const twoStep = swapUsesFrame(SWAP_INTENT, model)
@@ -1925,8 +1807,8 @@ export function SwapControls() {
if (auto && known && target !== model) setOpModel(target)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [auto, known, target])
- // What Swap presets (SCAIL 2: 720p) stands in the store, so slider, button
- // and run see the same number.
+ // What Swap presets (SCAIL 2: 720p) stands in the store, so the bar and
+ // the run see the same number.
useEffect(() => {
if (!known) return
const preset = swapDefaultOptions(SWAP_INTENT, model)
@@ -1938,164 +1820,241 @@ export function SwapControls() {
if (people > swapMaxPeople(model)) setOpModel(swapAutoModel(people))
}
+ if (!released) {
+ // Without the account switch (features.characterHub) the server refuses
+ // the new swap. Said quietly, nothing to fill in.
+ return (
+ <p className="hub-dim py-8 text-center hub-fs-14" data-swap-unavailable="soon">
+ {HUB_SWAP_SOON}
+ </p>
+ )
+ }
if (!known) {
// The server's catalogue does not list the swap models yet.
return (
- <p className="t-body text-gray-500 text-center" data-swap-unavailable>
+ <p className="hub-dim py-8 text-center hub-fs-14" data-swap-unavailable>
Swap Character is not available on this LU Cloud yet.
</p>
)
}
const maxPeople = swapMaxPeople(model)
- const roles = swapReadsRoles(model) || twoStep
const placed = swapFigureRoles(figures.map((f) => ({ ...f, role: '' })))
- const frameCredits = twoStep ? swapFrameCredits(frame?.width ?? 9, frame?.height ?? 16, figures.length) : null
// The marks in the first frame: up to the limit of Swap (OpenJutsu: 4).
const markMax = swapMaxPeople(SWAP_OPENJUTSU_MODEL)
- const resolutions = (studioFields(model).resolution?.enum ?? []) as string[]
- const resolution = String(studioShownValue(model, options, 'resolution') ?? '')
const setFigure = (i: number, patch: Partial<SwapFigure>) => setFigures(figures.map((f, j) => (j === i ? { ...f, ...patch } : f)))
+ const limits = swapClipLimits(model)
+ const video = videoSeconds !== undefined ? Math.floor(videoSeconds + 0.05) : undefined
return (
- <div className="flex flex-col items-center gap-2.5" data-swap-controls data-swap-two-step={twoStep || undefined}>
- {/* Grey, not a warning (the desktop's house rule, lib/hinweis.ts). */}
- <div className="flex w-full items-start gap-1.5 t-control text-gray-500" data-swap-tips>
- <Info size={12} className="mt-[2px] shrink-0" />
- <ul className="space-y-0.5">{SWAP_TIPS.map((t) => <li key={t}>{t}</li>)}</ul>
- </div>
- <div className="flex w-full items-center justify-between gap-2 flex-wrap">
- <DrivingVideoChip empty="Add original video" />
- {resolutions.length > 1 && (
- <Segmented
- size="sm"
- layoutId="swap-resolution"
- ariaLabel="Resolution"
- value={resolution}
- onChange={(v) => setOptions({ ...options, resolution: v })}
- options={resolutions.map((r) => ({ value: r, label: r }))}
+ <div className="flex flex-col" data-swap-controls data-swap-two-step={twoStep || undefined}>
+ {!videoInput ? (
+ <>
+ <UploadLine
+ icon={<Film size={15} />}
+ label="Add the original video"
+ accept="video/mp4,video/webm,video/quicktime"
+ onFile={(f) => setVideoInput(mediaRefFrom(f))}
+ note={`${limits.min} to ${limits.max} s`}
/>
- )}
- </div>
-
- {videoInput && <SwapFramePicker max={markMax} onCount={fitPeople} />}
+ {/* Grey, not a warning (the desktop's house rule, lib/hinweis.ts). */}
+ <ul className="hub-dim space-y-0.5 pt-2.5 hub-fs-125" data-swap-tips>
+ {SWAP_TIPS.map((t) => <li key={t}>{t}</li>)}
+ </ul>
+ </>
+ ) : (
+ <SwapFramePicker max={markMax} onCount={fitPeople} />
+ )}
- <div className="w-full space-y-1" data-swap-figures={figures.length}>
+ <div className="hub-line mt-1 border-t" data-swap-figures={figures.length}>
{figures.map((f, i) => (
- <div key={i} className="flex items-center gap-2" data-swap-figure={i + 1}>
- <span className="grid h-6 w-6 shrink-0 place-items-center rounded-full bg-lu-accent/15 t-micro font-semibold text-lu-accent">{i + 1}</span>
- <FigurePhoto image={f.image} index={i} onImage={(image) => setFigure(i, { image })} />
- {roles ? (
- <input
- type="text"
- value={f.role}
- maxLength={200}
- disabled={isGenerating}
- aria-label={`Who person ${i + 1} replaces`}
- placeholder={placed[i]
- ? `${placed[i]} (or describe who)`
- : figures.length > 1 ? 'Who? e.g. the woman in black on the left' : 'Optional: who to replace (default: the most prominent person)'}
- onChange={(e) => setFigure(i, { role: e.target.value })}
- className="t-control h-[var(--control-h-sm)] min-w-0 flex-1 rounded-md border border-white/[0.08] bg-white/[0.03] px-2 text-gray-200 placeholder:text-gray-500"
- />
- ) : (
- <span className="t-body flex-1 text-gray-500">{i === 0 ? 'Replaces the main person' : ''}</span>
- )}
- {figures.length > 1 && (
+ <HubLine key={i} data-swap-figure={i + 1}>
+ <span className="hub-acc w-3.5 shrink-0 hub-fs-125 font-semibold tabular-nums">{i + 1}</span>
+ <input
+ type="text"
+ value={f.role}
+ maxLength={200}
+ disabled={isGenerating}
+ aria-label={`Who person ${i + 1} replaces`}
+ placeholder={placed[i]
+ ? placed[i]
+ : figures.length > 1 ? 'Who? e.g. the woman in black on the left' : 'the main person'}
+ onChange={(e) => setFigure(i, { role: e.target.value })}
+ className="hub-role hub-text min-w-0 flex-1 bg-transparent hub-fs-14 outline-none"
+ />
+ <CharacterPick
+ name={f.character ?? null}
+ image={f.image?.url ?? null}
+ label={`Character for person ${i + 1}`}
+ inputData={{ 'data-swap-photo-input': String(i + 1) }}
+ disabled={isGenerating}
+ onPhoto={(file) => { void loadImageRef(file).then((image) => setFigure(i, { image, character: null })) }}
+ onCharacter={(c) => {
+ void hubPortrait(c).then((image) => { if (image) setFigure(i, { image, character: c.name }) })
+ .catch((err: unknown) => useCreateStore.getState().setError(errorText(err)))
+ }}
+ />
+ {figures.length > 1 && !(twoStep && videoInput) && (
<button
type="button"
aria-label={`Remove person ${i + 1}`}
disabled={isGenerating}
onClick={() => setFigures(figures.filter((_, j) => j !== i))}
- className="rounded p-1 text-gray-500 hover:text-gray-200"
+ className="hub-dim rounded p-1"
>
- <X size={13} />
+ <X size={12} />
</button>
)}
- </div>
+ </HubLine>
))}
- <div className="flex items-center gap-2">
- {/* SCAIL 2 and Kling: people come in by a tap on the first frame.
- Without a video, and with OpenJutsu, also by this button. */}
- {(!twoStep || !videoInput) && (
- <button
- type="button"
- disabled={figures.length >= 4 || isGenerating}
- onClick={() => {
- // Not every model takes several people. The switch is said in
- // the sentence below, it does not happen silently.
- fitPeople(figures.length + 1)
- setFigures([...figures, { image: null, role: '' }])
- }}
- className="t-control h-[var(--control-h-sm)] rounded-md px-2 text-gray-400 hover:text-gray-200 disabled:opacity-40"
- >
- + Add person ({figures.length}/4)
- </button>
- )}
- {figures.length > 1 && maxPeople < figures.length && (
- <span className="t-body text-gray-500 dark:text-gray-400" data-swap-note="one-person-model">
- {modelLabel(model)} replaces {maxPeople === 1 ? 'one person' : `up to ${maxPeople} people`}.
- </span>
- )}
- </div>
+ {((!twoStep || !videoInput) || (figures.length > 1 && maxPeople < figures.length)) && (
+ <div className="flex min-h-8 items-center gap-3 hub-fs-125">
+ {/* SCAIL 2 and Kling: people come in by a tap on the first frame.
+ Without a video, and with OpenJutsu, also by this line. */}
+ {(!twoStep || !videoInput) && (
+ <button
+ type="button"
+ disabled={figures.length >= 4 || isGenerating}
+ onClick={() => {
+ // Not every model takes several people. The switch is said in
+ // the sentence beside it, it does not happen silently.
+ fitPeople(figures.length + 1)
+ setFigures([...figures, { image: null, role: '' }])
+ }}
+ className="hub-acc disabled:opacity-40"
+ >
+ + Add person ({figures.length}/4)
+ </button>
+ )}
+ {figures.length > 1 && maxPeople < figures.length && (
+ <span className="hub-dim" data-swap-note="one-person-model">
+ {modelLabel(model)} replaces {maxPeople === 1 ? 'one person' : `up to ${maxPeople} people`}.
+ </span>
+ )}
+ </div>
+ )}
</div>
- <ClipLength
- model={model}
- options={options}
- videoSeconds={videoSeconds}
- chosen={swapSeconds}
- onChange={setSwapSeconds}
- photos={swapBilledPhotos(model, figures.length)}
- disabled={isGenerating}
- frameCredits={frameCredits}
- lipsyncCredits={lipsyncShown}
- />
+ {video !== undefined && video > limits.max && (
+ <p className="hub-dim pt-2 hub-fs-125" data-clip-note="too-long">
+ Your video is {video} s. {modelLabel(model)} reads at most {limits.max} s, so only the first {Math.min(swapSeconds ?? limits.max, limits.max)} s are used.
+ </p>
+ )}
+ {video !== undefined && video < limits.min && (
+ <p className="hub-dim pt-2 hub-fs-125" data-clip-note="too-short">
+ Your video is {video} s. {modelLabel(model)} needs at least {limits.min} s.
+ </p>
+ )}
+
<SoundControls intent={SWAP_INTENT} people={figures.length}
clipSeconds={soundClipSeconds(SWAP_INTENT, model, swapSeconds, videoSeconds)} />
{swapNeedsConsent(model) && (
// A real person is swapped for a photo: the customer confirms rights
// and consent first (the server asks too, for the frame step as for
// the video).
- <label className="flex w-full items-start gap-2 t-control text-gray-300 cursor-pointer" data-swap-consent>
+ <label className="hub-muted flex w-full cursor-pointer items-start gap-2.5 pt-3 hub-fs-125" data-swap-consent>
<input
type="checkbox"
checked={consent}
disabled={isGenerating}
onChange={(e) => setConsent(e.target.checked)}
- className="mt-[3px] shrink-0 accent-[var(--color-lu-accent)]"
+ className="mt-px h-3 w-3 shrink-0 accent-[var(--color-lu-accent)]"
/>
<span>{SWAP_CONSENT_TEXT}</span>
</label>
)}
- {twoStep && <SwapFrameBuild model={model} />}
+ {twoStep && <div className="pt-3"><SwapFrameBuild model={model} /></div>}
</div>
)
}
-/** The photo of one person: a small field to click, with a preview. */
-function FigurePhoto({ image, index, onImage }: { image: SwapFigure['image']; index: number; onImage: (image: SwapFigure['image']) => void }) {
- const ref = useRef<HTMLInputElement>(null)
+/** What "More options" holds in a panel of the Character area. Nothing that
+ * was there before falls away: the resolution and the notes of Swap, the
+ * character's file actions of Image. The model's full schema stays one click
+ * further, in the settings drawer (CharacterHub links it). */
+export function SpecialMore({ intent }: { intent: CreateIntent }) {
+ if (intent === 'swap_character') return <SwapMore />
+ if (intent === 'character') return <CharacterMore />
+ return null
+}
+
+function SwapMore() {
+ const options = useCreateStore((s) => s.cloudStudioOptions)
+ const setOptions = useCreateStore((s) => s.setCloudStudioOptions)
+ const opModel = useCreateStore((s) => s.cloudOpModel)
+ const videoInput = useCreateStore((s) => s.videoInput)
+ const released = useCharacterHubReleased()
+ const model = createRunModel('swap_character', { image: '', video: '', op: opModel })
+ if (!released || !STUDIO_MODELS[model]) return null
+ const resolutions = (studioFields(model).resolution?.enum ?? []) as string[]
+ const resolution = String(studioShownValue(model, options, 'resolution') ?? '')
return (
- <button
- type="button"
- aria-label={image ? `Change photo of person ${index + 1}` : `Add photo of person ${index + 1}`}
- onClick={() => ref.current?.click()}
- className={cn(
- 'relative grid h-9 w-7 shrink-0 place-items-center overflow-hidden rounded-md border',
- image ? 'border-white/10' : 'border-dashed border-white/20 text-gray-500 hover:text-gray-300',
+ <>
+ {resolutions.length > 1 && (
+ <div className="flex items-center gap-2.5 hub-fs-125">
+ <span className="hub-muted w-[80px]">Resolution</span>
+ <Segmented
+ size="sm"
+ layoutId="swap-resolution"
+ ariaLabel="Resolution"
+ value={resolution}
+ onChange={(v) => setOptions({ ...options, resolution: v })}
+ options={resolutions.map((r) => ({ value: r, label: r }))}
+ />
+ </div>
)}
- >
- {image ? <img src={image.url} alt={`New person ${index + 1}`} className="h-full w-full object-cover" /> : <ImagePlus size={14} />}
- <input
- ref={ref}
- type="file"
- accept="image/*"
- className="hidden"
- data-swap-photo-input={index + 1}
- onChange={(e) => { const f = e.target.files?.[0]; if (f) void loadImageRef(f).then(onImage); e.target.value = '' }}
- />
- </button>
+ {videoInput && (
+ <ul className="hub-dim flex items-start gap-1.5 hub-fs-125" data-swap-tips>
+ <Info size={12} className="mt-[2px] shrink-0" />
+ <span className="space-y-0.5">{SWAP_TIPS.map((t) => <li key={t} className="list-none">{t}</li>)}</span>
+ </ul>
+ )}
+ </>
+ )
+}
+
+/** Image: what can be done with the picked character's file. */
+function CharacterMore() {
+ const backend = useCreateStore((s) => s.backend)
+ const characterTab = useCreateStore((s) => s.characterTab)
+ const hubCharacter = useCreateStore((s) => s.hubCharacter)
+ const setSelectedCharacter = useCreateStore((s) => s.setSelectedCharacter)
+ const setHubCharacter = useCreateStore((s) => s.setHubCharacter)
+ const lora = hubCharacter?.lora
+ const localFile = characterLoraFile(hubCharacter?.ref)
+ if (characterTab !== 'use' || !hubCharacter) return null
+ if (localFile && hubCharacter.ref) {
+ return (
+ <div className="flex items-center gap-1 hub-fs-125" data-character-file-actions>
+ <span className="hub-muted mr-2">{hubCharacter.name}</span>
+ <LocalCharacterDelete file={localFile} trigger={hubCharacter.ref.triggerWord} />
+ </div>
+ )
+ }
+ if (backend !== 'cloud' || !lora) return null
+ return (
+ <div className="flex items-center gap-1 hub-fs-125" data-character-file-actions>
+ <span className="hub-muted mr-2">{hubCharacter.name}</span>
+ <CharacterDownload lora={lora} />
+ <CharacterUseLocally lora={lora} />
+ <button
+ onClick={() => {
+ void deleteLora(lora.id)
+ .then(() => {
+ setSelectedCharacter(null)
+ setHubCharacter(null)
+ useCreateStore.getState().setHubStep('who')
+ useCreateStore.getState().bumpCharactersVersion()
+ })
+ .catch(() => {})
+ }}
+ className="p-1 text-gray-600 hover:text-red-400"
+ title="Delete character"
+ aria-label="Delete character"
+ >
+ <Trash2 size={11} />
+ </button>
+ </div>
)
}
diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsx
index bfd8ef37..7d1cfc00 100644
--- a/src/components/create/experimental/Stage.tsx
+++ b/src/components/create/experimental/Stage.tsx
@@ -52,6 +52,11 @@ import { ComfyAutostartToggle } from './ComfyAutostartToggle'
import { stageHowtoTopic } from '../../../lib/howto'
interface Props {
+ /** The Character area (sketches v2): the stage shows only what it has to
+ * show (a run, a result, a setup card, the training set), flat on the
+ * surface, and nothing at all while it would be empty; the inputs stand
+ * in the area itself. */
+ hub?: boolean
displayed?: GalleryItem
onOpenMaskEditor: () => void
/** Adopt a finished result as the edit source, THEN open the mask editor —
@@ -72,7 +77,7 @@ interface Props {
comfyStarting?: boolean
}
-export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResult, onFullscreen, onShowPrompt, onSaveCharacter, comfyStarting }: Props) {
+export function Stage({ hub = false, displayed, onOpenMaskEditor, onEditResult, onAnimateResult, onFullscreen, onShowPrompt, onSaveCharacter, comfyStarting }: Props) {
const intent = useCreateStore((s) => s.intent())
const meta = INTENT_MAP[intent]
// The width of the stage, for the how-to line at its foot (footLine below).
@@ -199,7 +204,8 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu
howtoOnlyWide = true
} else if (intent === 'swap_character' && !(displayed && displayed.intent === 'swap_character')) {
// Swap Character: original + new people -> result, until a swap is there.
- body = <SwapStage />
+ // In the Character area the panel shows the video and its people.
+ body = hub ? null : <SwapStage />
} else if (displayed) {
body = (
<ResultView
@@ -214,6 +220,9 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu
side={meta.needsSource && source ? <ResultInputs /> : imageRefSide ? <ImageReferenceStrip /> : undefined}
/>
)
+ } else if (hub) {
+ // An empty stage has nothing to say in the Character area.
+ body = null
} else {
// D-A9/D-W3-7, die zwoelfte Einbindung: hier stand die 512x512-Bitmap des
// Monogramms unter ihrem zweiten Dateinamen (die `-white`-Fassung ist
@@ -254,6 +263,21 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu
const footLine = howtoAtFoot && !!howtoTopic && !(howtoOnlyWide && stageWidth !== null && stageWidth < FIT_SIDE_FROM)
+ if (hub) {
+ if (body === null) return null
+ return (
+ <div
+ ref={stageRef}
+ data-testid="create-stage"
+ className={cn('relative flex w-full flex-col overflow-hidden', characterTrain ? 'min-h-[min(52vh,26rem)]' : 'h-[min(52vh,26rem)]')}
+ >
+ <AnimatePresence mode="wait">
+ <StageLayer key={intent + (isGenerating ? ':gen' : '')}>{body}</StageLayer>
+ </AnimatePresence>
+ </div>
+ )
+ }
+
return (
// The viewer canvas: ONE fixed, centred frame that is identical on every tab
// (Image / Edit / Cutout / Video) — same height and width — so switching
diff --git a/src/components/create/experimental/SwapFrameSteps.tsx b/src/components/create/experimental/SwapFrameSteps.tsx
index 8e5b3078..541da0cb 100644
--- a/src/components/create/experimental/SwapFrameSteps.tsx
+++ b/src/components/create/experimental/SwapFrameSteps.tsx
@@ -89,7 +89,7 @@ export function SwapFramePicker({ max, onCount }: { max: number; onCount: (peopl
const box = useRef<HTMLDivElement>(null)
if (!frame) {
return (
- <div className="flex h-24 w-full items-center justify-center rounded-lg border border-dashed border-white/10 t-control text-gray-500" data-swap-frame="loading">
+ <div className="hub-dim flex h-24 w-full items-center justify-center hub-fs-125" data-swap-frame="loading">
Reading the first frame…
</div>
)
@@ -115,9 +115,10 @@ export function SwapFramePicker({ max, onCount }: { max: number; onCount: (peopl
setFigures(next)
}
+ // The Character area (sketches v2): the frame large and without a border,
+ // a small numbered mark per person, the one line under it says what to do.
return (
- <div className="flex w-full flex-col items-center gap-1.5" data-swap-frame="picker">
- <p className="t-control text-gray-300">{SWAP_TAP_TEXT}</p>
+ <div className="flex w-full flex-col items-center gap-2 pt-3" data-swap-frame="picker">
<div
ref={box}
role="group"
@@ -127,8 +128,8 @@ export function SwapFramePicker({ max, onCount }: { max: number; onCount: (peopl
if (!r || !r.width || !r.height) return
add((e.clientX - r.left) / r.width, (e.clientY - r.top) / r.height)
}}
- className={cn('relative max-w-full overflow-hidden rounded-lg border border-white/10 bg-white/[0.03]', marked < max && 'cursor-crosshair')}
- style={{ aspectRatio: `${frame.width} / ${frame.height}`, height: `min(46vh, 420px, calc(min(100vw - 58px, 560px) * ${(frame.height / frame.width).toFixed(4)}))` }}
+ className={cn('relative max-w-full overflow-hidden rounded-lg bg-black', marked < max && 'cursor-crosshair')}
+ style={{ aspectRatio: `${frame.width} / ${frame.height}`, height: `min(40vh, 300px, calc(min(100vw - 40px, 490px) * ${(frame.height / frame.width).toFixed(4)}))` }}
>
<img src={frame.url} alt="" draggable={false} className="pointer-events-none h-full w-full select-none object-cover" />
{figures.map((f, i) => f.mark && (
@@ -138,16 +139,19 @@ export function SwapFramePicker({ max, onCount }: { max: number; onCount: (peopl
aria-label={`Remove mark ${i + 1}`}
data-swap-mark={i + 1}
onClick={(e) => { e.stopPropagation(); remove(i) }}
- // 44 px to hit with a finger or a trackpad, the circle inside is what shows.
+ // 44 px to hit with a finger or a trackpad, the circle inside is
+ // what shows: 22 px, on a phone 26 px.
className="absolute grid h-11 w-11 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full"
style={{ left: `${f.mark.x * 100}%`, top: `${f.mark.y * 100}%` }}
>
- <span className="grid h-7 w-7 place-items-center rounded-full bg-lu-accent t-control font-semibold text-white shadow-[0_0_0_2px_rgba(255,255,255,0.9),0_2px_8px_rgba(0,0,0,0.45)]">{i + 1}</span>
+ <span className="grid h-[19px] w-[19px] place-items-center rounded-full bg-lu-accent hub-fs-12 font-semibold text-gray-900 shadow-[0_0_0_1.5px_rgba(255,255,255,0.95),0_1px_6px_rgba(0,0,0,0.45)] max-[520px]:h-[23px] max-[520px]:w-[23px]">{i + 1}</span>
</button>
))}
</div>
- <p className="t-control text-gray-500" data-swap-frame-count={marked}>
- {marked === 0 ? 'No mark: the main person is replaced.' : `${marked} of ${max} ${max === 1 ? 'person' : 'people'} marked. Tap a number to remove it.`}
+ <p className="hub-dim text-center hub-fs-12" data-swap-frame-count={marked}>
+ {marked === 0
+ ? `${SWAP_TAP_TEXT}. Without a mark the main person is replaced.`
+ : marked >= max ? `${marked} of ${max} people marked. Tap a number to remove it.` : `${SWAP_TAP_TEXT}. Tap a number to remove it.`}
</p>
</div>
)
diff --git a/src/components/create/experimental/__tests__/cloud-features-off-means-no-cloud-in-local.test.tsx b/src/components/create/experimental/__tests__/cloud-features-off-means-no-cloud-in-local.test.tsx
index 3c4c0ca2..f0fdf719 100644
--- a/src/components/create/experimental/__tests__/cloud-features-off-means-no-cloud-in-local.test.tsx
+++ b/src/components/create/experimental/__tests__/cloud-features-off-means-no-cloud-in-local.test.tsx
@@ -64,13 +64,17 @@ describe('the rule', () => {
})
describe('the bar', () => {
- it('on: Erase and Swap carry the cloud tag and open the Cloud sheet, Enhance is a local tab', () => {
+ it('on: Erase carries the cloud tag and opens the Cloud sheet, Enhance is a local tab', () => {
render(<IntentBar />)
- // Swap Character (07.11.2026) has no local lane either: a cloud pill.
- expect(cloudTagged().map((b) => b.textContent)).toEqual(['Erase', 'Swap'])
- fireEvent.click(screen.getByRole('radio', { name: /Swap Character/ }))
- expect(useUIStore.getState().cloudTeaser).toEqual({ surface: 'intent', intent: 'swap_character' })
- useUIStore.setState({ cloudTeaser: null })
+ // Swap Character has no local lane either, but it is an action of the
+ // Character area now (3.1.0 part B): the area's pill is a local tab, and
+ // Swap shows its cloud lock inside the area.
+ expect(cloudTagged().map((b) => b.textContent)).toEqual(['Erase'])
+ expect(screen.queryByRole('radio', { name: /Swap Character/ })).toBeNull()
+ fireEvent.click(screen.getByRole('radio', { name: 'Character' }))
+ expect(useUIStore.getState().cloudTeaser).toBeNull()
+ expect(useCreateStore.getState().intent()).toBe('character')
+ expect(useCreateStore.getState().hubStep).toBe('who')
fireEvent.click(screen.getByRole('radio', { name: /Erase Object/ }))
expect(useUIStore.getState().cloudTeaser).toEqual({ surface: 'intent', intent: 'eraser' })
useUIStore.setState({ cloudTeaser: null })
diff --git a/src/components/create/experimental/__tests__/ein-lokaler-charakter-laesst-sich-loeschen.test.tsx b/src/components/create/experimental/__tests__/ein-lokaler-charakter-laesst-sich-loeschen.test.tsx
index 67fe6546..c6004054 100644
--- a/src/components/create/experimental/__tests__/ein-lokaler-charakter-laesst-sich-loeschen.test.tsx
+++ b/src/components/create/experimental/__tests__/ein-lokaler-charakter-laesst-sich-loeschen.test.tsx
@@ -2,6 +2,9 @@
/**
* D6 (3.0.7): ein trainierter lokaler Charakter laesst sich loeschen.
*
+ * Seit 3.1.0 Teil B steht der Knopf unter "More options" des Bereichs
+ * Character, Aktion Image, fuer den in Schritt 1 gewaehlten Charakter.
+ *
* Create, Character, Use character zeigt die lokalen Charaktere aus
* `models/loras` (`char_<name>_zimage.safetensors`). Die Cloud-Liste hatte
* einen Papierkorb-Knopf, die lokale nicht: wer einen misslungenen Charakter
@@ -34,8 +37,16 @@ vi.mock('../../../../api/comfyui', () => ({
}))
vi.mock('../../../../api/cloud/loras', () => ({ listLoras: vi.fn(async () => []), deleteLora: vi.fn() }))
-import { SpecialControls } from '../SpecialIntentControls'
+import { SpecialMore } from '../SpecialIntentControls'
import { useCreateStore } from '../../../../stores/createStore'
+import { listLocalCharacters, characterFromLora } from '../../../../lib/characters'
+import { hubFromLocal } from '../../../../lib/create/character-hub'
+
+/** The character picked in step 1, and its More options. */
+function showMore(file: string) {
+ useCreateStore.setState({ hubCharacter: hubFromLocal(characterFromLora(file)!) })
+ return render(<SpecialMore intent="character" />)
+}
const ANNA = 'char_anna_zimage.safetensors'
@@ -53,23 +64,27 @@ beforeEach(() => {
})
})
-async function deleteButtons() {
- await screen.findByText('anna')
- return screen.getAllByTestId('local-character-delete')
+async function deleteButton(file = ANNA) {
+ showMore(file)
+ return screen.findByTestId('local-character-delete')
}
describe('ein lokaler Charakter laesst sich loeschen', () => {
- it('jeder lokale Charakter hat einen Loeschknopf, die fremde LoRA nicht', async () => {
- render(<SpecialControls intent="character" />)
- const buttons = await deleteButtons()
- expect(buttons).toHaveLength(2)
- expect(buttons[0].getAttribute('aria-label')).toBe('Delete character anna')
- expect(buttons[1].getAttribute('aria-label')).toBe('Delete character bob')
+ it('jeder lokale Charakter hat einen Loeschknopf, die fremde LoRA ist keiner', async () => {
+ const refs = await listLocalCharacters()
+ expect(refs.map((r) => r.name)).toEqual(['anna', 'bob'])
+ const labels: (string | null)[] = []
+ for (const ref of refs) {
+ useCreateStore.setState({ hubCharacter: hubFromLocal(ref) })
+ const view = render(<SpecialMore intent="character" />)
+ labels.push((await screen.findByTestId('local-character-delete')).getAttribute('aria-label'))
+ view.unmount()
+ }
+ expect(labels).toEqual(['Delete character anna', 'Delete character bob'])
})
it('der Knopf fragt erst nach, Abbrechen loescht nichts', async () => {
- render(<SpecialControls intent="character" />)
- fireEvent.click((await deleteButtons())[0])
+ fireEvent.click(await deleteButton())
expect(screen.getByText(/Recycle Bin, so you can put it back/)).toBeTruthy()
expect(backendCall).not.toHaveBeenCalled()
fireEvent.click(screen.getByText('Cancel'))
@@ -79,9 +94,7 @@ describe('ein lokaler Charakter laesst sich loeschen', () => {
})
it('bestaetigt geht die Datei in den Papierkorb, Auswahl und LoRA-Haken sind los, die Liste wird neu gelesen', async () => {
- render(<SpecialControls intent="character" />)
- fireEvent.click((await deleteButtons())[0])
- const before = getLoraModels.mock.calls.length
+ fireEvent.click(await deleteButton())
fireEvent.click(screen.getByTestId('local-character-delete-confirm'))
await waitFor(() => expect(useCreateStore.getState().charactersVersion).toBe(1))
@@ -92,12 +105,14 @@ describe('ein lokaler Charakter laesst sich loeschen', () => {
expect(s.selectedCharacter).toBeNull()
expect(s.selectedLoras.map((l) => l.name)).toEqual(['style.safetensors'])
expect(refreshComfyModels).toHaveBeenCalled()
- await waitFor(() => expect(getLoraModels.mock.calls.length).toBeGreaterThan(before))
+ // The list of step 1 reads the folder again (charactersVersion), and the
+ // area goes back to it: the character is gone.
+ expect(s.hubCharacter).toBeNull()
+ expect(s.hubStep).toBe('who')
})
it('ein Charakter im Unterordner wird mit seinem vollen Namen geloescht', async () => {
- render(<SpecialControls intent="character" />)
- fireEvent.click((await deleteButtons())[1])
+ fireEvent.click(await deleteButton('chars/char_bob_zimage.safetensors'))
fireEvent.click(screen.getByTestId('local-character-delete-confirm'))
await waitFor(() => expect(backendCall).toHaveBeenCalledTimes(1))
expect(backendCall.mock.calls[0][1]).toMatchObject({ filename: 'chars/char_bob_zimage.safetensors', trash: true })
@@ -108,8 +123,7 @@ describe('ein lokaler Charakter laesst sich loeschen', () => {
it('ein Fehler wird gezeigt, die Auswahl bleibt stehen', async () => {
backendCall.mockImplementationOnce(async () => { throw new Error('Could not move char_anna_zimage.safetensors to the Recycle Bin: busy') })
- render(<SpecialControls intent="character" />)
- fireEvent.click((await deleteButtons())[0])
+ fireEvent.click(await deleteButton())
fireEvent.click(screen.getByTestId('local-character-delete-confirm'))
expect(await screen.findByText(/Could not move char_anna_zimage.safetensors/)).toBeTruthy()
const s = useCreateStore.getState()
diff --git a/src/components/create/experimental/__tests__/eine-kante-und-ein-feld.test.ts b/src/components/create/experimental/__tests__/eine-kante-und-ein-feld.test.ts
index 90014067..978c63bd 100644
--- a/src/components/create/experimental/__tests__/eine-kante-und-ein-feld.test.ts
+++ b/src/components/create/experimental/__tests__/eine-kante-und-ein-feld.test.ts
@@ -72,7 +72,10 @@ describe('D-S32: die Reglerzeile steht mittig ueber der Promptbox', () => {
// mehr statt, waere die Zentrierung eine Zusage ohne Deckung.
const spalte = code.match(/className="mx-auto w-full max-w-\[(\d+)px\] space-y-[\d.]+"/)
expect(spalte, 'die gemeinsame Spalte von Reglerzeile und Promptpanel fehlt').toBeTruthy()
- const panel = code.match(/className="rounded-\[var\(--radius-panel\)\][^"]*"/)
+ // Since 3.1.0 part B the panel has a second face, the bar of the
+ // Character area (`hub`): the class stands as the string of the other
+ // branch, so the quotes may be single.
+ const panel = code.match(/["']rounded-\[var\(--radius-panel\)\][^"']*["']/)
expect(panel, 'Promptpanel nicht gefunden').toBeTruthy()
expect(panel![0]).toMatch(/\bborder\b/)
})
diff --git a/src/components/create/experimental/__tests__/lora-names-have-a-full-tooltip.test.tsx b/src/components/create/experimental/__tests__/lora-names-have-a-full-tooltip.test.tsx
index e51af9e4..d76e73b9 100644
--- a/src/components/create/experimental/__tests__/lora-names-have-a-full-tooltip.test.tsx
+++ b/src/components/create/experimental/__tests__/lora-names-have-a-full-tooltip.test.tsx
@@ -4,7 +4,7 @@
* that start alike could not be told apart. The stack in the advanced
* settings shows the whole name (e2e/lora-names-read-in-full.spec.ts). The two
* places that keep one line carry the whole name as their tooltip: the style
- * LoRA field of a Studio model and the character chip.
+ * LoRA field of a Studio model and the character row of the Character area.
*
* Run: npx vitest run src/components/create/experimental/__tests__/lora-names-have-a-full-tooltip.test.tsx
*/
@@ -24,8 +24,9 @@ vi.mock('../../../../api/cloud/loras', () => ({
}))
import { SchemaControl } from '../SchemaControl'
-import { SpecialControls } from '../SpecialIntentControls'
-import { useCreateStore } from '../../../../stores/createStore'
+import { HubWho } from '../hub/CharacterHub'
+import { hubFromCloud } from '../../../../lib/create/character-hub'
+import { listLoras } from '../../../../api/cloud/loras'
afterEach(cleanup)
@@ -36,10 +37,12 @@ describe('LoRA names that keep one line', () => {
expect(screen.getByLabelText('LoRA 1').getAttribute('title')).toBe(LONG_B)
})
- it('a character chip names the character in full as its tooltip, next to the trigger word', async () => {
- useCreateStore.setState({ backend: 'cloud', characterTab: 'use' })
- render(<SpecialControls intent="character" />)
- const chip = await screen.findByRole('button', { name: /Grace in the red coat/ })
- expect(chip.getAttribute('title')).toBe('Grace in the red coat, studio set, second training run, trigger word: gracechar')
+ it('a character row names the character in full as its tooltip, next to the trigger word', async () => {
+ // Since 3.1.0 part B the characters are the rows of step 1 of the
+ // Character area; a long name is cut there as it was on the chip.
+ const list = (await listLoras()).map(hubFromCloud)
+ render(<HubWho list={list} loading={false} onOpenGallery={() => {}} />)
+ const row = await screen.findByRole('button', { name: /Grace in the red coat/ })
+ expect(row.getAttribute('title')).toBe('Grace in the red coat, studio set, second training run, trigger word: gracechar')
})
})
diff --git a/src/components/create/experimental/__tests__/mac-character-shelf.test.tsx b/src/components/create/experimental/__tests__/mac-character-shelf.test.tsx
index a39ab761..e3cbed20 100644
--- a/src/components/create/experimental/__tests__/mac-character-shelf.test.tsx
+++ b/src/components/create/experimental/__tests__/mac-character-shelf.test.tsx
@@ -9,7 +9,7 @@
* Run: npx vitest run src/components/create/experimental/__tests__/mac-character-shelf.test.tsx
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
const io = vi.hoisted(() => ({
files: [] as string[], comfy: vi.fn(async () => [] as string[]), open: vi.fn(async () => {}),
@@ -26,8 +26,17 @@ vi.mock('../../../../api/mlx-train', async (orig) => ({
getMacTrainStatus: vi.fn(async () => io.train),
}))
vi.mock('../../../../api/comfyui', async (orig) => ({ ...(await orig<typeof import('../../../../api/comfyui')>()), getLoraModels: () => io.comfy() }))
+vi.mock('../../../../api/in-tauri', () => ({ isTauri: () => true }))
import { SpecialControls } from '../SpecialIntentControls'
+import { HubWho } from '../hub/CharacterHub'
+import { openHubAction, useHubCharacters } from '../hub/hubCharacters'
+
+/** Step 1 of the Character area as the app shows it: every source in one list. */
+function Who() {
+ const { list, loading } = useHubCharacters()
+ return <HubWho list={list} loading={loading} onOpenGallery={() => {}} />
+}
import { useCreateStore } from '../../../../stores/createStore'
import type { ClassifiedModel } from '../../../../api/comfyui'
@@ -52,11 +61,19 @@ afterEach(() => cleanup())
describe('Character Studio on the Mac', () => {
it('lists the characters of the Mac LoRA folder, and a pick brings its Z-Image model', async () => {
arrange('use')
- render(<SpecialControls intent="character" />)
- const chip = await screen.findByTitle('Trigger word: davechar')
+ // Step 1 lists the folder's characters (since 3.1.0 part B the rows of
+ // the Character area), Image is the action that runs one.
+ render(<Who />)
+ const row = await screen.findByTitle('davechar, trigger word: davechar')
+ expect(row.textContent).toContain('Local LoRA')
expect(screen.queryByRole('button', { name: /other-style/ })).toBeNull()
expect(io.comfy).not.toHaveBeenCalled()
- fireEvent.click(chip)
+ fireEvent.click(row)
+ const picked = useCreateStore.getState().hubCharacter
+ expect(picked?.key).toBe(`mlx:${CHAR}`)
+ await act(async () => { await openHubAction('image', picked) })
+ cleanup()
+ render(<SpecialControls intent="character" />)
const s = useCreateStore.getState()
// A Mac character names the Mac's folder in its id (lib/characters MLX_PREFIX).
expect(s.selectedCharacter).toMatchObject({ id: `mlx:${CHAR}`, triggerWord: 'davechar' })
diff --git a/src/components/create/experimental/__tests__/swap-character-panel.test.tsx b/src/components/create/experimental/__tests__/swap-character-panel.test.tsx
index 832e0b27..aacff0e3 100644
--- a/src/components/create/experimental/__tests__/swap-character-panel.test.tsx
+++ b/src/components/create/experimental/__tests__/swap-character-panel.test.tsx
@@ -1,9 +1,11 @@
// @vitest-environment jsdom
/**
* Swap Character on the desktop (07.11.2026, port of the web's C52; two steps
- * with SCAIL 2 and Kling since 14.11.2026): the panel in the web's order
- * (notes, video and resolution, first frame, people, length, consent, frame
- * step), the marks, the model picker, and Create only once the video, a photo
+ * with SCAIL 2 and Kling since 14.11.2026; in the Character area since part B,
+ * sketches v2): the panel (notes and video, first frame, people, sound,
+ * consent, frame step), More options (resolution), the bar at the foot
+ * (model, length, price, Create), the marks, the model picker, and Create
+ * only once the video, a photo
* for every person, the consent and (SCAIL 2, Kling) the confirmed first
* frame are there. Nothing is rendered or booked: the Composer's generate and
* the cloud calls of the frame step are fakes, the catalogue a fixture.
@@ -48,16 +50,20 @@ vi.mock('../useStudioPrice', async (orig) => ({
import { Composer } from '../Composer'
import { SwapStage } from '../SwapStage'
+import { SpecialControls, SpecialMore } from '../SpecialIntentControls'
+import { useCharacterHubReleaseStore } from '../../../../lib/create/character-hub-release'
import { useCreateStore } from '../../../../stores/createStore'
import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'
import { neuerServer } from '../../../../lib/render/__tests__/fixtures/test-catalogs'
-import { SWAP_CONSENT_TEXT, SWAP_OPENJUTSU_MODEL, SWAP_TIPS } from '../../../../lib/render/swap'
+import { SWAP_CONSENT_TEXT, SWAP_OPENJUTSU_MODEL, SWAP_TIPS, swapClipLimits } from '../../../../lib/render/swap'
const photo = { filename: 'face.png', url: 'data:image/png;base64,AA', width: 512, height: 768 }
const clip = { blob: new Blob(['x'], { type: 'video/mp4' }), name: 'dance.mp4', url: 'blob:dance' }
const FRAME = { url: 'data:image/jpeg;base64,eA==', width: 1080, height: 1920, videoUrl: 'blob:dance' }
beforeEach(() => {
+ // An account the server released the Character area for (features.characterHub).
+ useCharacterHubReleaseStore.setState({ fromMe: true, fromCatalog: null })
for (const f of Object.values(cloud)) f.mockClear()
videoLength.seconds = undefined
useCloudCatalogStore.setState({ models: neuerServer() })
@@ -72,18 +78,34 @@ beforeEach(() => {
})
afterEach(() => cleanup())
+/** The panel of the Character area as CharacterHub lays it out: the inputs,
+ * More options (open here), the bar at the foot. */
+function Panel() {
+ const intent = useCreateStore((s) => s.intent())
+ return (
+ <div className="lu-hub">
+ <SpecialControls intent={intent} />
+ <SpecialMore intent={intent} />
+ <Composer hub onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />
+ </div>
+ )
+}
function open() {
- return render(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)
+ return render(<Panel />)
}
+/** The credits of the bar's price, from its title ("62,000 credits"). */
+const total = () => document.querySelector('[data-clip-price]')?.getAttribute('title')
+const split = () => document.querySelector('[data-clip-split]')?.textContent
+const lengthButton = () => screen.getByRole('button', { name: 'Length' })
const create = () => screen.getByRole('button', { name: /^Create/ }) as HTMLButtonElement
const panel = () => document.querySelector('[data-swap-controls]') as HTMLElement
describe('the Swap Character panel', () => {
- it('stands in the web order: notes, video, people, length, consent; no prompt field; SCAIL 2 at 720p', () => {
+ it('stands in the order of the sketch: notes and video, people, sound, consent, frame step; no prompt field; SCAIL 2 at 720p', () => {
open()
expect(panel()).toBeTruthy()
expect(document.querySelector('textarea')).toBeNull()
- const order = ['[data-swap-tips]', '[data-swap-figures]', '[data-clip-length]', '[data-swap-consent]', '[data-swap-built]']
+ const order = ['[data-swap-tips]', '[data-swap-figures]', '[data-sound-controls]', '[data-swap-consent]', '[data-swap-built]']
.map((sel) => panel().querySelector(sel) as HTMLElement)
for (const el of order) expect(el).toBeTruthy()
for (let i = 1; i < order.length; i++) {
@@ -92,17 +114,19 @@ describe('the Swap Character panel', () => {
// The notes, one line each, grey and not a warning.
const tips = panel().querySelector('[data-swap-tips]') as HTMLElement
expect([...tips.querySelectorAll('li')].map((li) => li.textContent)).toEqual([...SWAP_TIPS])
- expect(tips.className).toMatch(/text-gray-500/)
+ expect(tips.className).toMatch(/hub-dim/)
expect(tips.className).not.toMatch(/amber|yellow/)
- expect(screen.getByText('Add original video')).toBeTruthy()
+ expect(screen.getByText('Add the original video')).toBeTruthy()
expect(screen.getByText(SWAP_CONSENT_TEXT)).toBeTruthy()
// SCAIL 2 is the default, preset to 720p in the store.
const res = screen.getByRole('radiogroup', { name: 'Resolution' })
expect([...res.querySelectorAll('[role=radio]')].map((b) => b.textContent)).toEqual(['480p', '720p'])
expect(res.querySelector('[aria-checked=true]')?.textContent).toBe('720p')
expect(useCreateStore.getState().cloudStudioOptions.resolution).toBe('720p')
- const slider = document.getElementById('swap-length') as HTMLInputElement
- expect([slider.min, slider.max]).toEqual(['1', '120'])
+ // Length and price sit in the bar once there is a video to measure.
+ expect(screen.queryByRole('button', { name: 'Length' })).toBeNull()
+ expect(document.querySelector('[data-clip-price]')).toBeNull()
+ expect(swapClipLimits('scail-2').max).toBeGreaterThanOrEqual(15)
})
it('OpenJutsu: adds people up to four, each with a photo field and a role', () => {
@@ -119,7 +143,7 @@ describe('the Swap Character panel', () => {
fireEvent.click(add())
expect(useCreateStore.getState().swapFigures).toHaveLength(4)
for (let i = 1; i <= 4; i++) {
- expect(screen.getByRole('button', { name: `Add photo of person ${i}` })).toBeTruthy()
+ expect(screen.getByRole('button', { name: `Character for person ${i}` })).toBeTruthy()
expect(screen.getByRole('textbox', { name: `Who person ${i} replaces` })).toBeTruthy()
}
fireEvent.click(screen.getByRole('button', { name: 'Remove person 2' }))
@@ -165,31 +189,39 @@ describe('the Swap Character panel', () => {
expect(document.querySelector('[data-swap-consent]')).toBeTruthy()
})
- it('OpenJutsu: names the live price beside the length (15 s, not 120 s)', () => {
+ it('OpenJutsu: names the live price in the bar beside the length (15 s, not 120 s)', async () => {
useCreateStore.getState().setCloudOpModel(SWAP_OPENJUTSU_MODEL)
+ videoLength.seconds = 20
+ useCreateStore.setState({ videoInput: clip, swapFrame: FRAME } as never)
open()
- const price = () => (document.querySelector('[data-clip-price]') as HTMLElement).textContent
- const slider = () => document.getElementById('swap-length') as HTMLInputElement
- expect(slider().value).toBe('15')
- expect(price()).toBe('302,000 credits · 20,000/s')
+ await act(async () => {})
+ expect(lengthButton().textContent).toBe('15 s')
+ expect(total()).toBe('302,000 credits')
+ expect(split()).toBe('video 302k')
act(() => { useCreateStore.getState().setSwapSeconds(10) })
- expect(price()).toBe('202,000 credits · 20,000/s')
+ expect(lengthButton().textContent).toBe('10 s')
+ expect(total()).toBe('202,000 credits')
})
- it('SCAIL 2: frame and video together beside the length', () => {
- useCreateStore.setState({ swapSeconds: 6 })
+ it('SCAIL 2: frame and video together in the bar', async () => {
+ videoLength.seconds = 20
+ useCreateStore.setState({ swapSeconds: 6, videoInput: clip, swapFrame: FRAME } as never)
open()
- const box = document.querySelector('[data-clip-length]')!
+ await act(async () => {})
// 6 s at 720p (8,000/s) plus the first frame (Nano Banana Pro 2k, 14,000).
- expect(box.querySelector('[data-clip-price]')?.textContent).toBe('62,000 credits · frame + video')
- expect(box.querySelector('[data-clip-split]')?.textContent).toBe('First frame 14,000 · video 48,000 (8,000/s)')
+ expect(total()).toBe('62,000 credits')
+ expect(document.querySelector('[data-clip-price] b')?.textContent).toBe('62k')
+ expect(split()).toBe('frame 14k + video 48k')
})
- it('Kling 6 s: 100,800 credits for the video', () => {
+ it('Kling 6 s: 100,800 credits for the video', async () => {
useCreateStore.getState().setCloudOpModel('kling-v3-pro-motion-control')
- useCreateStore.setState({ swapSeconds: 6 })
+ videoLength.seconds = 20
+ useCreateStore.setState({ swapSeconds: 6, videoInput: clip, swapFrame: FRAME } as never)
open()
- expect(document.querySelector('[data-clip-split]')?.textContent).toBe('First frame 14,000 · video 100,800 (16,800/s)')
+ await act(async () => {})
+ expect(total()).toBe('114,800 credits')
+ expect(split()).toBe('frame 14k + video 101k')
})
})
@@ -206,10 +238,10 @@ describe('two steps in the panel (14.11.2026)', () => {
it('tap people: numbered marks, the place becomes the role, a tap on the mark removes it', () => {
useCreateStore.setState({ videoInput: clip, swapFrame: FRAME } as never)
const { rerender } = open()
- expect(screen.getByText('Tap each person you want to replace')).toBeTruthy()
+ expect(screen.getByText(/^Tap each person you want to replace\./)).toBeTruthy()
fireEvent.click(frameBox(), { clientX: 80, clientY: 60 })
fireEvent.click(frameBox(), { clientX: 20, clientY: 70 })
- rerender(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)
+ rerender(<Panel />)
const figs = useCreateStore.getState().swapFigures
expect(figs).toHaveLength(2)
expect(figs.map((f) => f.mark)).toEqual([{ x: 0.8, y: 0.3 }, { x: 0.2, y: 0.35 }])
@@ -347,12 +379,12 @@ describe('Sound in the Swap and Motion panel (14.11.2026)', () => {
useCreateStore.setState({ sound: 'original', lipsyncModel: 'latentsync', lipsyncCredits: null, audioInput: null, voiceFromJob: null } as never)
})
- it('three choices after the length, the original sound by default', () => {
+ it('three choices after the people, the original sound by default', () => {
open()
expect([...sound().querySelectorAll('[role=radio]')].map((r) => r.textContent)).toEqual(['Original sound', 'No sound', 'New voice, lips in sync'])
expect(option('Original sound').getAttribute('aria-checked')).toBe('true')
- const length = panel().querySelector('[data-clip-length]')!
- expect(length.compareDocumentPosition(panel().querySelector('[data-sound-controls]')!) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
+ const people = panel().querySelector('[data-swap-figures]')!
+ expect(people.compareDocumentPosition(panel().querySelector('[data-sound-controls]')!) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
fireEvent.click(option('No sound'))
expect(useCreateStore.getState().sound).toBe('none')
})
@@ -362,7 +394,8 @@ describe('Sound in the Swap and Motion panel (14.11.2026)', () => {
open()
expect(option('New voice, lips in sync').disabled).toBe(true)
expect(option('New voice, lips in sync').title).toBe('Lip sync works with one person')
- expect(document.querySelector('[data-sound-note=lipsync-blocked]')?.textContent).toBe('Lip sync works with one person')
+ // The sketch's short word beside the choice; the full sentence is its title.
+ expect(document.querySelector('[data-sound-note=lipsync-blocked]')?.textContent).toBe('one person only')
fireEvent.click(option('New voice, lips in sync'))
expect(useCreateStore.getState().sound).toBe('original')
})
@@ -385,16 +418,15 @@ describe('Sound in the Swap and Motion panel (14.11.2026)', () => {
expect(screen.getByRole('button', { name: /Add voice/ })).toBeTruthy()
useCreateStore.setState({ audioInput: VOICE })
await act(async () => {})
- rerender(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)
+ rerender(<Panel />)
await act(async () => {})
// 9 s voice, 6 s clip: LatentSync bills 6 s = 18,000.
expect(useCreateStore.getState().lipsyncCredits).toBe(18000)
expect(document.querySelector('[data-sound-note=cut]')?.textContent).toBe('Your voice is 9 s, the clip 6 s. The voice is cut to the clip.')
expect(document.querySelector('[data-sound-price]')?.textContent).toBe('+ lip sync 18k (6 s)')
- const box = document.querySelector('[data-clip-length]')!
// 6 s SCAIL 2 720p (48,000) + first frame (14,000) + lip sync (18,000).
- expect(box.querySelector('[data-clip-price]')?.textContent).toBe('80,000 credits · frame + video + lip sync')
- expect(box.querySelector('[data-clip-split]')?.textContent).toBe('First frame 14,000 · video 48,000 (8,000/s) · lip sync 18,000')
+ expect(total()).toBe('80,000 credits')
+ expect(split()).toBe('frame 14k + video 48k + lip sync 18k')
// Create: video + lip sync, once the first frame is confirmed.
const { swapKeyOf } = await import('../../../../lib/create/swap-frame')
useCreateStore.setState({ swapBuilt: { jobId: 'b', url: 'x', key: swapKeyOf('blob:dance', figures), confirmed: true } })
@@ -412,7 +444,7 @@ describe('Sound in the Swap and Motion panel (14.11.2026)', () => {
const { rerender } = open()
expect(document.querySelector('[data-sound-controls=motion]')).toBeTruthy()
useCreateStore.setState({ backend: 'local' })
- rerender(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)
+ rerender(<Panel />)
expect(document.querySelector('[data-sound-controls]')).toBeNull()
})
})
diff --git a/src/components/create/experimental/__tests__/use-character-picks-its-base-model.test.tsx b/src/components/create/experimental/__tests__/use-character-picks-its-base-model.test.tsx
index 53aadc95..9abd173c 100644
--- a/src/components/create/experimental/__tests__/use-character-picks-its-base-model.test.tsx
+++ b/src/components/create/experimental/__tests__/use-character-picks-its-base-model.test.tsx
@@ -3,13 +3,15 @@
* GH #161 (2026-10-12, Windows, 3.0.6): picking a Z Image character under
* "Use character" left the Qwen image model selected.
*
- * The shelf now sets the model the character was trained for, warns where it
+ * The pick now sets the model the character was trained for, warns where it
* cannot, and says under the pick that the trigger word alone is not enough.
+ * Since 3.1.0 part B the pick is step 1 of the Character area and Image its
+ * action (hub/hubCharacters openHubAction); the panel says the rest.
*
* Run: npx vitest run src/components/create/experimental/__tests__/use-character-picks-its-base-model.test.tsx
*/
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
vi.mock('../../../../api/backend', () => ({
isTauri: () => true,
@@ -27,6 +29,14 @@ vi.mock('../../../../api/cloud/loras', () => ({ listLoras: vi.fn(async () => [])
import { SpecialControls } from '../SpecialIntentControls'
import { useCreateStore } from '../../../../stores/createStore'
import { classifyModel, type ClassifiedModel } from '../../../../api/comfyui'
+import { openHubAction } from '../hub/hubCharacters'
+import { hubFromLocal } from '../../../../lib/create/character-hub'
+import { characterFromLora } from '../../../../lib/characters'
+
+/** Step 1 picks mira, step 2 Image. */
+async function pickMira() {
+ await act(async () => { await openHubAction('image', hubFromLocal(characterFromLora('char_mira_zimage.safetensors')!)) })
+}
const model = (name: string): ClassifiedModel => ({ name, type: classifyModel(name), source: 'diffusion_model' })
const QWEN = model('qwen_image_2512_fp8_e4m3fn.safetensors')
@@ -51,7 +61,7 @@ describe('Use character', () => {
it('picking a Z Image character under Qwen sets the Z Image model', async () => {
start([QWEN, BASE])
- fireEvent.click(await screen.findByText('mira'))
+ await pickMira()
const s = useCreateStore.getState()
expect([s.imageModel, s.imageModelType]).toEqual([BASE.name, 'zimage'])
expect(s.selectedLoras.map((l) => l.name)).toEqual(['char_mira_zimage.safetensors'])
@@ -60,21 +70,19 @@ describe('Use character', () => {
.toBe('Put “mira” in your prompt and describe the key features too. The trigger word alone often does not hold the look.')
})
- it('no Z Image model installed: the model stays and the shelf warns', async () => {
+ it('no Z Image model installed: the model stays and the panel warns', async () => {
start([QWEN])
- fireEvent.click(await screen.findByText('mira'))
+ await pickMira()
expect(useCreateStore.getState().imageModel).toBe(QWEN.name)
expect(screen.getByTestId('character-model-warning').textContent)
.toBe('This character was trained for Z Image, and no Z Image model is installed. Get one in the Model Manager to use it.')
expect(screen.queryByTestId('character-model-switch')).toBeNull()
})
- it('the model changed after the pick: the shelf warns and offers the way back', async () => {
+ it('the model changed after the pick: the panel warns and offers the way back', async () => {
start([QWEN, BASE])
- fireEvent.click(await screen.findByText('mira'))
- fireEvent.click(screen.getByText('mira'))
- fireEvent.click(screen.getByText('mira'))
- useCreateStore.getState().setImageModel(QWEN.name, QWEN.type)
+ await pickMira()
+ act(() => { useCreateStore.getState().setImageModel(QWEN.name, QWEN.type) })
const warning = await screen.findByTestId('character-model-warning')
expect(warning.textContent).toContain('This character was trained for Z Image. Pick a Z Image model to use it.')
fireEvent.click(screen.getByTestId('character-model-switch'))
diff --git a/src/components/create/experimental/hub/CharacterHub.tsx b/src/components/create/experimental/hub/CharacterHub.tsx
new file mode 100644
index 00000000..a2b57bf0
--- /dev/null
+++ b/src/components/create/experimental/hub/CharacterHub.tsx
@@ -0,0 +1,436 @@
+// The Character area of Create (3.1.0 part B), built after David's sketches
+// v2 (uebergabe-310/SWAP-HUB-bilder/mockups-v2): one column of 660 px
+// (760 rendered, the chat's measure), a head line `Character ▾ → Action ▾`
+// as text, rows with hairlines, and at the foot the one framed part, the bar
+// (Composer, hub).
+//
+// step 1 Who? every character in one list, "+ New character" with three
+// ways, "Just use a photo"
+// step 2 What? Image, Swap, Motion, Talk with their price
+// step 3 the panel of the action: the stage (a run, a result), the
+// inputs (SpecialControls), the lane's own controls, More options,
+// the bar.
+
+import { useRef, useState, type ReactNode } from 'react'
+import { ArrowRight, Film, Image as ImageIcon, Mic, PersonStanding, Plus, Replace, X } from 'lucide-react'
+import { useCreateStore, type CreateIntent } from '../../../../stores/createStore'
+import { useUIStore, type CloudTeaserTarget } from '../../../../stores/uiStore'
+import { useSettingsStore } from '../../../../stores/settingsStore'
+import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'
+import { useCharacterHubReleased } from '../../../../lib/create/character-hub-release'
+import {
+ ACTION_LABEL, ACTION_LINE, HUB_ACTIONS, HUB_JUST_PHOTO, HUB_JUST_PHOTO_LINE, HUB_LOCAL_LINE, HUB_SWAP_SOON,
+ actionCloudPrice, actionMeta, actionOfIntent, intentOfAction, whatHeading,
+ type HubAction, type HubCharacter,
+} from '../../../../lib/create/character-hub'
+import { saveCharacter } from '../../../../lib/saved-characters'
+import { isMlxImageHost } from '../../../../api/mlx-image'
+import { openMlxLoraFolder } from '../../../../api/mlx-loras'
+import { mlxFollowsMotion, mlxTalking } from '../../../../api/mlx-video'
+import { INTENT_MAP } from '../intents'
+import { useIntentLanes } from '../IntentBar'
+import { Stage } from '../Stage'
+import { Composer, LaneControls } from '../Composer'
+import { SpecialControls, SpecialMore } from '../SpecialIntentControls'
+import { Select, type SelectOption } from '../../ui/Select'
+import { cn } from '../../ui/cn'
+import { HubAvatar, HubCharactersContext, MoreOptions } from './HubParts'
+import { openHubAction, useHubCharacters } from './hubCharacters'
+
+type TeaserIntent = Extract<CloudTeaserTarget, { surface: 'intent' }>['intent']
+
+const ACTION_ICON: Record<HubAction, ReactNode> = {
+ image: <ImageIcon size={15} />,
+ swap: <Replace size={15} />,
+ motion: <PersonStanding size={15} />,
+ talk: <Mic size={15} />,
+}
+
+interface Props {
+ /** The props the Stage takes, as CreateExperimental hands them to it. */
+ stage: Omit<React.ComponentProps<typeof Stage>, 'hub'>
+ onOpenAdvanced: () => void
+ onOpenWorkflows: () => void
+ /** "From my gallery": the gallery opens, a clip there saves its frames. */
+ onOpenGallery: () => void
+}
+
+/** The column every step shares: 660 px, centred. */
+const COLUMN = 'mx-auto w-full max-w-[660px] px-4'
+
+export function CharacterHub({ stage, onOpenAdvanced, onOpenWorkflows, onOpenGallery }: Props) {
+ const step = useCreateStore((s) => s.hubStep)
+ const { list, loading } = useHubCharacters()
+ return (
+ <HubCharactersContext.Provider value={list}>
+ <section className="lu-hub flex min-w-0 flex-1 flex-col overflow-hidden" data-character-hub={step} aria-label="Character">
+ <div className={cn(COLUMN, 'shrink-0')}>
+ <HubHead list={list} />
+ </div>
+ {step === 'who' && <Scroll><HubWho list={list} loading={loading} onOpenGallery={onOpenGallery} /></Scroll>}
+ {step === 'what' && <Scroll><HubWhat /></Scroll>}
+ {step === 'panel' && (
+ <>
+ <Scroll>
+ <div className="empty:hidden pt-3"><Stage hub {...stage} /></div>
+ <HubPanel onOpenAdvanced={onOpenAdvanced} />
+ </Scroll>
+ <div className={cn(COLUMN, 'shrink-0')}>
+ <Composer hub onOpenAdvanced={onOpenAdvanced} onOpenWorkflows={onOpenWorkflows} />
+ </div>
+ </>
+ )}
+ </section>
+ </HubCharactersContext.Provider>
+ )
+}
+
+function Scroll({ children }: { children: ReactNode }) {
+ return (
+ <div className="min-h-0 flex-1 overflow-y-auto scrollbar-thin">
+ <div className={cn(COLUMN, 'pb-4')}>{children}</div>
+ </div>
+ )
+}
+
+// ── head line ───────────────────────────────────────────────────────────────
+
+const CHOOSE = '__choose'
+const PHOTO = '__photo'
+const NEW = '__new'
+
+function HubHead({ list }: { list: HubCharacter[] }) {
+ const step = useCreateStore((s) => s.hubStep)
+ const intent = useCreateStore((s) => s.intent())
+ const characterTab = useCreateStore((s) => s.characterTab)
+ const hubCharacter = useCreateStore((s) => s.hubCharacter)
+ const setHubCharacter = useCreateStore((s) => s.setHubCharacter)
+ const setHubStep = useCreateStore((s) => s.setHubStep)
+ const videoInput = useCreateStore((s) => s.videoInput)
+ const setVideoInput = useCreateStore((s) => s.setVideoInput)
+ const setError = useCreateStore((s) => s.setError)
+ const pickAction = usePickAction()
+ const training = step === 'panel' && intent === 'character' && characterTab === 'train'
+ const action = step === 'panel' ? actionOfIntent(intent) : null
+
+ const who: SelectOption[] = [
+ ...list.map((c) => ({ value: c.key, label: c.name, sublabel: c.meta, lead: <HubAvatar name={c.name} image={c.image} size={18} /> })),
+ { value: PHOTO, label: HUB_JUST_PHOTO },
+ { value: NEW, label: 'New character', lead: <Plus size={14} className="hub-dim" /> },
+ { value: CHOOSE, label: 'All characters…' },
+ ]
+ const whoValue = training ? NEW : hubCharacter?.key ?? (step === 'who' ? '' : PHOTO)
+ const whoOptions = whoValue === PHOTO || whoValue === NEW || !whoValue || list.some((c) => c.key === whoValue)
+ ? who
+ : [{ value: whoValue, label: hubCharacter?.name ?? '', lead: <HubAvatar name={hubCharacter?.name ?? ''} image={hubCharacter?.image} size={20} /> }, ...who]
+ const withLead = whoOptions.map((o) => (o.value === hubCharacter?.key ? { ...o, lead: <HubAvatar name={o.label} image={hubCharacter?.image} size={20} /> } : o))
+
+ const onWho = (v: string) => {
+ if (v === CHOOSE) { setHubStep('who'); return }
+ if (v === NEW) { startTraining(); return }
+ const c = v === PHOTO ? null : list.find((x) => x.key === v) ?? null
+ setHubCharacter(c)
+ if (step === 'panel' && action) {
+ void openHubAction(action, c, true).then((err) => { if (err) setError(err) })
+ } else {
+ setHubStep('what')
+ }
+ }
+
+ const actions: SelectOption[] = HUB_ACTIONS.map((a) => ({ value: a, label: ACTION_LABEL[a], sublabel: ACTION_LINE[a] }))
+
+ return (
+ <div className="hub-line flex h-[35px] items-center gap-2 border-b hub-fs-13" data-hub-head>
+ <Select
+ variant="text"
+ ariaLabel="Character"
+ placeholder="Character"
+ textClassName={step === 'who' ? 'hub-acc' : undefined}
+ value={whoValue}
+ options={withLead}
+ onChange={onWho}
+ />
+ <ArrowRight size={12} className="hub-dim shrink-0" aria-hidden />
+ <Select
+ variant="text"
+ ariaLabel="Action"
+ // A new character's training stands where the action stands; the
+ // list leads on to the actions once it is trained.
+ placeholder={training ? 'Train' : 'Action'}
+ textClassName={training ? undefined : step === 'what' ? 'hub-acc' : step === 'who' ? 'hub-dim' : undefined}
+ value={training ? '' : action ?? ''}
+ options={actions}
+ onChange={(v) => pickAction(v as HubAction)}
+ />
+ <span className="flex-1" />
+ {step === 'panel' && videoInput && (intent === 'swap_character' || intent === 'motion' || intent === 'lipsync') && (
+ <span className="hub-muted flex min-w-0 items-center gap-1.5 hub-fs-12" data-hub-clip>
+ <Film size={13} className="hub-dim shrink-0" />
+ <span className="truncate">{videoInput.name}</span>
+ <button type="button" onClick={() => setVideoInput(null)} className="hub-dim p-0.5" title="Remove the video" aria-label="Remove the video">
+ <X size={12} />
+ </button>
+ </span>
+ )}
+ </div>
+ )
+}
+
+/** "Train from photos": Character Studio's training, as it was. */
+function startTraining() {
+ const st = useCreateStore.getState()
+ st.setHubCharacter(null)
+ st.setIntent('character')
+ st.setCharacterTab('train')
+}
+
+/** Step 2 and the head line pick an action the same way. A tab that cannot
+ * run here (Swap in local mode, a Mac lane without its model) opens the
+ * Cloud sheet, as its pill did. */
+function usePickAction() {
+ const { intents, lockedOf } = useIntentLanes()
+ const setCloudTeaser = useUIStore((s) => s.setCloudTeaser)
+ const setError = useCreateStore((s) => s.setError)
+ return (a: HubAction) => {
+ const intent = intentOfAction(a)
+ const meta = intents.find((m) => m.id === intent) ?? INTENT_MAP[intent]
+ if (lockedOf(meta)) { setCloudTeaser({ surface: 'intent', intent: intent as TeaserIntent }); return }
+ const { hubCharacter: c, hubStep } = useCreateStore.getState()
+ // From step 2 the character's picture fills the inputs; switching the
+ // action in the head line keeps what the panel already holds.
+ void openHubAction(a, c, hubStep !== 'panel').then((err) => { if (err) setError(err) })
+ }
+}
+
+// ── step 1: who? ────────────────────────────────────────────────────────────
+
+export function HubWho({ list, loading, onOpenGallery }: { list: HubCharacter[]; loading: boolean; onOpenGallery: () => void }) {
+ const setHubCharacter = useCreateStore((s) => s.setHubCharacter)
+ const setHubStep = useCreateStore((s) => s.setHubStep)
+ const [upload, setUpload] = useState<File[] | null>(null)
+ const [note, setNote] = useState<ReactNode>(null)
+ const file = useRef<HTMLInputElement>(null)
+
+ const pick = (c: HubCharacter | null) => { setHubCharacter(c); setHubStep('what') }
+
+ return (
+ <div data-hub-step="who">
+ <h2 className="hub-dim mt-5 mb-1.5 hub-fs-10">My characters</h2>
+ <div aria-label="My characters">
+ {list.map((c) => (
+ <button
+ key={c.key}
+ type="button"
+ onClick={() => pick(c)}
+ // The whole name, and the trigger word of a LoRA character, where
+ // the row cuts a long name (GitHub discussion #150).
+ title={c.ref ? `${c.name}, trigger word: ${c.ref.triggerWord}` : c.name}
+ className="hub-line hub-hover -mx-2 flex h-10 w-[calc(100%+16px)] items-center gap-2.5 rounded-sm border-b px-2 text-left"
+ data-hub-character={c.key}
+ >
+ <HubAvatar name={c.name} image={c.image} size={26} />
+ <span className="hub-text min-w-0 flex-1 truncate hub-fs-14 font-medium">{c.name}</span>
+ <span className="hub-dim hub-fs-125 tabular-nums">{c.meta}</span>
+ </button>
+ ))}
+ {list.length === 0 && (
+ <p className="hub-dim hub-line border-b py-3 hub-fs-13">{loading ? 'Loading your characters…' : 'No characters yet. Make your first one below.'}</p>
+ )}
+ </div>
+
+ <div className="hub-line border-b pb-2.5">
+ <div className="flex h-10 items-center gap-2.5">
+ <span className="hub-muted grid w-[26px] place-items-center"><Plus size={15} /></span>
+ <span className="hub-text hub-fs-14 font-medium">New character</span>
+ </div>
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 pl-9 hub-fs-13" data-hub-new>
+ <button type="button" className="hub-acc hover:underline" onClick={startTraining}>Train from photos</button>
+ <span className="hub-dim" aria-hidden>·</span>
+ <button type="button" className="hub-acc hover:underline" onClick={() => file.current?.click()}>Upload photos or LoRA</button>
+ <span className="hub-dim" aria-hidden>·</span>
+ <button
+ type="button"
+ className="hub-acc hover:underline"
+ onClick={() => { onOpenGallery(); setNote('Open a video in the gallery and choose Save as character. Its frames become a character.') }}
+ >
+ From my gallery
+ </button>
+ <input
+ ref={file}
+ type="file"
+ multiple
+ accept="image/*,.safetensors"
+ className="hidden"
+ aria-label="Upload photos or a LoRA file"
+ onChange={(e) => {
+ const files = Array.from(e.target.files ?? [])
+ e.target.value = ''
+ if (files.some((f) => f.name.toLowerCase().endsWith('.safetensors'))) {
+ setUpload(null)
+ setNote(<LoraFileNote />)
+ return
+ }
+ if (files.length) { setUpload(files); setNote(null) }
+ }}
+ />
+ </div>
+ {upload && <SavePhotos files={upload} onDone={() => setUpload(null)} />}
+ {note && <p className="hub-dim pl-9 pt-2 hub-fs-125" role="status">{note}</p>}
+ </div>
+
+ <div className="flex flex-wrap items-baseline gap-3 pt-3.5 hub-fs-125">
+ <button type="button" onClick={() => pick(null)} className="hub-muted underline decoration-[var(--hub-edge)] underline-offset-[3px]">
+ {HUB_JUST_PHOTO}
+ </button>
+ <span className="hub-dim">{HUB_JUST_PHOTO_LINE}</span>
+ </div>
+ </div>
+ )
+}
+
+/** A LoRA file is not uploaded from here: it goes into the LoRA folder of
+ * this machine, under the name the list reads. */
+function LoraFileNote() {
+ return (
+ <>
+ A LoRA file goes into your LoRA folder, named {'char_<name>_zimage.safetensors'}. It shows here after that.
+ {isMlxImageHost() && (
+ <> <button type="button" className="underline" onClick={() => { void openMlxLoraFolder().catch(() => undefined) }}>Open the LoRA folder</button></>
+ )}
+ </>
+ )
+}
+
+/** Photos picked by "Upload photos or LoRA": one name, then they are a
+ * character on this machine (lib/saved-characters), ready for every action. */
+function SavePhotos({ files, onDone }: { files: File[]; onDone: () => void }) {
+ const [name, setName] = useState('')
+ const [error, setError] = useState<string | null>(null)
+ const save = async () => {
+ try {
+ await saveCharacter(name, files)
+ onDone()
+ } catch (err) {
+ setError(err instanceof Error ? err.message : String(err))
+ }
+ }
+ return (
+ <div className="flex flex-wrap items-center gap-2.5 pl-9 pt-2 hub-fs-13" data-hub-save-photos>
+ <span className="hub-muted">{files.length} {files.length === 1 ? 'photo' : 'photos'}</span>
+ <input
+ autoFocus
+ value={name}
+ maxLength={40}
+ aria-label="Name of the new character"
+ placeholder="Name"
+ onChange={(e) => setName(e.target.value)}
+ onKeyDown={(e) => { if (e.key === 'Enter') void save() }}
+ className="hub-text hub-line w-40 border-b bg-transparent py-1 outline-none"
+ />
+ <button type="button" className="hub-acc disabled:opacity-40" disabled={!name.trim()} onClick={() => void save()}>Save</button>
+ <button type="button" className="hub-dim" onClick={onDone}>Cancel</button>
+ {error && <span role="alert" className="text-red-400">{error}</span>}
+ </div>
+ )
+}
+
+// ── step 2: what? ───────────────────────────────────────────────────────────
+
+function HubWhat() {
+ const hubCharacter = useCreateStore((s) => s.hubCharacter)
+ const backend = useCreateStore((s) => s.backend)
+ const cloudFeatures = useSettingsStore((s) => s.settings.cloudTeasersEnabled)
+ const released = useCharacterHubReleased()
+ useCloudCatalogStore((s) => s.fetchedAt)
+ const { intents, lockedOf } = useIntentLanes()
+ const pickAction = usePickAction()
+ const showCloud = backend === 'cloud' || cloudFeatures
+ const family = hubCharacter?.ref?.family
+
+ return (
+ <div data-hub-step="what">
+ <h2 className="hub-dim mt-5 mb-1.5 hub-fs-10">{whatHeading(hubCharacter)}</h2>
+ <div role="radiogroup" aria-label="Character action" className="hub-line border-t">
+ {HUB_ACTIONS.map((a) => {
+ const intent: CreateIntent = intentOfAction(a)
+ const meta = intents.find((m) => m.id === intent)
+ // Left out where the tab is left out (Cloud features off, or a Mac
+ // without the lane), as in the old pill bar.
+ if (!meta) return null
+ const locked = lockedOf(meta)
+ // Local: the action has a lane on this machine. In cloud mode that
+ // is asked of the local backend.
+ const local = !lockedOfLocal(intents, intent, backend, lockedOf)
+ const soon = a === 'swap' && !locked && !released
+ const price = actionCloudPrice(a, a === 'image' ? family : undefined)
+ const line = soon ? HUB_SWAP_SOON : locked ? 'Runs on LU Cloud' : actionMeta({ local, cloudPrice: price, showCloud: backend === 'cloud' || (showCloud && !local) })
+ return (
+ <button
+ key={a}
+ type="button"
+ role="radio"
+ aria-checked={false}
+ aria-label={locked ? `${meta.label}, runs on LU Cloud` : meta.label}
+ title={locked ? `${meta.label}, runs on LU Cloud` : meta.label}
+ onClick={() => pickAction(a)}
+ className={cn('hub-line hub-hover -mx-2 flex h-[38px] w-[calc(100%+16px)] items-center gap-2.5 rounded-sm border-b px-2 text-left hub-fs-14', locked && 'opacity-60')}
+ data-hub-action={a}
+ >
+ <span className="hub-muted shrink-0">{ACTION_ICON[a]}</span>
+ <span className="hub-text w-[111px] shrink-0 font-medium">{ACTION_LABEL[a]}</span>
+ <span className="hub-muted min-w-0 flex-1 truncate hub-fs-13 max-[520px]:hidden">{ACTION_LINE[a]}</span>
+ <span className="hub-dim ml-auto whitespace-nowrap hub-fs-125 tabular-nums" data-hub-action-meta>{line}</span>
+ </button>
+ )
+ })}
+ </div>
+ <p className="hub-dim pt-3 hub-fs-125">{HUB_LOCAL_LINE}</p>
+ </div>
+ )
+}
+
+/** Whether an action is locked on the LOCAL backend of this machine (for
+ * the word "Local" in cloud mode too). In local mode it is the tab's own
+ * lock; in cloud mode the intents that have a local lane at all. */
+function lockedOfLocal(
+ intents: ReturnType<typeof useIntentLanes>['intents'],
+ intent: CreateIntent,
+ backend: string,
+ lockedOf: ReturnType<typeof useIntentLanes>['lockedOf'],
+): boolean {
+ const meta = intents.find((m) => m.id === intent) ?? INTENT_MAP[intent]
+ if (backend !== 'cloud') return lockedOf(meta)
+ if (isMlxImageHost()) {
+ // The Mac's own lanes: Character Studio always, Motion and Talk while
+ // their models are installed (asked on the local rule in the store).
+ const videos = useCreateStore.getState().videoModelList
+ return !(intent === 'character' || (intent === 'motion' && mlxFollowsMotion(videos)) || (intent === 'lipsync' && mlxTalking(videos).tab))
+ }
+ return !meta.hasLocalLane
+}
+
+// ── step 3: the panel ───────────────────────────────────────────────────────
+
+function HubPanel({ onOpenAdvanced }: { onOpenAdvanced: () => void }) {
+ const intent = useCreateStore((s) => s.intent())
+ const backend = useCreateStore((s) => s.backend)
+ const released = useCharacterHubReleased()
+ const swapSoon = intent === 'swap_character' && (!released || backend !== 'cloud')
+ return (
+ <div data-hub-step="panel" data-hub-intent={intent}>
+ <SpecialControls intent={intent} />
+ {!swapSoon && (
+ <>
+ {intent !== 'swap_character' && <div className="pt-2.5 empty:hidden"><LaneControls /></div>}
+ <MoreOptions testId="hub-more">
+ <SpecialMore intent={intent} />
+ <button type="button" onClick={onOpenAdvanced} className="hub-muted hub-fs-125 underline decoration-[var(--hub-edge)] underline-offset-[3px]">
+ All settings of the model
+ </button>
+ </MoreOptions>
+ </>
+ )}
+ </div>
+ )
+}
+
diff --git a/src/components/create/experimental/hub/HubParts.tsx b/src/components/create/experimental/hub/HubParts.tsx
new file mode 100644
index 00000000..ce431bf9
--- /dev/null
+++ b/src/components/create/experimental/hub/HubParts.tsx
@@ -0,0 +1,158 @@
+// The small parts the Character area is built from (sketches v2): rows on
+// the surface with a hairline under them, a round picture, a text choice with
+// a small arrow, and "More options" as grey text. No box around a field; the
+// one framed part is the bar at the foot (Composer, `hub`).
+
+import { createContext, useContext, useRef, useState, type ReactNode } from 'react'
+import { ArrowRight, ChevronDown, ChevronRight, Plus } from 'lucide-react'
+import { hubInitial, type HubCharacter } from '../../../../lib/create/character-hub'
+import { Select, type SelectOption } from '../../ui/Select'
+import { cn } from '../../ui/cn'
+
+/** The characters of step 1, shared with the pickers in the panels so the
+ * list is asked once. */
+export const HubCharactersContext = createContext<HubCharacter[]>([])
+
+export function useHubList(): HubCharacter[] {
+ return useContext(HubCharactersContext)
+}
+
+/** A round picture, or the initial on the soft accent where there is none. */
+export function HubAvatar({ name, image, size = 26 }: { name: string; image: string | null | undefined; size?: number }) {
+ if (image) {
+ return (
+ <span
+ aria-hidden
+ className="inline-block shrink-0 rounded-full bg-gray-200 bg-cover"
+ style={{ width: size, height: size, backgroundImage: `url("${image}")`, backgroundPosition: '50% 12%' }}
+ />
+ )
+ }
+ return (
+ <span
+ aria-hidden
+ className="hub-soft hub-acc inline-flex shrink-0 items-center justify-center rounded-full font-semibold"
+ style={{ width: size, height: size, fontSize: Math.round(size * 0.45) }}
+ >
+ {hubInitial(name)}
+ </span>
+ )
+}
+
+/** One line of a panel: 40 px (46 rendered), a hairline under it. */
+export function HubLine({ children, className, ...rest }: { children: ReactNode; className?: string } & React.HTMLAttributes<HTMLDivElement>) {
+ return (
+ <div className={cn('hub-line flex min-h-10 items-center gap-2.5 border-b hub-fs-14', className)} {...rest}>
+ {children}
+ </div>
+ )
+}
+
+/** "More options": grey text with a small arrow, the options under it. */
+export function MoreOptions({ children, testId }: { children: ReactNode; testId?: string }) {
+ const [open, setOpen] = useState(false)
+ return (
+ <div className="pt-2.5" data-testid={testId}>
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpen(!open)}
+ className={cn('flex items-center gap-1.5 hub-fs-125 transition-colors', open ? 'hub-muted' : 'hub-dim hover:opacity-80')}
+ >
+ {open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
+ More options
+ </button>
+ {open && <div className="mt-1.5 space-y-2 pl-[18px]">{children}</div>}
+ </div>
+ )
+}
+
+const PHOTO = '__photo'
+
+/** "→ Bean ▾": the character a person or the portrait becomes. The list is
+ * the characters with a picture, then "Upload a photo…", which takes any
+ * photo without saving it. */
+export function CharacterPick({ name, image, onCharacter, onPhoto, label, disabled, inputData }: {
+ name: string | null
+ image: string | null
+ onCharacter: (c: HubCharacter) => void
+ onPhoto: (file: File) => void
+ /** For assistive tech: "Character for person 1". */
+ label: string
+ disabled?: boolean
+ /** Data attributes for the hidden file field (tests find it by them). */
+ inputData?: Record<string, string>
+}) {
+ const list = useHubList().filter((c) => !!c.image || (c.photos?.length ?? 0) > 0)
+ const file = useRef<HTMLInputElement>(null)
+ const picked = list.find((c) => c.name === name)
+ const current = name ?? (image ? 'Photo' : null)
+ const options: SelectOption[] = [
+ ...list.map((c) => ({ value: c.key, label: c.name, sublabel: c.meta, lead: <HubAvatar name={c.name} image={c.image} size={18} /> })),
+ { value: PHOTO, label: 'Upload a photo…', lead: <Plus size={14} className="hub-dim" /> },
+ ]
+ // The closed field shows what is set; a photo that is not a listed
+ // character shows as "Photo" with its own picture.
+ if (current && !picked) options.unshift({ value: '__current', label: current, lead: <HubAvatar name={current} image={image} size={20} /> })
+ return (
+ <span className="flex shrink-0 items-center gap-2.5">
+ <ArrowRight size={13} className="hub-dim" aria-hidden />
+ <input
+ ref={file}
+ type="file"
+ accept="image/*"
+ className="hidden"
+ aria-label={`${label}: upload a photo`}
+ {...inputData}
+ onChange={(e) => { const f = e.target.files?.[0]; if (f) onPhoto(f); e.target.value = '' }}
+ />
+ {current || list.length > 0 ? (
+ <Select
+ variant="text"
+ textClassName="w-[92px] hub-fs-14 font-medium"
+ ariaLabel={label}
+ align="right"
+ placeholder="Choose"
+ value={picked?.key ?? (current ? '__current' : '')}
+ options={options.map((o) => (o.value === picked?.key ? { ...o, lead: <HubAvatar name={o.label} image={picked?.image} size={20} /> } : o))}
+ onChange={(v) => {
+ if (disabled) return
+ if (v === PHOTO) { file.current?.click(); return }
+ const c = list.find((x) => x.key === v)
+ if (c) onCharacter(c)
+ }}
+ />
+ ) : (
+ <button type="button" aria-label={label} disabled={disabled} onClick={() => file.current?.click()} className="hub-acc w-[92px] text-left hub-fs-14">
+ Add a photo
+ </button>
+ )}
+ </span>
+ )
+}
+
+/** A flat upload line: an icon and a sentence, the whole line takes the file. */
+export function UploadLine({ icon, label, accept, onFile, note }: {
+ icon: ReactNode
+ label: string
+ accept: string
+ onFile: (file: File) => void
+ note?: ReactNode
+}) {
+ const ref = useRef<HTMLInputElement>(null)
+ return (
+ <HubLine className="hub-hover -mx-2 cursor-pointer rounded-sm px-2" onClick={() => ref.current?.click()} role="button" aria-label={label}>
+ <input
+ ref={ref}
+ type="file"
+ accept={accept}
+ className="hidden"
+ onClick={(e) => e.stopPropagation()}
+ onChange={(e) => { const f = e.target.files?.[0]; if (f) onFile(f); e.target.value = '' }}
+ />
+ <span className="hub-muted">{icon}</span>
+ <span className="hub-text">{label}</span>
+ {note && <span className="hub-dim ml-auto hub-fs-125">{note}</span>}
+ </HubLine>
+ )
+}
diff --git a/src/components/create/experimental/hub/SwapBarParts.tsx b/src/components/create/experimental/hub/SwapBarParts.tsx
new file mode 100644
index 00000000..2923ec5e
--- /dev/null
+++ b/src/components/create/experimental/hub/SwapBarParts.tsx
@@ -0,0 +1,70 @@
+// The Swap part of the bar at the foot of the Character area (sketches v2):
+// the length as text with a small arrow ("6 s ▾") and the price with its
+// parts ("62k frame 14k + video 48k"). Same numbers as the old length slider
+// (ClipLength) and the Create button: swapPricedSeconds, swapClipCredits,
+// the frame step and the lip sync step.
+
+import { useCreateStore } from '../../../../stores/createStore'
+import { createRunModel } from '../../../../lib/render/create-studio'
+import {
+ SWAP_FRAME_MODELS, swapBilledPhotos, swapClipCredits, swapClipLimits, swapClipSeconds, swapPricedSeconds,
+ swapShortCredits, swapUsesFrame, swapWholeSeconds, SWAP_INTENT,
+} from '../../../../lib/render/swap'
+import { swapFrameCredits } from '../../../../lib/create/swap-frame'
+import { Select } from '../../ui/Select'
+
+/** What the bar shows for Swap. `videoSeconds`: the measured length of the
+ * customer's video (the Composer measures it for the price). */
+export function useSwapBar(videoSeconds: number | undefined) {
+ const opModel = useCreateStore((s) => s.cloudOpModel)
+ const options = useCreateStore((s) => s.cloudStudioOptions)
+ const chosen = useCreateStore((s) => s.swapSeconds)
+ const figures = useCreateStore((s) => s.swapFigures)
+ const frame = useCreateStore((s) => s.swapFrame)
+ const lipsync = useCreateStore((s) => (s.sound === 'lipsync' ? s.lipsyncCredits : null))
+ const model = createRunModel('swap_character', { image: '', video: '', op: opModel })
+ const limits = swapClipLimits(model)
+ const frameModel = SWAP_FRAME_MODELS.includes(model)
+ const value = frameModel ? swapWholeSeconds(model, chosen, videoSeconds) : swapClipSeconds(model, chosen, videoSeconds)
+ const video = videoSeconds ? (frameModel ? swapWholeSeconds(model, null, videoSeconds) : Math.floor(videoSeconds)) : undefined
+ const top = Math.max(limits.min, Math.min(limits.max, video ?? limits.max))
+ const seconds: number[] = []
+ for (let v = limits.min; v <= top; v++) seconds.push(v)
+ const frameCredits = swapUsesFrame(SWAP_INTENT, model) ? swapFrameCredits(frame?.width ?? 9, frame?.height ?? 16, figures.length) : null
+ const videoCredits = swapClipCredits(model, options, videoSeconds ? swapPricedSeconds(model, chosen, videoSeconds) : Math.min(value, limits.max), swapBilledPhotos(model, figures.length))
+ const total = videoCredits == null ? null : videoCredits + (frameCredits ?? 0) + (lipsync ?? 0)
+ return { model, value, seconds, frameCredits, videoCredits, lipsync, total }
+}
+
+export function SwapLength({ videoSeconds, disabled }: { videoSeconds: number | undefined; disabled?: boolean }) {
+ const setSwapSeconds = useCreateStore((s) => s.setSwapSeconds)
+ const { value, seconds } = useSwapBar(videoSeconds)
+ return (
+ <Select
+ variant="text"
+ textClassName="h-[27px] px-1.5 hub-fs-125 hub-muted"
+ ariaLabel="Length"
+ value={String(value)}
+ maxHeight={240}
+ options={seconds.map((v) => ({ value: String(v), label: `${v} s` }))}
+ onChange={(v) => { if (!disabled) setSwapSeconds(Number(v)) }}
+ />
+ )
+}
+
+/** "62k frame 14k + video 48k". */
+export function SwapPrice({ videoSeconds }: { videoSeconds: number | undefined }) {
+ const { frameCredits, videoCredits, lipsync, total } = useSwapBar(videoSeconds)
+ if (total == null || videoCredits == null) return null
+ const parts = [
+ frameCredits != null ? `frame ${swapShortCredits(frameCredits)}` : null,
+ `video ${swapShortCredits(videoCredits)}`,
+ lipsync != null ? `lip sync ${swapShortCredits(lipsync)}` : null,
+ ].filter(Boolean).join(' + ')
+ return (
+ <span className="flex items-baseline gap-1.5 whitespace-nowrap hub-fs-12" data-clip-price title={`${total.toLocaleString('en-US')} credits`}>
+ <b className="hub-text hub-fs-13 font-medium tabular-nums">{swapShortCredits(total)}</b>
+ <span className="hub-dim max-[520px]:hidden" data-clip-split>{parts}</span>
+ </span>
+ )
+}
diff --git a/src/components/create/experimental/hub/hubCharacters.ts b/src/components/create/experimental/hub/hubCharacters.ts
new file mode 100644
index 00000000..5efa3a63
--- /dev/null
+++ b/src/components/create/experimental/hub/hubCharacters.ts
@@ -0,0 +1,148 @@
+// The characters of the Character area and what picking one does.
+//
+// Step 1 lists every source in one list (lib/create/character-hub.ts):
+// the trained and uploaded LoRAs of LU Cloud (/api/loras, with their base
+// look), this machine's `char_*.safetensors` (ComfyUI loras or the Mac's
+// LoRA folder) and the photo sets saved on this machine (IndexedDB).
+//
+// Picking an action fills its inputs from the character: Image runs on its
+// LoRA, Swap puts its picture on person 1, Motion and Talk start from its
+// picture. Nothing here books or renders anything.
+
+import { useEffect, useState } from 'react'
+import { useCreateStore } from '../../../../stores/createStore'
+import { listLoras } from '../../../../api/cloud/loras'
+import { listLocalCharacters, characterLoraFile } from '../../../../lib/characters'
+import { parseLocalCharacterLora } from '../../../../api/trainer'
+import { characterBaseModel } from '../../../../lib/character-base'
+import { isTauri } from '../../../../api/in-tauri'
+import {
+ hubFromCloud, hubFromLocal, hubFromSaved, intentOfAction, mergeHubCharacters,
+ type HubAction, type HubCharacter,
+} from '../../../../lib/create/character-hub'
+import type { ImageRef } from '../../../../lib/image-ref'
+import { useSavedCharacters } from '../SavedCharacters'
+import { loadImageRef } from '../loadImage'
+import { loadPhotosAsReferences } from '../characterPhotos'
+
+export interface HubCharacterList {
+ list: HubCharacter[]
+ /** Still asking at least one source. */
+ loading: boolean
+}
+
+/** All characters, kept current after a training, an import or a delete
+ * (charactersVersion) and after every save of a photo set. */
+export function useHubCharacters(): HubCharacterList {
+ const backend = useCreateStore((s) => s.backend)
+ const version = useCreateStore((s) => s.charactersVersion)
+ const saved = useSavedCharacters()
+ const [cloudRows, setCloud] = useState<{ key: string; list: HubCharacter[] } | null>(null)
+ const [localRows, setLocal] = useState<{ key: number; list: HubCharacter[] } | null>(null)
+ const cloudKey = `${backend}:${version}`
+ const tauri = isTauri()
+
+ useEffect(() => {
+ let live = true
+ if (backend !== 'cloud') return
+ listLoras()
+ .then((rows) => { if (live) setCloud({ key: cloudKey, list: rows.map(hubFromCloud) }) })
+ .catch(() => { if (live) setCloud({ key: cloudKey, list: [] }) })
+ return () => { live = false }
+ }, [backend, cloudKey])
+
+ useEffect(() => {
+ let live = true
+ if (!tauri) return
+ listLocalCharacters()
+ .then((refs) => { if (live) setLocal({ key: version, list: refs.map(hubFromLocal) }) })
+ .catch(() => { if (live) setLocal({ key: version, list: [] }) })
+ return () => { live = false }
+ }, [tauri, version])
+
+ // A source that is not asked here (cloud off, no Tauri) is an empty list;
+ // one that is asked shows its last answer until the new one is in.
+ const cloud = backend !== 'cloud' ? [] : cloudRows?.list ?? null
+ const local = !tauri ? [] : localRows?.list ?? null
+ const photoSets = saved.map((c) => hubFromSaved(c, c.thumb))
+ return { list: mergeHubCharacters(cloud ?? [], local ?? [], photoSets), loading: cloud === null || local === null }
+}
+
+/** Which character a loaded picture came from, by its address, so a line
+ * says "→ Bean" for the portrait it put there. */
+const portraitNames = new Map<string, string>()
+
+export function hubPortraitName(url: string | null | undefined): string | null {
+ return url ? portraitNames.get(url) ?? null : null
+}
+
+/** The picture of a character as an input image: the first saved photo, or
+ * the base look / last preview of a cloud character. null for a local LoRA
+ * file, which has no picture. */
+export async function hubPortrait(c: HubCharacter | null): Promise<ImageRef | null> {
+ if (!c) return null
+ const first = c.photos?.[0]
+ let ref: ImageRef
+ if (first) {
+ ref = await loadImageRef(new File([first], `${c.name}.jpg`, { type: first.type || 'image/jpeg' }))
+ } else {
+ if (!c.image) return null
+ const res = await fetch(c.image)
+ if (!res.ok) throw new Error(`Could not load the picture of ${c.name}.`)
+ const blob = await res.blob()
+ ref = await loadImageRef(new File([blob], `${c.name}.jpg`, { type: blob.type || 'image/jpeg' }))
+ }
+ portraitNames.set(ref.url, c.name)
+ return ref
+}
+
+/** Image with a local LoRA character: the LoRA joins the chain (one character
+ * at a time), the model it was trained for comes along (GH #161). The same
+ * steps as the old shelf of Character Studio. */
+function applyLocalLora(c: HubCharacter): void {
+ const st = useCreateStore.getState()
+ const file = characterLoraFile(c.ref)
+ if (!file || !c.ref) return
+ for (const l of st.selectedLoras) {
+ if (l.name !== file && parseLocalCharacterLora(l.name)) st.toggleLora(l.name)
+ }
+ if (!useCreateStore.getState().selectedLoras.some((l) => l.name === file)) st.toggleLora(file)
+ const models = st.imageModelList
+ const base = characterBaseModel(file, models, st.imageModel)
+ if (base && base.name !== st.imageModel) st.setImageModel(base.name, base.type)
+ st.setSelectedCharacter(c.ref)
+}
+
+/** Opens an action of the area with the character's inputs filled in. A
+ * photo character on Image goes to Edit with its photos as references (no
+ * LoRA to run). Returns a sentence when the picture could not be loaded;
+ * the action is open all the same. */
+export async function openHubAction(action: HubAction, c: HubCharacter | null, replace = false): Promise<string | null> {
+ const st = useCreateStore.getState()
+ if (action === 'image' && c?.photos?.length && !c.ref) {
+ await loadPhotosAsReferences(c.name, c.photos)
+ return null
+ }
+ st.setIntent(intentOfAction(action))
+ if (action === 'image') {
+ st.setCharacterTab('use')
+ if (c?.kind === 'local') applyLocalLora(c)
+ else st.setSelectedCharacter(c?.ref ?? null)
+ return null
+ }
+ if (!c) return null
+ try {
+ const picture = await hubPortrait(c)
+ if (!picture) return null
+ const now = useCreateStore.getState()
+ if (action === 'swap') {
+ const figures = now.swapFigures
+ if (replace || !figures[0]?.image) now.setSwapFigures(figures.map((f, i) => (i === 0 ? { ...f, image: picture, character: c.name } : f)))
+ } else if (replace || !now.source) {
+ now.setSource(picture)
+ }
+ return null
+ } catch (err) {
+ return err instanceof Error ? err.message : String(err)
+ }
+}
diff --git a/src/components/create/experimental/intents.ts b/src/components/create/experimental/intents.ts
index 4123a168..3120f9f7 100644
--- a/src/components/create/experimental/intents.ts
+++ b/src/components/create/experimental/intents.ts
@@ -5,6 +5,7 @@ import {
import type { LucideIcon } from 'lucide-react'
import type { CreateBackend, CreateIntent } from '../../../stores/createStore'
import { MUSIC_PLACEHOLDER } from '../../../lib/render/music-ui'
+import { isHubIntent } from '../../../lib/create/character-hub'
export interface IntentMeta {
id: CreateIntent
@@ -335,3 +336,37 @@ export function isIntentAvailable(id: CreateIntent, backend: CreateBackend, mlxH
return visibleIntents(backend, mlxHost, true, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk).includes(meta)
&& !isIntentLocked(meta, backend, mlxHost, mlxAnimate, mlxEdit, mlxUpscale, mlxMusic, mlxMotion, mlxTalk)
}
+
+/**
+ * The pill of the Character area (3.1.0 part B): one pill for Character
+ * Studio, Talking Character, Motion Control and Swap Character. It carries the
+ * id of the first of them, so the bar keeps its order (after Animate).
+ */
+export const HUB_PILL: IntentMeta = {
+ ...INTENT_MAP.character,
+ label: 'Character',
+ short: 'Character',
+}
+
+export interface PillEntry {
+ meta: IntentMeta
+ /** The pill of the Character area. */
+ hub: boolean
+}
+
+/**
+ * The pills of the bar: the visible intents, with the four intents of the
+ * Character area folded into one pill where the first of them stood. The
+ * area itself shows which of its actions are local, locked or cloud.
+ */
+export function pillEntries(visible: readonly IntentMeta[]): PillEntry[] {
+ const out: PillEntry[] = []
+ let hubDone = false
+ for (const meta of visible) {
+ if (!isHubIntent(meta.id)) { out.push({ meta, hub: false }); continue }
+ if (hubDone) continue
+ hubDone = true
+ out.push({ meta: HUB_PILL, hub: true })
+ }
+ return out
+}
diff --git a/src/components/create/ui/Button.tsx b/src/components/create/ui/Button.tsx
index 040b3a82..06034aee 100644
--- a/src/components/create/ui/Button.tsx
+++ b/src/components/create/ui/Button.tsx
@@ -20,6 +20,8 @@ interface Props {
ariaLabel?: string
type?: 'button' | 'submit'
active?: boolean
+ /** Extra classes (the phone's pill form of Create in the Character area). */
+ className?: string
}
const SIZE_H: Record<Size, string> = {
@@ -49,7 +51,7 @@ const VARIANT: Record<Variant, string> = {
export function Button({
children, onClick, variant = 'secondary', size = 'md', icon: Icon,
iconOnly = false, loading = false, disabled = false, fullWidth = false,
- title, ariaLabel, type = 'button', active = false,
+ title, ariaLabel, type = 'button', active = false, className,
}: Props) {
const isDisabled = disabled || loading
// Der Druck kommt aus der Hausregel in index.css (`:active { scale: .97 }`),
@@ -73,6 +75,7 @@ export function Button({
active && variant === 'ghost' && 'bg-white/10 text-white',
fullWidth && 'w-full',
isDisabled && 'opacity-40 pointer-events-none',
+ className,
)}
>
{loading ? <Loader2 size={ICON_SIZE[size]} className="animate-spin" />
diff --git a/src/components/create/ui/Select.tsx b/src/components/create/ui/Select.tsx
index e8b619b2..6323de63 100644
--- a/src/components/create/ui/Select.tsx
+++ b/src/components/create/ui/Select.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useRef, useState } from 'react'
+import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { createPortal } from 'react-dom'
import { motion, AnimatePresence } from 'framer-motion'
import { ChevronDown, Search } from 'lucide-react'
@@ -20,6 +20,9 @@ export interface SelectOption {
/** Listed, but not pickable right now; `sublabel` says why (Swap Character:
* Kling "one person only" with several people). */
disabled?: boolean
+ /** Small picture before the name, in the list and in a closed `text`
+ * field (the avatar of a character in the Character area). */
+ lead?: ReactNode
}
/** Eine Marke im Etiketten-Stil der Modellwaehler (index.css, .lu-picker-tag):
@@ -42,6 +45,11 @@ interface Props {
maxHeight?: number
/** Beschriftung fuer Bedienhilfen, wo kein sichtbarer Text danebensteht. */
ariaLabel?: string
+ /** 'text': no box, the value as text with a small arrow, as the model
+ * choice in the chat (Character area, sketches v2). Default 'box'. */
+ variant?: 'box' | 'text'
+ /** Class of the closed field's text (the `text` variant). */
+ textClassName?: string
}
export function Select({
@@ -55,6 +63,8 @@ export function Select({
className,
maxHeight = 280,
ariaLabel,
+ variant = 'box',
+ textClassName,
}: Props) {
const [open, setOpen] = useState(false)
const [query, setQuery] = useState('')
@@ -157,15 +167,21 @@ export function Select({
aria-haspopup="listbox"
aria-expanded={open}
className={cn(
- 't-control inline-flex w-full items-center justify-between gap-2 px-2.5',
- 'rounded-[var(--radius-control)] transition-colors',
- 'bg-white/[0.04] border border-white/[0.08]',
- 'hover:border-white/15 text-gray-200',
- controlHeight,
+ variant === 'text'
+ ? 'inline-flex max-w-full items-center gap-1.5 rounded-md text-gray-200 hover:text-white transition-colors'
+ : cn(
+ 't-control inline-flex w-full items-center justify-between gap-2 px-2.5',
+ 'rounded-[var(--radius-control)] transition-colors',
+ 'bg-white/[0.04] border border-white/[0.08]',
+ 'hover:border-white/15 text-gray-200',
+ controlHeight,
+ ),
+ variant === 'text' && textClassName,
)}
>
<span className="flex min-w-0 items-center gap-1.5">
{current?.badge && <Badge tag={current.badge} />}
+ {variant === 'text' && current?.lead}
<span className="truncate" title={current?.title}>
{current?.label ?? placeholder}
@@ -272,6 +288,7 @@ export function Select({
className={cn('lu-picker-row w-[calc(100%-8px)] text-left', option.disabled && 'cursor-not-allowed opacity-45')}
>
{option.badge && <Badge tag={option.badge} />}
+ {option.lead}
<span className="lu-picker-name truncate">
{option.label}
diff --git a/src/hooks/__tests__/useCloudCreate-swap.test.ts b/src/hooks/__tests__/useCloudCreate-swap.test.ts
index c8c60a27..3e91c49c 100644
--- a/src/hooks/__tests__/useCloudCreate-swap.test.ts
+++ b/src/hooks/__tests__/useCloudCreate-swap.test.ts
@@ -102,6 +102,7 @@ import { useCloudCreate } from '../useCloudCreate'
import { swapKeyOf } from '../../lib/create/swap-frame'
import { useCreateStore } from '../../stores/createStore'
import { useCloudCatalogStore } from '../../stores/cloudCatalogStore'
+import { useCharacterHubReleaseStore } from '../../lib/create/character-hub-release'
import { neuerServer } from '../../lib/render/__tests__/fixtures/test-catalogs'
import { SWAP_CONSENT_MISSING } from '../../lib/render/swap'
@@ -109,6 +110,8 @@ const FOTO = { filename: 'face.png', url: 'data:image/png;base64,AA', width: 512
const CLIP = { name: 'dance.mp4', url: 'blob:dance', blob: new Blob(['x'], { type: 'video/mp4' }) }
beforeEach(() => {
+ // An account the server released the Character area for (features.characterHub).
+ useCharacterHubReleaseStore.setState({ fromMe: true, fromCatalog: null })
submitted.length = 0
hochgeladen.length = 0
hoisted.studioQuote.mockClear()
diff --git a/src/hooks/__tests__/useCloudCreate-ton.test.ts b/src/hooks/__tests__/useCloudCreate-ton.test.ts
index 3bf9a849..0297b650 100644
--- a/src/hooks/__tests__/useCloudCreate-ton.test.ts
+++ b/src/hooks/__tests__/useCloudCreate-ton.test.ts
@@ -93,6 +93,7 @@ import { useCloudCreate } from '../useCloudCreate'
import { swapKeyOf } from '../../lib/create/swap-frame'
import { useCreateStore } from '../../stores/createStore'
import { useCloudCatalogStore } from '../../stores/cloudCatalogStore'
+import { useCharacterHubReleaseStore } from '../../lib/create/character-hub-release'
import { neuerServer } from '../../lib/render/__tests__/fixtures/test-catalogs'
import { LIPSYNC_ONE_PERSON } from '../../lib/render/sound'
@@ -114,6 +115,8 @@ function swapReady(figures: Array<{ image: typeof FOTO; role: string; mark?: { x
}
beforeEach(() => {
+ // An account the server released the Character area for (features.characterHub).
+ useCharacterHubReleaseStore.setState({ fromMe: true, fromCatalog: null })
submitted.length = 0
steps.length = 0
lipOutcome.status = 'succeeded'
@@ -160,6 +163,34 @@ describe('Sound of the video run', () => {
})
})
+describe('without the account switch (features.characterHub)', () => {
+ it('Motion sends no sound at all, also when another one was picked', async () => {
+ useCharacterHubReleaseStore.setState({ fromMe: false, fromCatalog: false })
+ useCreateStore.getState().setIntent('motion')
+ useCreateStore.setState({ source: FOTO as never, videoInput: CLIP, sound: 'none' })
+ await useCloudCreate().generate()
+ expect(useCreateStore.getState().error).toBeNull()
+ expect(submitted).toHaveLength(1)
+ expect(submitted[0].params).not.toHaveProperty('sound')
+ })
+
+ it('Swap stops before any upload: it is coming soon on this account', async () => {
+ useCharacterHubReleaseStore.setState({ fromMe: false, fromCatalog: false })
+ swapReady([{ image: FOTO, role: '' }])
+ await useCloudCreate().generate()
+ expect(useCreateStore.getState().error).toBe('Swap Character is coming soon to your LU Cloud.')
+ expect(steps).toEqual([])
+ expect(submitted).toHaveLength(0)
+ })
+
+ it('the catalogue alone opens it too', async () => {
+ useCharacterHubReleaseStore.setState({ fromMe: null, fromCatalog: true })
+ swapReady([{ image: FOTO, role: '' }])
+ await useCloudCreate().generate()
+ expect(submitted[0].params.sound).toBe('original')
+ })
+})
+
describe('New voice, lips in sync', () => {
it('stops before any upload with two people, with the one person sentence', async () => {
useCreateStore.setState({ sound: 'lipsync', audioInput: VOICE })
diff --git a/src/hooks/useCloudAuth.ts b/src/hooks/useCloudAuth.ts
index 832560e2..10b9dbdd 100644
--- a/src/hooks/useCloudAuth.ts
+++ b/src/hooks/useCloudAuth.ts
@@ -5,6 +5,7 @@
// provider setup.
import { clearCreateChatRelease, noteCreateChatRelease } from '../lib/create/chat-release'
+import { clearCharacterHubRelease, noteCharacterHubFromMe } from '../lib/create/character-hub-release'
import { useCallback, useEffect, useRef } from 'react'
import { supabaseCloud, savedSessionUser, onOAuthSignedIn } from '../api/cloud/supabase'
import { isMobile } from '../lib/device-kind'
@@ -53,6 +54,7 @@ export async function probeAccount(): Promise<void> {
if (stale()) return
if (!me.user) {
clearCreateChatRelease()
+ clearCharacterHubRelease()
store.setSignedOut()
syncChatProvider()
syncAppMode()
@@ -61,6 +63,7 @@ export async function probeAccount(): Promise<void> {
// The same answer says whether Create in chat is released for this
// account: one probe, two facts (lib/create/chat-release.ts).
noteCreateChatRelease(me)
+ noteCharacterHubFromMe(me)
const licenseActive = me.license?.status === 'active'
// Server-driven access gate (beta is fully open — servers send true for
// every licensed account): absent on older servers = allowed.
@@ -110,6 +113,7 @@ export async function probeAccount(): Promise<void> {
}
if (authFailure || useCloudAuthStore.getState().status === 'probing') {
clearCreateChatRelease()
+ clearCharacterHubRelease()
store.setSignedOut()
syncChatProvider()
syncAppMode()
@@ -192,6 +196,7 @@ export async function signOutAccount(): Promise<void> {
// Moment vorgespielt bekommen, waehrend im Hintergrund noch gerechnet wird.
stopAllBackgroundWork()
clearCreateChatRelease()
+ clearCharacterHubRelease()
useCloudAuthStore.getState().setSignedOut()
syncChatProvider()
syncAppMode()
diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.ts
index 7b35f3e7..77c5ecf5 100644
--- a/src/hooks/useCloudCreate.ts
+++ b/src/hooks/useCloudCreate.ts
@@ -46,6 +46,7 @@ import { adoptSwapFrame, swapInputError, swapRunParams } from '../lib/create/swa
import { swapConfirmedFrame } from '../lib/create/swap-frame'
import { lipsyncCredits, soundApplies, soundClipSeconds, soundInputError, soundParam, soundStudioOptions } from '../lib/render/sound'
import { lipsyncFailedText, runLipsyncStep } from '../lib/create/lipsync-chain'
+import { characterHubReleasedHere } from '../lib/create/character-hub-release'
import { mediaSeconds } from '../components/create/experimental/useStudioPrice'
import { IMPROVING_PROMPT } from '../lib/render/improve-prompt'
import { improveKindForRun } from '../lib/render/music-ui'
@@ -475,6 +476,12 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
// that run would go out as a plain motion job, so it stops here.
const swap = isSwapIntent(intent)
if (swap) {
+ // Without the account switch the server refuses the swap (403
+ // preview_feature_off); the panel says "Coming soon" and no run starts.
+ if (!characterHubReleasedHere()) {
+ s.setError('Swap Character is coming soon to your LU Cloud.')
+ return
+ }
if (!studioModel) {
s.setError('Swap Character needs a newer LU Cloud. Try again later.')
return
@@ -493,7 +500,7 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
}
// Sound (14.11.2026, lib/render/sound.ts): Swap and Motion on the cloud.
// A new voice with lips needs the voice and at most one person.
- const sound = soundApplies(intent, 'cloud') ? s.sound : undefined
+ const sound = soundApplies(intent, 'cloud', characterHubReleasedHere()) ? s.sound : undefined
{
const people = swap ? s.swapFigures.length : 1
const invalid = soundInputError(sound, people, 'cloud', !!s.audioInput || !!s.voiceFromJob, s.lipsyncModel)
diff --git a/src/index.css b/src/index.css
index 0d0caa1a..70152e93 100644
--- a/src/index.css
+++ b/src/index.css
@@ -3052,3 +3052,60 @@ input[type="range"].neuron-range:disabled { cursor: not-allowed; opacity: 0.5; }
.lu-look[data-mode="dark"] .lu-chat-scrim { background-color: #1e1e1e; }
.lu-look-has-bg .lu-msg-text { text-shadow: 0 0 6px rgba(255, 255, 255, 0.55); }
.lu-look-has-bg[data-mode="dark"] .lu-msg-text { text-shadow: 0 0 6px rgba(0, 0, 0, 0.6); }
+
+/* ─────────────────────────────────────────────────────────────────────
+ Character area (3.1.0 part B, David's sketches v2 of 14.11.2026,
+ uebergabe-310/SWAP-HUB-bilder/mockups-v2/stil-notizen.md).
+ The colours of the sketches as tokens, measured from the Create screens:
+ hairlines, three text greys, the accent. Not a card style: the area is
+ rows on the surface, and the only framed part is the bar at its foot.
+ Own tokens because the rescue layer above lifts `.dark .text-gray-500`
+ to gray-400, and the sketches keep the two greys apart (muted, dim).
+ ───────────────────────────────────────────────────────────────────── */
+.lu-hub {
+ --hub-sep: rgba(255, 255, 255, 0.06);
+ --hub-edge: rgba(255, 255, 255, 0.10);
+ --hub-fill: rgba(255, 255, 255, 0.03);
+ --hub-hov: rgba(255, 255, 255, 0.045);
+ --hub-text: #f3f4f6;
+ --hub-muted: #9ca3af;
+ --hub-dim: #6b7280;
+ --hub-acc: #a094f8;
+ --hub-soft: rgba(160, 148, 248, 0.14);
+}
+.light .lu-hub {
+ --hub-sep: #eceef1;
+ --hub-edge: #e5e7eb;
+ --hub-fill: #f9fafb;
+ --hub-hov: #f5f6f8;
+ --hub-text: #111827;
+ --hub-muted: #4b5563;
+ --hub-dim: #8b919c;
+ --hub-acc: #5746d9;
+ --hub-soft: rgba(87, 70, 217, 0.09);
+}
+.lu-hub .hub-text { color: var(--hub-text); }
+.lu-hub .hub-muted { color: var(--hub-muted); }
+.lu-hub .hub-dim { color: var(--hub-dim); }
+.lu-hub .hub-acc { color: var(--hub-acc); }
+.lu-hub .hub-line { border-color: var(--hub-sep); }
+.lu-hub .hub-hover:hover { background-color: var(--hub-hov); }
+.lu-hub .hub-soft { background-color: var(--hub-soft); }
+/* The bar at the foot: the same build as the chat composer, 1px edge, 8px. */
+.lu-hub .hub-bar { border: 1px solid var(--hub-edge); background: var(--hub-fill); border-radius: 8px; }
+/* The role of a person in Swap reads as text until it is typed over. */
+.lu-hub .hub-role::placeholder { color: var(--hub-text); }
+/* The type of the Character area: the sizes of the sketches in rendered
+ pixels (Inter 14 / 13 / 12.5 / 12 / 11 / 10), divided by the app's
+ --ui-scale, so a line of the area reads exactly as in the sketch. One
+ place for them instead of a `text-[…]` per call site (die-typo-leiter). */
+.hub-fs-14 { font-size: calc(14px / var(--ui-scale, 1.15)); line-height: 1.4; }
+.hub-fs-13 { font-size: calc(13px / var(--ui-scale, 1.15)); line-height: 1.4; }
+.hub-fs-125 { font-size: calc(12.5px / var(--ui-scale, 1.15)); line-height: 1.4; }
+.hub-fs-12 { font-size: calc(12px / var(--ui-scale, 1.15)); line-height: 1.4; }
+.hub-fs-11 { font-size: calc(11px / var(--ui-scale, 1.15)); line-height: 1.3; }
+.hub-fs-10 { font-size: calc(10px / var(--ui-scale, 1.15)); line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
+/* The segments of the area (Sound, Resolution) take the sketch's 12 px. */
+.hub-seg { --text-control: calc(12px / var(--ui-scale, 1.15)); }
+/* The NEW mark on the Character pill: accent on a faint accent ground. */
+.lu-new-mark { font-size: 7px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.4; }
diff --git a/src/lib/create/__tests__/character-hub.test.ts b/src/lib/create/__tests__/character-hub.test.ts
new file mode 100644
index 00000000..d1c95ed1
--- /dev/null
+++ b/src/lib/create/__tests__/character-hub.test.ts
@@ -0,0 +1,136 @@
+/**
+ * The Character area (3.1.0 part B): one pill for four intents, the inner ids
+ * stay, every way that sets one of them (gallery, chat, preset, phone) opens
+ * the panel of its action, and the account switch of the server decides about
+ * Swap and the sound.
+ *
+ * Run: npx vitest run src/lib/create/__tests__/character-hub.test.ts
+ */
+import { beforeEach, describe, expect, it } from 'vitest'
+import {
+ HUB_INTENTS, actionMeta, actionOfIntent, hubFromCloud, hubFromLocal, hubFromSaved, hubHasPortrait,
+ intentOfAction, isHubIntent, mergeHubCharacters, whatHeading, actionCloudPrice,
+} from '../character-hub'
+import {
+ characterHubReleasedHere, clearCharacterHubRelease, noteCharacterHubFromCatalog, noteCharacterHubFromMe,
+ useCharacterHubReleaseStore,
+} from '../character-hub-release'
+import { INTENTS, pillEntries, HUB_PILL } from '../../../components/create/experimental/intents'
+import { useCreateStore } from '../../../stores/createStore'
+import { useCloudCatalogStore } from '../../../stores/cloudCatalogStore'
+import { opSlot } from '../../../stores/createStore'
+
+describe('the intents keep their ids', () => {
+ it('four intents, four actions, both ways', () => {
+ expect(HUB_INTENTS).toEqual(['character', 'swap_character', 'motion', 'lipsync'])
+ for (const a of ['image', 'swap', 'motion', 'talk'] as const) expect(actionOfIntent(intentOfAction(a))).toBe(a)
+ expect(actionOfIntent('music')).toBeNull()
+ expect(isHubIntent('extend')).toBe(false)
+ })
+
+ it('the bar folds the four into one pill where Character stood', () => {
+ const pills = pillEntries(INTENTS)
+ expect(pills.map((p) => p.meta.short)).toEqual(['Image', 'Edit', 'Cutout', 'Enhance', 'Erase', 'Video', 'Animate', 'Character', 'Music', 'Extend'])
+ const hub = pills.find((p) => p.hub)!
+ expect(hub.meta).toBe(HUB_PILL)
+ expect(hub.meta.label).toBe('Character')
+ // Without Character Studio in the list (a host that hides it) the pill
+ // takes the place of the first intent of the area that is there.
+ const noStudio = pillEntries(INTENTS.filter((m) => m.id !== 'character'))
+ expect(noStudio.filter((p) => p.hub)).toHaveLength(1)
+ })
+})
+
+describe('characters from every source', () => {
+ const lora = { id: 'c1', name: 'Bean', trigger_word: 'beanchar', base_family: 'flux', created_at: '', source: 'trained' as const, base_url: 'https://x/b.png', preview_url: 'https://x/p.png' }
+ it('meta words as in the sketch', () => {
+ expect(hubFromCloud(lora).meta).toBe('Trained · Flux')
+ expect(hubFromCloud({ ...lora, source: 'uploaded', base_family: 'qwen-image' }).meta).toBe('Uploaded · Qwen')
+ expect(hubFromLocal({ id: 'local:char_opa_zimage.safetensors', name: 'opa', triggerWord: 'opa', family: 'zimage' }).meta).toBe('Local LoRA')
+ expect(hubFromSaved({ id: 's1', name: 'Sam', photos: Array.from({ length: 12 }, () => new Blob()) }, 'blob:t').meta).toBe('Photos · 12')
+ })
+
+ it('the base look leads the picture, then the preview', () => {
+ expect(hubFromCloud(lora).image).toBe('https://x/b.png')
+ expect(hubFromCloud({ ...lora, base_url: null }).image).toBe('https://x/p.png')
+ expect(hubHasPortrait(hubFromLocal({ id: 'local:a', name: 'a', triggerWord: 'a', family: 'zimage' }))).toBe(false)
+ })
+
+ it('one list, cloud first, no key twice', () => {
+ const c = hubFromCloud(lora)
+ const l = hubFromLocal({ id: 'local:x', name: 'x', triggerWord: 'x', family: 'zimage' })
+ expect(mergeHubCharacters([c], [l, l], []).map((x) => x.key)).toEqual(['cloud:c1', 'local:x'])
+ expect(whatHeading(c)).toBe('What should Bean do?')
+ expect(whatHeading(null)).toBe('What should your character do?')
+ })
+})
+
+describe('prices of step 2', () => {
+ it('Local first, the cloud price after it; none from a catalogue without the models', () => {
+ expect(actionMeta({ local: true, cloudPrice: 'from 3k', showCloud: true })).toBe('Local · from 3k')
+ expect(actionMeta({ local: false, cloudPrice: '8k / s', showCloud: true })).toBe('8k / s')
+ expect(actionMeta({ local: true, cloudPrice: '8k / s', showCloud: false })).toBe('Local')
+ useCloudCatalogStore.setState({ models: [] })
+ expect(actionCloudPrice('swap')).toBeNull()
+ })
+
+ it('Swap: SCAIL 2 per second when the catalogue lists it', () => {
+ useCloudCatalogStore.setState({ models: [{ id: 'scail-2', label: 'SCAIL 2', kind: 'video', ops: ['studio'], quote_required: true } as never] })
+ expect(actionCloudPrice('swap')).toBe('8k / s')
+ })
+})
+
+describe('the store', () => {
+ beforeEach(() => {
+ useCreateStore.setState({ backend: 'cloud', hubStep: 'who', hubCharacter: null, hubLastIntent: null })
+ useCreateStore.getState().setIntent('image')
+ })
+
+ it('the pill opens step 1, later the action that was open', () => {
+ useCreateStore.getState().openCharacterHub()
+ expect(useCreateStore.getState().intent()).toBe('character')
+ expect(useCreateStore.getState().hubStep).toBe('who')
+ useCreateStore.getState().setIntent('motion')
+ useCreateStore.getState().setIntent('image')
+ useCreateStore.getState().openCharacterHub()
+ expect(useCreateStore.getState().intent()).toBe('motion')
+ expect(useCreateStore.getState().hubStep).toBe('panel')
+ })
+
+ it('a gallery reuse, the chat or a preset (setIntent) opens the panel of its action', () => {
+ for (const intent of ['lipsync', 'motion', 'swap_character', 'character'] as const) {
+ useCreateStore.setState({ hubStep: 'who' })
+ useCreateStore.getState().setIntent(intent)
+ expect(useCreateStore.getState().hubStep).toBe('panel')
+ }
+ })
+
+ it('the opSlot of Use character is the same as before', () => {
+ useCreateStore.getState().setIntent('character')
+ useCreateStore.getState().setCharacterTab('use')
+ expect(opSlot(useCreateStore.getState())).toBe('character:use')
+ })
+})
+
+describe('the account switch', () => {
+ beforeEach(() => clearCharacterHubRelease())
+
+ it('not answered is no; /api/me or the catalogue say yes', () => {
+ expect(characterHubReleasedHere()).toBe(false)
+ noteCharacterHubFromMe({ user: { id: 'u' }, features: { createChat: false } })
+ expect(characterHubReleasedHere()).toBe(false)
+ noteCharacterHubFromCatalog({ models: [], features: { characterHub: true } })
+ expect(characterHubReleasedHere()).toBe(true)
+ clearCharacterHubRelease()
+ noteCharacterHubFromMe({ features: { characterHub: true } })
+ expect(characterHubReleasedHere()).toBe(true)
+ expect(useCharacterHubReleaseStore.getState().fromMe).toBe(true)
+ })
+
+ it('a catalogue from the server reaches the switch through the store', () => {
+ useCloudCatalogStore.getState().setCatalog({ models: [], ops: { removebg: 0, eraser: 0, upscale_image: 0, upscale_video_per_s: 0, upscale_video_min: 0 }, voice: { stt: 0, tts_per_1k_chars: 0 }, media_live: true, tier: 'x', monthly_credits: 0, features: { characterHub: true } })
+ expect(characterHubReleasedHere()).toBe(true)
+ useCloudCatalogStore.getState().setCatalog({ models: [], ops: { removebg: 0, eraser: 0, upscale_image: 0, upscale_video_per_s: 0, upscale_video_min: 0 }, voice: { stt: 0, tts_per_1k_chars: 0 }, media_live: true, tier: 'x', monthly_credits: 0 })
+ expect(characterHubReleasedHere()).toBe(false)
+ })
+})
diff --git a/src/lib/create/character-hub-release.ts b/src/lib/create/character-hub-release.ts
new file mode 100644
index 00000000..dc81b08b
--- /dev/null
+++ b/src/lib/create/character-hub-release.ts
@@ -0,0 +1,58 @@
+import { create } from 'zustand'
+
+/**
+ * Is the new Character area of LU Cloud released for THIS account?
+ *
+ * The server decides (CHARACTER_HUB and CHARACTER_HUB_ALLOWLIST, web
+ * lib/character-hub.ts) and says so as `features.characterHub: true`, both in
+ * /api/me and in /api/jobs/catalog. Without the switch the field is missing
+ * and the server refuses the new parts with 403 (preview_feature_off).
+ *
+ * What hangs on it here: Swap Character (two steps, Kling), every sound
+ * choice except the original sound, and the lip sync step after a video.
+ * The Character area itself is always there; without the switch the Swap
+ * action says "Coming soon to your LU Cloud" and Motion sends no sound.
+ *
+ * Same shape as Create in chat (chat-release.ts): the app only holds the
+ * answer, nothing in the build or the settings can switch it on. `null` means
+ * not answered yet and reads as "not released".
+ */
+interface ReleaseState {
+ fromMe: boolean | null
+ fromCatalog: boolean | null
+}
+
+export const useCharacterHubReleaseStore = create<ReleaseState>(() => ({ fromMe: null, fromCatalog: null }))
+
+function flagOf(body: unknown): boolean {
+ return (body as { features?: { characterHub?: unknown } } | null)?.features?.characterHub === true
+}
+
+/** The answer of /api/me. A body without the field is a no. */
+export function noteCharacterHubFromMe(me: unknown): void {
+ useCharacterHubReleaseStore.setState({ fromMe: flagOf(me) })
+}
+
+/** The answer of /api/jobs/catalog. A catalog without the field is a no. */
+export function noteCharacterHubFromCatalog(catalog: unknown): void {
+ useCharacterHubReleaseStore.setState({ fromCatalog: flagOf(catalog) })
+}
+
+/** Signed out, or the probe was refused: nothing is released. */
+export function clearCharacterHubRelease(): void {
+ useCharacterHubReleaseStore.setState({ fromMe: null, fromCatalog: null })
+}
+
+function released(s: ReleaseState): boolean {
+ return s.fromMe === true || s.fromCatalog === true
+}
+
+/** For code outside React (the submit). */
+export function characterHubReleasedHere(): boolean {
+ return released(useCharacterHubReleaseStore.getState())
+}
+
+/** For components. Kept current by the account probe and the catalog. */
+export function useCharacterHubReleased(): boolean {
+ return useCharacterHubReleaseStore(released)
+}
diff --git a/src/lib/create/character-hub.ts b/src/lib/create/character-hub.ts
new file mode 100644
index 00000000..06d98e76
--- /dev/null
+++ b/src/lib/create/character-hub.ts
@@ -0,0 +1,220 @@
+// The Character area of Create (3.1.0, part B, David's sketches v2 of
+// 14.11.2026, uebergabe-310/CHARACTER-HUB-KONZEPT.md).
+//
+// One pill "Character" instead of four (Character, Motion, Lipsync, Swap).
+// Three steps: 1 Who? (a character from every source), 2 What? (Image, Swap,
+// Motion, Talk), 3 the panel of that action. The inner intent ids stay as
+// they were (`character`, `motion`, `lipsync`, `swap_character`): the gallery
+// Reuse, the chat tools, the presets, the phone and the opSlot keys all keep
+// working, an action is only a new name for an intent.
+//
+// Pure: no React, no store writes. The store only lends its types.
+
+import type { CloudLora } from '../../api/cloud/loras'
+import type { CharacterRef } from '../character-ref'
+import type { CreateIntent } from '../../stores/createStore'
+import {
+ characterGenerationModels, cloudModelById, lengthPrice, loraGenModels,
+} from '../../stores/cloudCatalogStore'
+import { intentPickerModels } from '../render/create-studio'
+import { STUDIO_MODELS } from '../render/studio-contract'
+import { SWAP_INTENT, SWAP_MAIN_MODEL, swapCreditsPerSecond, swapDefaultOptions, swapShortCredits } from '../render/swap'
+
+/** The intents the one pill stands for, in the order of step 2. */
+export const HUB_INTENTS: readonly CreateIntent[] = ['character', 'swap_character', 'motion', 'lipsync']
+
+export function isHubIntent(intent: CreateIntent | string): boolean {
+ return (HUB_INTENTS as readonly string[]).includes(intent)
+}
+
+export type HubAction = 'image' | 'swap' | 'motion' | 'talk'
+
+export const HUB_ACTIONS: readonly HubAction[] = ['image', 'swap', 'motion', 'talk']
+
+const ACTION_INTENT: Record<HubAction, CreateIntent> = {
+ image: 'character',
+ swap: 'swap_character',
+ motion: 'motion',
+ talk: 'lipsync',
+}
+
+export function intentOfAction(action: HubAction): CreateIntent {
+ return ACTION_INTENT[action]
+}
+
+/** The action an intent opens, or null for an intent outside the area. */
+export function actionOfIntent(intent: CreateIntent | string): HubAction | null {
+ const hit = HUB_ACTIONS.find((a) => ACTION_INTENT[a] === intent)
+ return hit ?? null
+}
+
+export const ACTION_LABEL: Record<HubAction, string> = {
+ image: 'Image',
+ swap: 'Swap',
+ motion: 'Motion',
+ talk: 'Talk',
+}
+
+export const ACTION_LINE: Record<HubAction, string> = {
+ image: 'New pictures of your character',
+ swap: 'Put your character into a real video',
+ motion: 'Your character copies a dance or move',
+ talk: 'Your character says your text',
+}
+
+/** Where the area stands: who, what, or the panel of an action. */
+export type HubStep = 'who' | 'what' | 'panel'
+
+// Characters from every source.
+
+export type HubCharacterKind = 'cloud' | 'local' | 'saved'
+
+export interface HubCharacter {
+ /** Unique over all sources: 'cloud:<id>', the local ref id ('local:…',
+ * 'mlx:…') or 'saved:<id>'. */
+ key: string
+ kind: HubCharacterKind
+ name: string
+ /** Grey line on the right: "Trained · Flux", "Photos · 12", "Local LoRA". */
+ meta: string
+ /** A picture of the character: the base look, the last preview or the
+ * first photo. null where there is none (a local LoRA file). */
+ image: string | null
+ /** LoRA characters: what the image run reads. */
+ ref?: CharacterRef
+ /** The cloud row as the server sent it (download, use locally, delete). */
+ lora?: CloudLora
+ /** Saved photo characters (IndexedDB). */
+ photos?: Blob[]
+}
+
+const FAMILY_LABEL: Record<string, string> = {
+ flux: 'Flux',
+ 'z-image': 'Z-Image',
+ zimage: 'Z-Image',
+ 'qwen-image': 'Qwen',
+ 'ltx-2': 'LTX video',
+}
+
+export function familyLabel(family: string): string {
+ return FAMILY_LABEL[family] ?? family
+}
+
+/** A trained or uploaded LoRA of LU Cloud. */
+export function hubFromCloud(lora: CloudLora): HubCharacter {
+ const word = lora.source === 'uploaded' ? 'Uploaded' : 'Trained'
+ return {
+ key: `cloud:${lora.id}`,
+ kind: 'cloud',
+ name: lora.name,
+ meta: `${word} · ${familyLabel(lora.base_family)}`,
+ image: lora.base_url || lora.preview_url || null,
+ ref: { id: lora.id, name: lora.name, triggerWord: lora.trigger_word, family: lora.base_family },
+ lora,
+ }
+}
+
+/** A `char_*.safetensors` of this machine (ComfyUI loras or the Mac folder). */
+export function hubFromLocal(ref: CharacterRef): HubCharacter {
+ return { key: ref.id, kind: 'local', name: ref.name || ref.triggerWord, meta: 'Local LoRA', image: null, ref }
+}
+
+/** A character saved from photos or frames on this machine. */
+export function hubFromSaved(saved: { id: string; name: string; photos: Blob[] }, thumb: string | null): HubCharacter {
+ return {
+ key: `saved:${saved.id}`,
+ kind: 'saved',
+ name: saved.name,
+ meta: `Photos · ${saved.photos.length}`,
+ image: thumb,
+ photos: saved.photos,
+ }
+}
+
+/** One list over all sources: cloud first (the base look leads), then this
+ * machine's LoRAs, then the saved photo sets. A name that two sources share
+ * stays twice: they are two different characters. */
+export function mergeHubCharacters(cloud: HubCharacter[], local: HubCharacter[], saved: HubCharacter[]): HubCharacter[] {
+ const seen = new Set<string>()
+ return [...cloud, ...local, ...saved].filter((c) => !seen.has(c.key) && !!seen.add(c.key))
+}
+
+/** The initial of a character without a picture. */
+export function hubInitial(name: string): string {
+ return (name.trim()[0] ?? '?').toUpperCase()
+}
+
+/** Does this character bring a picture that Swap, Motion and Talk can start
+ * from? A local LoRA file has none; there the panel asks for a photo. */
+export function hubHasPortrait(c: HubCharacter | null): boolean {
+ return !!c && (!!c.image || (c.photos?.length ?? 0) > 0)
+}
+
+// Prices for step 2. Every figure comes from the server's catalogue; an
+// action whose models the catalogue does not list shows no price.
+
+/** Credits per second of one model, or null when it is not priced by length. */
+export function perSecondCredits(id: string): number | null {
+ const studio = STUDIO_MODELS[id]
+ if (studio) {
+ if (!cloudModelById(id)) return null
+ const mode = studio.price.mode
+ if (mode !== 'output' && mode !== 'input' && mode !== 'both' && mode !== 'inout') return null
+ return swapCreditsPerSecond(id, { ...(studio.defaults ?? {}), ...swapDefaultOptions(SWAP_INTENT, id) })
+ }
+ const rate = lengthPrice(id)
+ if (!rate || rate.basis === 'chars') return null
+ return Math.ceil(rate.per_block / rate.block)
+}
+
+function flatCredits(id: string): number | null {
+ const base = cloudModelById(id)?.credits?.base
+ return typeof base === 'number' && base > 0 ? base : null
+}
+
+function cheapest(values: (number | null)[]): number | null {
+ const v = values.filter((x): x is number => x !== null && Number.isFinite(x) && x > 0)
+ return v.length ? Math.min(...v) : null
+}
+
+/** The cloud price of an action as step 2 shows it: "8k / s", "from 3k",
+ * "from 3k / s". null when the catalogue lists no model for it. `family`
+ * is the LoRA family of the picked character (Image runs on its models). */
+export function actionCloudPrice(action: HubAction, family?: string): string | null {
+ if (action === 'swap') {
+ const s = perSecondCredits(SWAP_MAIN_MODEL)
+ return s === null ? null : `${swapShortCredits(s)} / s`
+ }
+ if (action === 'image') {
+ const list = family ? characterGenerationModels(family) : loraGenModels()
+ const c = cheapest(list.map((m) => flatCredits(m.id)))
+ return c === null ? null : `from ${swapShortCredits(c)}`
+ }
+ const ids = intentPickerModels(action === 'motion' ? 'motion' : 'lipsync').map((m) => m.id).filter((id) => !!cloudModelById(id))
+ if (ids.length === 0) return null
+ const perS = ids.map(perSecondCredits)
+ const s = cheapest(perS)
+ if (s !== null) return `${ids.length > 1 ? 'from ' : ''}${swapShortCredits(s)} / s`
+ const flat = cheapest(ids.map(flatCredits))
+ return flat === null ? null : `from ${swapShortCredits(flat)}`
+}
+
+/** The grey line on the right of an action row. `local`: the action has a
+ * local lane on this machine. `cloud`: the price shows (cloud mode, or local
+ * mode with the cloud features on). */
+export function actionMeta(opts: { local: boolean; cloudPrice: string | null; showCloud: boolean }): string {
+ const parts: string[] = []
+ if (opts.local) parts.push('Local')
+ if (opts.showCloud && opts.cloudPrice) parts.push(opts.cloudPrice)
+ return parts.join(' · ')
+}
+
+/** The heading over step 2. */
+export function whatHeading(c: HubCharacter | null): string {
+ return c ? `What should ${c.name} do?` : 'What should your character do?'
+}
+
+export const HUB_SWAP_SOON = 'Coming soon to your LU Cloud'
+export const HUB_JUST_PHOTO = 'Just use a photo'
+export const HUB_JUST_PHOTO_LINE = 'Enough for Swap and Motion. Nothing is saved.'
+export const HUB_LOCAL_LINE = 'Local runs on your own machine and costs nothing. Cloud prices in credits.'
diff --git a/src/lib/render/__tests__/data-url-fetch-guard.test.ts b/src/lib/render/__tests__/data-url-fetch-guard.test.ts
index 0f21fbda..c3322399 100644
--- a/src/lib/render/__tests__/data-url-fetch-guard.test.ts
+++ b/src/lib/render/__tests__/data-url-fetch-guard.test.ts
@@ -29,6 +29,10 @@ const SERVER_ONLY: Record<string, Record<string, string>> = {
'hooks/useCloudCreate.ts': { 'vj.result_url': 'signed result URL of a cloud job', 'src.result_url': 'signed result URL of a cloud job' },
'components/create/experimental/PresetWorkshop.tsx': { 'fresh.result_url': 'signed result URL of a cloud job' },
'components/chat/create/save-media.ts': { url: 'result URL of an order card, always a server file' },
+ // The Character area: the picture of a cloud character, the base look or
+ // the last preview as /api/loras signs it (https). A saved photo character
+ // is read from its own blobs and never comes here.
+ 'components/create/experimental/hub/hubCharacters.ts': { 'c.image': 'signed https picture of a cloud character from /api/loras' },
// The phone. None of the seven reads media; each sends a request to a server address the app builds.
'lib/lu-native.ts': { 'request.url': 'the browser stand-in of the native request to a paired desktop: method, headers and body to its http(s) address' },
'mobile/remote/remoteClient.ts': { url: 'API routes of a paired desktop, built from its http(s) base address' },
diff --git a/src/lib/render/__tests__/sound.test.ts b/src/lib/render/__tests__/sound.test.ts
index c65898d4..d7ac487d 100644
--- a/src/lib/render/__tests__/sound.test.ts
+++ b/src/lib/render/__tests__/sound.test.ts
@@ -25,11 +25,14 @@ describe('sound choice', () => {
})
it('stands in Swap and Motion on the cloud only', () => {
- expect(soundApplies('swap_character', 'cloud')).toBe(true)
- expect(soundApplies('motion', 'cloud')).toBe(true)
- expect(soundApplies('motion', 'local')).toBe(false)
- expect(soundApplies('lipsync', 'cloud')).toBe(false)
- expect(soundApplies('video', 'cloud')).toBe(false)
+ expect(soundApplies('swap_character', 'cloud', true)).toBe(true)
+ expect(soundApplies('motion', 'cloud', true)).toBe(true)
+ expect(soundApplies('motion', 'local', true)).toBe(false)
+ expect(soundApplies('lipsync', 'cloud', true)).toBe(false)
+ expect(soundApplies('video', 'cloud', true)).toBe(false)
+ // Without the account switch (features.characterHub) there is no choice.
+ expect(soundApplies('motion', 'cloud', false)).toBe(false)
+ expect(soundApplies('swap_character', 'cloud', false)).toBe(false)
})
it('lip sync: one person, cloud only, and only when the server lists the model', () => {
diff --git a/src/lib/render/sound.ts b/src/lib/render/sound.ts
index 9fdbb04a..5d1aa62f 100644
--- a/src/lib/render/sound.ts
+++ b/src/lib/render/sound.ts
@@ -40,9 +40,13 @@ export const LIPSYNC_ONE_PERSON = 'Lip sync works with one person'
export const LIPSYNC_CLOUD_ONLY = 'Cloud only'
export const LIPSYNC_NOT_AVAILABLE = 'Lip sync is not available on this LU Cloud'
-/** Where the sound choice stands: Swap and Motion, cloud only. */
-export function soundApplies(intent: string, backend: string): boolean {
- if (backend !== 'cloud') return false
+/** Where the sound choice stands: Swap and Motion, cloud only, and only for
+ * an account the server released the Character area for (features.characterHub,
+ * lib/create/character-hub-release.ts). Without the switch the server takes
+ * no `sound` but the original, so the run sends none and the choice is not
+ * shown. */
+export function soundApplies(intent: string, backend: string, released: boolean): boolean {
+ if (backend !== 'cloud' || !released) return false
return intent === 'motion' || isSwapIntent(intent)
}
diff --git a/src/mobile/__tests__/pruefer-funde-r30.test.ts b/src/mobile/__tests__/pruefer-funde-r30.test.ts
index 34d110f0..500af9e4 100644
--- a/src/mobile/__tests__/pruefer-funde-r30.test.ts
+++ b/src/mobile/__tests__/pruefer-funde-r30.test.ts
@@ -27,6 +27,13 @@ interface Allowed {
}
const ALLOWED: readonly Allowed[] = [
+ {
+ reason: 'The Swap action of the desktop Character area while the server has not released it for the account (CHARACTER_HUB, 14.11.2026). David chose the words. The phone has no Swap tool; the files only come along with the shared store and submit.',
+ at: {
+ 'lib/create/character-hub.ts': ['Coming soon to your LU Cloud'],
+ 'hooks/useCloudCreate.ts': ['Swap Character is coming soon to your LU Cloud.'],
+ },
+ },
{
reason: 'A state of the user\'s own things: nothing made, saved, sent, chosen or measured so far. "yet" says what the user can still do, not what LU will build later.',
at: {
diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.ts
index 0e95a904..93432002 100644
--- a/src/stores/cloudCatalogStore.ts
+++ b/src/stores/cloudCatalogStore.ts
@@ -15,6 +15,7 @@ import {
} from '../lib/render/studio-roles'
import type { RenderKind, RenderOp } from '../lib/render/cloud-jobs'
import { getCatalog, type CatalogOps, type CloudCatalog } from '../api/cloud/catalog'
+import { noteCharacterHubFromCatalog } from '../lib/create/character-hub-release'
interface CloudCatalogState {
fetchedAt: number | null
@@ -40,7 +41,10 @@ export const useCloudCatalogStore = create<CloudCatalogState>()(
mediaLive: null,
uploadLimits: null,
- setCatalog: (c) =>
+ setCatalog: (c) => {
+ // The switch of the Character area rides on the same answer; it is
+ // not persisted, a restart asks the server again.
+ noteCharacterHubFromCatalog(c)
set({
fetchedAt: Date.now(),
models: c.models,
@@ -48,7 +52,8 @@ export const useCloudCatalogStore = create<CloudCatalogState>()(
voice: c.voice,
mediaLive: c.media_live,
uploadLimits: c.upload_limits ?? null,
- }),
+ })
+ },
}),
{
name: 'lu-cloud-catalog',
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 7bfb5c10..4b7bb83d 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -117,6 +117,9 @@ export interface SwapFigure {
role: string
/** Where the customer tapped this person in the first frame (0 to 1). */
mark?: { x: number; y: number } | null
+ /** The character of the Character area this person becomes, by name, so
+ * the row says "→ Bean". Unset for a photo picked by hand. */
+ character?: string | null
}
/** Swap Character in two steps (14.11.2026, as on the web): the first frame
@@ -157,6 +160,7 @@ export type { CharacterRef }
* URL for preview. Runtime-only — never persisted.
*/
import type { ImageRef } from '../lib/image-ref'
+import { isHubIntent, type HubCharacter, type HubStep } from '../lib/create/character-hub'
export type { ImageRef }
/** Flatten mode / sub-mode / removebg / utilityOp / cloudOp into the single
@@ -500,6 +504,13 @@ export interface CreateState {
/** Swap Character: the built and (after Continue) confirmed first frame.
* Runtime-only. */
swapBuilt: SwapBuilt | null
+ /** The Character area (3.1.0 part B): which of its three steps shows. Only
+ * read while the intent is one of HUB_INTENTS. Runtime-only. */
+ hubStep: HubStep
+ /** The character picked in step 1, null for "Just use a photo". Runtime-only. */
+ hubCharacter: HubCharacter | null
+ /** The action last open in the area, so the pill goes back to it. */
+ hubLastIntent: CreateIntent | null
/** Swap and Motion on the cloud (14.11.2026): the sound of the result
* (lib/render/sound.ts). Runtime-only, the original sound by default. */
sound: 'original' | 'none' | 'lipsync'
@@ -769,6 +780,10 @@ export interface CreateState {
setSwapConsent: (consent: boolean) => void
setSwapFrame: (frame: SwapFrame | null) => void
setSwapBuilt: (built: SwapBuilt | null) => void
+ setHubStep: (step: HubStep) => void
+ setHubCharacter: (c: HubCharacter | null) => void
+ /** The pill "Character": back to the action that was open, else step 1. */
+ openCharacterHub: () => void
setSound: (sound: 'original' | 'none' | 'lipsync') => void
setLipsyncModel: (model: string) => void
setLipsyncCredits: (credits: number | null) => void
@@ -1272,6 +1287,9 @@ export const useCreateStore = create<CreateState>()(
swapConsent: false,
swapFrame: null as SwapFrame | null,
swapBuilt: null as SwapBuilt | null,
+ hubStep: 'who' as HubStep,
+ hubCharacter: null as HubCharacter | null,
+ hubLastIntent: null as CreateIntent | null,
sound: 'original' as 'original' | 'none' | 'lipsync',
lipsyncModel: 'latentsync',
lipsyncCredits: null as number | null,
@@ -1536,6 +1554,10 @@ export const useCreateStore = create<CreateState>()(
// The list of further source images stays only where it can run.
if (get().batchSources.length && (!get().source || !BATCH_INTENTS.has(intent))) get().setBatchSources([])
if (!BATCH_INTENTS.has(intent) && get().batchOriginal) set({ batchOriginal: null })
+ // An intent of the Character area opens the panel of its action: a
+ // gallery Reuse, the chat, a preset or the phone land there directly.
+ // The area's own steps 1 and 2 are set by openCharacterHub.
+ if (isHubIntent(intent)) set({ hubStep: 'panel', hubLastIntent: intent })
},
toggleNegative: () => set((s) => ({ showNegative: !s.showNegative })),
setExpertOpen: (expertOpen) => set({ expertOpen }),
@@ -1667,6 +1689,17 @@ export const useCreateStore = create<CreateState>()(
setSwapConsent: (swapConsent) => set({ swapConsent }),
setSwapFrame: (swapFrame) => set({ swapFrame }),
setSwapBuilt: (swapBuilt) => set({ swapBuilt }),
+ setHubStep: (hubStep) => set({ hubStep }),
+ setHubCharacter: (hubCharacter) => set({ hubCharacter }),
+ openCharacterHub: () => {
+ const s = get()
+ if (isHubIntent(s.intent())) return
+ // The intent stays one of the area's own, so the gallery, the meter
+ // and the opSlot see a known tab while step 1 or 2 shows.
+ const last = s.hubLastIntent
+ s.setIntent(last ?? 'character')
+ set({ hubStep: last ? 'panel' : 'who' })
+ },
setSound: (sound) => set({ sound }),
setLipsyncModel: (lipsyncModel) => set({ lipsyncModel }),
setLipsyncCredits: (lipsyncCredits) => set({ lipsyncCredits }),