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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(create): Ton-Auswahl in Swap und Motion (Port des Web-Stands 2176d1be)
purplefac02380b89c
diff --git a/e2e/swap-character.spec.ts b/e2e/swap-character.spec.tsindex ca6bf0dc..27e2267a 100644--- a/e2e/swap-character.spec.ts+++ b/e2e/swap-character.spec.ts@@ -31,6 +31,12 @@ const SWAP_CATALOG = [['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 }])+ // The lip sync step of "New voice, lips in sync" (14.11.2026), priced by the+ // length of the voice as the server lists it.+ .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])async function media(name: string, mimeType: string, page?: Page) {const dir = process.env.LU_SWAP_MEDIA_DIR@@ -129,7 +135,7 @@ async function openSwap(page: Page): Promise<Seen> {return seen}-async function shoot(page: Page, name: string, focus?: string) {+async function shoot(page: Page, name: string, focus?: string, prefix = 'desktop-app') {const dir = process.env.LU_SWAP_SHOTS_DIRif (!dir) return// The part the shot is about, scrolled into the panel's view.@@ -140,7 +146,7 @@ async function shoot(page: Page, name: string, focus?: string) {document.documentElement.classList.toggle('light', t === 'light')}, theme)await page.waitForTimeout(250)- await page.screenshot({ path: `${dir}/desktop-app-${name}-${theme}.png` })+ await page.screenshot({ path: `${dir}/${prefix}-${name}-${theme}.png` })}await page.evaluate(() => {document.documentElement.classList.add('dark')@@ -276,3 +282,77 @@ test('Swap Character with OpenJutsu: one step, people up to four, consent beforeawait expect(page.getByRole('button', { name: /Add person/ })).toBeDisabled()await expect(create).toBeDisabled()})++/** A voice of `seconds` seconds as a WAV (a quiet tone), made here so the+ * WebView can measure it; no file on disk. */+function voiceWav(seconds: number) {+ const rate = 8000+ const n = rate * seconds+ const buf = Buffer.alloc(44 + n * 2)+ buf.write('RIFF', 0); buf.writeUInt32LE(36 + n * 2, 4); buf.write('WAVE', 8)+ buf.write('fmt ', 12); buf.writeUInt32LE(16, 16); buf.writeUInt16LE(1, 20); buf.writeUInt16LE(1, 22)+ buf.writeUInt32LE(rate, 24); buf.writeUInt32LE(rate * 2, 28); buf.writeUInt16LE(2, 32); buf.writeUInt16LE(16, 34)+ buf.write('data', 36); buf.writeUInt32LE(n * 2, 40)+ for (let i = 0; i < n; i++) buf.writeInt16LE(Math.round(Math.sin((i / rate) * 2 * Math.PI * 220) * 3000), 44 + i * 2)+ return { name: 'voice.wav', mimeType: 'audio/wav', buffer: buf }+}++test('Sound in Swap: original by default, lip sync greyed out for two people, a new voice priced with the video', async ({ page }) => {+ const seen = await openSwap(page)+ const panel = page.locator('[data-swap-controls]')+ const sound = page.getByRole('radiogroup', { name: 'Sound' })+ const lipsync = page.getByRole('radio', { name: 'New voice, lips in sync' })+ await expect(sound).toBeVisible()+ await expect(page.getByRole('radio', { name: 'Original sound' })).toHaveAttribute('aria-checked', 'true')++ await panel.locator('input[type=file][accept^="video"]').setInputFiles(await media('clip.mp4', 'video/mp4', page))+ await expect(page.getByText('Tap each person you want to replace')).toBeVisible({ timeout: 20_000 })+ await tapFrame(page, 0.45, 0.35)+ await page.locator('[data-swap-photo-input="1"]').setInputFiles(await media('face1.png', 'image/png'))+ await shoot(page, 'swap-original', '[data-sound-controls]', 'desktop-ton')++ // A new voice: the voice chip, the price of both steps on slider and button.+ await lipsync.click()+ 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('lip sync')+ 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 page.getByRole('button', { name: /Continue/ }).click()+ const create = page.getByRole('button', { name: /^Create/ }).last()+ await expect(create).toBeEnabled({ timeout: 15_000 })+ await expect(create).toContainText('Create ·')+ await shoot(page, 'swap-lipsync-voice-price', '[data-sound-controls]', 'desktop-ton')++ // A second person: lip sync goes grey, back to the original sound.+ 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.getByRole('radio', { name: 'Original sound' })).toHaveAttribute('aria-checked', 'true')+ await shoot(page, 'swap-lipsync-blocked-two-people', '[data-sound-controls]', 'desktop-ton')++ // Create was never pressed: only the frame step went to the queue.+ expect(seen.submits.every((b) => b.params.swap_step === 'frame')).toBe(true)+})++test('Sound in Motion: on the cloud lanes only', async ({ page }) => {+ await openSwap(page)+ await page.getByRole('radio', { name: 'Motion Control', exact: true }).click()+ 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')+ await page.getByRole('radio', { name: 'New voice, lips in sync' }).click()+ await page.locator('[data-sound-lipsync] input[type=file][accept="audio/*"]').setInputFiles(voiceWav(4))+ await expect(page.locator('[data-sound-price]')).toContainText('credits')+ await shoot(page, 'motion-cloud', '[data-sound-controls]', 'desktop-ton')++ // The local lanes: no sound choice (no lip sync step, no worker there).+ await cloudSwitch(page).click()+ await expect(cloudSwitch(page)).not.toBeChecked({ timeout: 15_000 })+ await expect(page.locator('[data-sound-controls]')).toHaveCount(0)+ await shoot(page, 'motion-local', undefined, 'desktop-ton')+})diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.tsindex b687bd36..7d391f5b 100644--- a/src/api/cloud/jobs.ts+++ b/src/api/cloud/jobs.ts@@ -74,8 +74,16 @@ export interface CloudJobParams {swap_consent?: boolean/** Swap Character on SCAIL 2 or Kling (14.11.2026): 'frame' builds the first* frame with the new people (Nano Banana Pro), 'video' runs the clip on it.- * Either step needs swap_consent on the server. */- swap_step?: 'frame' | 'video'+ * Either step needs swap_consent on the server. 'lipsync' is the step+ * after the video when the customer picked a new voice (lib/render/sound.ts). */+ swap_step?: 'frame' | 'video' | 'lipsync'+ /** Swap and Motion (14.11.2026): the sound of the result. On original the+ * worker lays the clip's sound under a result without one; none removes+ * it. */+ sound?: 'original' | 'none'+ /** The lip sync step after Swap or Motion: the server cuts a longer voice+ * to the length of the clip. */+ fit_audio?: true}export interface CloudJobSubmit {diff --git a/src/components/create/experimental/ClipLength.tsx b/src/components/create/experimental/ClipLength.tsxindex 03516ba3..e24f1cce 100644--- a/src/components/create/experimental/ClipLength.tsx+++ b/src/components/create/experimental/ClipLength.tsx@@ -12,7 +12,7 @@ import {// same seconds the Create button and the server count (swapPricedSeconds).export function ClipLength({- model, options, videoSeconds, chosen, onChange, photos = 0, span, disabled = false, frameCredits = null,+ model, options, videoSeconds, chosen, onChange, photos = 0, span, disabled = false, frameCredits = null, lipsyncCredits = null,}: {model: stringoptions: Record<string, unknown>@@ -31,6 +31,9 @@ export function ClipLength({* total here reads "frame + video", the Create button names the video* only. */frameCredits?: number | null+ /** New voice, lips in sync (14.11.2026): the second step costs extra and+ * joins the total ("frame + video + lip sync"). */+ lipsyncCredits?: number | null}) {const own = swapClipLimits(model)const frameModel = SWAP_FRAME_MODELS.includes(model)@@ -46,7 +49,8 @@ export function ClipLength({const video = videoSeconds ? (frameModel ? swapWholeSeconds(model, null, videoSeconds) : Math.floor(videoSeconds)) : undefinedconst perSecond = swapCreditsPerSecond(model, options)const videoCredits = swapClipCredits(model, options, videoSeconds ? swapPricedSeconds(model, chosen, videoSeconds) : Math.min(value, own.max), photos)- const total = videoCredits == null ? null : videoCredits + (frameCredits ?? 0)+ const total = videoCredits == null ? null : videoCredits + (frameCredits ?? 0) + (lipsyncCredits ?? 0)+ const parts = [frameCredits != null && 'frame', 'video', lipsyncCredits != null && 'lip sync'].filter(Boolean).join(' + ')const name = modelLabel(model)const at = (v: number) => (max > min ? Math.min(100, Math.max(0, ((v - min) / (max - min)) * 100)) : 0)const pos = at(value)@@ -63,8 +67,8 @@ export function ClipLength({{total != null && perSecond != null && (<span className="text-right" data-clip-price><span className="t-mono text-gray-200">{total.toLocaleString('en-US')}</span>- {frameCredits != null- ? <span className="t-control text-gray-500"> credits · frame + video</span>+ {frameCredits != null || lipsyncCredits != null+ ? <span className="t-control text-gray-500"> credits · {parts}</span>: <span className="t-control text-gray-500"> credits · {perSecond.toLocaleString('en-US')}/s</span>}</span>)}@@ -112,9 +116,10 @@ export function ClipLength({Your video is {video} s. {name} needs at least {own.min} s.</p>)}- {frameCredits != null && videoCredits != null && perSecond != null && (+ {(frameCredits != null || lipsyncCredits != null) && videoCredits != null && perSecond != null && (<p className="mt-0.5 text-right t-control text-gray-500 tabular-nums" data-clip-split>- First frame {frameCredits.toLocaleString('en-US')} · video {videoCredits.toLocaleString('en-US')} ({perSecond.toLocaleString('en-US')}/s)+ {frameCredits != null && `First frame ${frameCredits.toLocaleString('en-US')} · `}video {videoCredits.toLocaleString('en-US')} ({perSecond.toLocaleString('en-US')}/s)+ {lipsyncCredits != null && ` · lip sync ${lipsyncCredits.toLocaleString('en-US')}`}</p>)}{value < own.billedMin && (diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsxindex 019d9f2d..4670163b 100644--- a/src/components/create/experimental/Composer.tsx+++ b/src/components/create/experimental/Composer.tsx@@ -19,6 +19,7 @@ import { STUDIO_MODELS } from '../../../lib/render/studio-contract'import { swapBilledPhotos, swapPricedSeconds, swapShortCredits } from '../../../lib/render/swap'import { swapReady } from '../../../lib/create/swap-run'import { swapConfirmedFrame } from '../../../lib/create/swap-frame'+import { soundApplies, soundInputError } from '../../../lib/render/sound'import { effectiveVideoDurations, snapToVideoDuration } from '../../../lib/render/video-duration'import { mediaSeconds, useStudioPrice } from './useStudioPrice'import { getJob } from '../../../api/cloud/jobs'@@ -270,6 +271,14 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {// Dieselbe Zahl wie im Zaehler: nach einem 409 steht im Speicher der Preis// des Servers, und die Deckungspruefung muss ihn benutzen.const cloudStudioCredits = useCreateStore((s) => s.cloudStudioCredits)+ // 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 lipsyncOn = soundOn === 'lipsync'+ const lipsyncExtra = useCreateStore((s) => (lipsyncOn ? s.lipsyncCredits ?? 0 : 0))+ const lipsyncModel = useCreateStore((s) => s.lipsyncModel)+ const soundProblem = soundInputError(soundOn, swap ? swapFigures.length : 1, backend, !!audioInput || !!voiceFromJob, lipsyncModel)const costFallback = quota?.costs[runKind === 'audio' ? 'image' : runKind] ?? 0// The exact rule the meter chip renders, so the button can never invite a run// the chip is already refusing. Credits alone were not enough: a user out of@@ -287,7 +296,7 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {? (studioPrice?.credits ?? costFallback): lengthRate? (cloudStudioCredits ?? lengthShown ?? costFallback)- : runCredits(intentKind, intentOp, runModel, runSeconds, costFallback, targetResolution)),+ : runCredits(intentKind, intentOp, runModel, runSeconds, costFallback, targetResolution)) + lipsyncExtra,runKind,intentOp,).kind === 'ok')@@ -386,6 +395,7 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {(!meta.needsSource || hasStart) &&(!needsMask || !!mask) &&specialReady &&+ !soundProblem &&upscaleReady &&creditsOk &&!installing@@ -622,7 +632,12 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {<Button variant="primary" size="lg" icon={Sparkles} disabled={!canGenerate} onClick={guardedGenerate}>{/* Swap Character names its price on the button (the web'sCreateButton): a paid video run, priced by its length. */}- {swap && backend === 'cloud' && priceSeconds !== undefined && studioPrice ? `Create · ${swapShortCredits(studioPrice.credits)}` : 'Create'}+ {/* 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'}</Button></span>)}diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsxindex f52c026f..5e8783f5 100644--- a/src/components/create/experimental/SpecialIntentControls.tsx+++ b/src/components/create/experimental/SpecialIntentControls.tsx@@ -39,9 +39,14 @@ import { STUDIO_MODELS, studioFields } from '../../../lib/render/studio-contractimport { 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, swapUsesFrame,+ swapDefaultOptions, swapFigureRoles, swapMaxPeople, swapNeedsConsent, swapReadsRoles, 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,+ lipsyncSeconds, soundApplies, soundClipSeconds, type SoundChoice,+} from '../../../lib/render/sound'+import { getJob } from '../../../api/cloud/jobs'import { SwapFrameBuild, SwapFramePicker, useSwapFirstFrame } from './SwapFrameSteps'import { mediaSeconds } from './useStudioPrice'import { ClipLength } from './ClipLength'@@ -1731,10 +1736,136 @@ function CloudExtendControls() {// ── Motion control ──────────────────────────────────────────────────────────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)+ const [measured, setMeasured] = useState<{ url: string; seconds: number | undefined } | null>(null)+ useEffect(() => {+ let alive = true+ if (!cloud || !videoInput) return+ void mediaSeconds(videoInput.url, 'video').then((v) => { if (alive) setMeasured({ url: videoInput.url, seconds: v }) })+ return () => { alive = false }+ }, [cloud, videoInput])+ const videoSeconds = measured && videoInput && measured.url === videoInput.url ? measured.seconds : undefinedreturn (- <div className="flex items-center justify-center gap-2 flex-wrap">- <PortraitChip empty="Add character image" />- <DrivingVideoChip empty="Add driving video (dance/pose)" />+ <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>+ {cloud && <SoundControls intent="motion" people={1} clipSeconds={videoSeconds} withPrice />}+ </div>+ )+}++// ── 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). ──++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. */+ withPrice?: boolean+}) {+ const backend = useCreateStore((s) => s.backend)+ const sound = useCreateStore((s) => s.sound)+ const setSound = useCreateStore((s) => s.setSound)+ const lipModel = useCreateStore((s) => s.lipsyncModel)+ const setLipModel = useCreateStore((s) => s.setLipsyncModel)+ const setLipCredits = useCreateStore((s) => s.setLipsyncCredits)+ const audioInput = useCreateStore((s) => s.audioInput)+ const setAudioInput = useCreateStore((s) => s.setAudioInput)+ const voiceFromJob = useCreateStore((s) => s.voiceFromJob)+ const setVoiceFromJob = useCreateStore((s) => s.setVoiceFromJob)+ // The catalogue decides whether the lip sync models are there.+ useCloudCatalogStore((s) => s.fetchedAt)+ const blocked = lipsyncBlocked(people, backend, lipModel)+ // A second person: lip sync no longer works, back to the original sound.+ useEffect(() => { if (blocked && sound === 'lipsync') setSound('original') }, [blocked, sound, setSound])+ // The length of the voice: an upload is measured here, an earlier voice+ // through its job's address (as the Composer's meter does).+ const [voice, setVoice] = useState<{ key: string; seconds: number | undefined } | null>(null)+ const voiceKey = audioInput?.url ?? (voiceFromJob ? `job:${voiceFromJob.jobId}` : undefined)+ useEffect(() => {+ let alive = true+ if (!voiceKey) return+ const url = audioInput?.url+ ? Promise.resolve(audioInput.url)+ : getJob(voiceFromJob!.jobId).then((j) => j.result_url ?? undefined)+ void url+ .then((u) => (u ? mediaSeconds(u, 'audio') : undefined))+ .catch(() => undefined)+ .then((v) => { if (alive) setVoice({ key: voiceKey, seconds: v }) })+ return () => { alive = false }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [voiceKey])+ const audioSeconds = voice && voice.key === voiceKey ? voice.seconds : undefined+ const active = sound === 'lipsync' && !blocked+ const credits = active && (voiceKey ? voice?.key === voiceKey : true) ? lipsyncCredits(lipModel, audioSeconds, clipSeconds) : null+ useEffect(() => { setLipCredits(credits) }, [credits, setLipCredits])+ useEffect(() => () => setLipCredits(null), [setLipCredits])+ 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>+ <Segmented+ size="sm"+ layoutId={`sound-${intent}`}+ ariaLabel="Sound"+ className="max-w-full flex-wrap"+ value={sound}+ onChange={(v) => setSound(v as SoundChoice)}+ options={SOUND_CHOICES.map((c) => ({+ value: c, label: SOUND_LABEL[c],+ ...(c === 'lipsync' && blocked ? { disabled: true, title: blocked } : {}),+ }))}+ />+ </div>+ {blocked && (+ <p className="t-control text-gray-500" data-sound-note="lipsync-blocked">{blocked}</p>+ )}+ {active && (+ <div className="space-y-1.5" data-sound-lipsync>+ <div className="flex flex-wrap items-center gap-2">+ <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) }}+ />+ {credits != null && (+ <span className="t-control text-gray-500 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>+ {cut && (+ <p className={cn('t-control', HINWEIS_TEXT.ruhig)} 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>+ <div className="mt-1.5">+ <Segmented+ size="sm"+ layoutId={`lipsync-model-${intent}`}+ ariaLabel="Lip sync model"+ value={LIPSYNC_STEP_MODELS.includes(lipModel) ? lipModel : LIPSYNC_STEP_DEFAULT}+ onChange={(v) => setLipModel(v)}+ options={LIPSYNC_STEP_MODELS.map((m) => ({ value: m, label: m === 'latentsync' ? 'LatentSync (recommended)' : 'Lipsync-2' }))}+ />+ </div>+ </details>+ </div>+ )}</div>)}@@ -1763,6 +1894,8 @@ export function SwapControls() {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 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)@@ -1916,7 +2049,10 @@ export function SwapControls() {photos={swapBilledPhotos(model, figures.length)}disabled={isGenerating}frameCredits={frameCredits}+ lipsyncCredits={lipsyncShown}/>+ <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 fordiff --git a/src/components/create/experimental/__tests__/swap-character-panel.test.tsx b/src/components/create/experimental/__tests__/swap-character-panel.test.tsxindex 5c085500..832e0b27 100644--- a/src/components/create/experimental/__tests__/swap-character-panel.test.tsx+++ b/src/components/create/experimental/__tests__/swap-character-panel.test.tsx@@ -332,3 +332,87 @@ describe('the Swap Stage', () => {expect(screen.getByText('3 new people')).toBeTruthy()})})++describe('Sound in the Swap and Motion panel (14.11.2026)', () => {+ const VOICE = { name: 'voice.mp3', url: 'blob:a', blob: new Blob(['a'], { type: 'audio/mpeg' }) }+ const sound = () => screen.getByRole('radiogroup', { name: 'Sound' })+ const option = (name: string) => screen.getByRole('radio', { name }) as HTMLButtonElement+ beforeEach(() => {+ // LatentSync as the server lists it: by the length of the voice, 3,000 per second, at least 3 s.+ useCloudCatalogStore.setState({+ models: neuerServer().map((m) => (m.id === 'latentsync'+ ? { ...m, credits: { base: 9000, length: { basis: 'audio' as const, block: 1, per_block: 3000, min: 3, max: 300, quote: 10 } } }+ : m)),+ })+ 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', () => {+ 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()+ fireEvent.click(option('No sound'))+ expect(useCreateStore.getState().sound).toBe('none')+ })++ it('with two people lip sync is greyed out, with the note', () => {+ useCreateStore.setState({ swapFigures: [{ image: null, role: '' }, { image: null, role: '' }] })+ 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')+ fireEvent.click(option('New voice, lips in sync'))+ expect(useCreateStore.getState().sound).toBe('original')+ })++ it('a server without the lip sync models: greyed out, not broken', () => {+ useCloudCatalogStore.setState({ models: neuerServer().filter((m) => m.id !== 'latentsync') })+ open()+ expect(option('New voice, lips in sync').disabled).toBe(true)+ expect(document.querySelector('[data-sound-note=lipsync-blocked]')?.textContent).toBe('Lip sync is not available on this LU Cloud')+ })++ it('lip sync: the voice chip, swap and lip sync together on the slider and on Create; a longer voice is cut', async () => {+ videoLength.seconds = 9+ const figures = [{ image: photo, role: '', mark: { x: 0.4, y: 0.4 } }]+ useCreateStore.setState({ videoInput: clip, swapFrame: FRAME, swapFigures: figures, swapSeconds: 6, swapConsent: true } as never)+ const { rerender } = open()+ fireEvent.click(option('New voice, lips in sync'))+ expect(document.querySelector('[data-sound-lipsync]')).toBeTruthy()+ expect(screen.getByText(/a second step puts the new voice in/)).toBeTruthy()+ expect(screen.getByRole('button', { name: /Add voice/ })).toBeTruthy()+ useCreateStore.setState({ audioInput: VOICE })+ await act(async () => {})+ rerender(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)+ 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')+ // 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 } })+ await act(async () => {})+ await waitFor(() => expect(create().disabled).toBe(false))+ expect(create().textContent).toMatch(/Create · 66k/)+ // Without a voice no start.+ useCreateStore.setState({ audioInput: null })+ await act(async () => {})+ expect(create().disabled).toBe(true)+ })++ it('Motion: the sound choice on the cloud only; the local lanes do not show it', () => {+ useCreateStore.getState().setIntent('motion')+ const { rerender } = open()+ expect(document.querySelector('[data-sound-controls=motion]')).toBeTruthy()+ useCreateStore.setState({ backend: 'local' })+ rerender(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)+ expect(document.querySelector('[data-sound-controls]')).toBeNull()+ })+})diff --git a/src/components/create/ui/Segmented.tsx b/src/components/create/ui/Segmented.tsxindex 2405188d..0b42e9ac 100644--- a/src/components/create/ui/Segmented.tsx+++ b/src/components/create/ui/Segmented.tsx@@ -8,6 +8,8 @@ export interface SegOption<T extends string> {label?: stringicon?: LucideIcontitle?: string+ /** Stands there but cannot be picked right now; `title` says why. */+ disabled?: boolean}interface Props<T extends string> {@@ -25,8 +27,9 @@ export function Segmented<T extends string>({ options, value, onChange, size = 'const iconSize = size === 'sm' ? 13 : 15const move = (dir: -1 | 1) => {- const i = options.findIndex((o) => o.value === value)- const next = options[i + dir]+ let i = options.findIndex((o) => o.value === value) + dir+ while (options[i]?.disabled) i += dir+ const next = options[i]if (next) onChange(next.value)}@@ -40,9 +43,11 @@ export function Segmented<T extends string>({ options, value, onChange, size = 'key={o.value}role="radio"aria-checked={selected}+ disabled={o.disabled}+ aria-disabled={o.disabled || undefined}aria-label={o.label || o.title}title={o.title || o.label}- onClick={() => onChange(o.value)}+ onClick={() => { if (!o.disabled) onChange(o.value) }}onKeyDown={(e) => {if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault(); move(-1) }if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { e.preventDefault(); move(1) }@@ -51,6 +56,7 @@ export function Segmented<T extends string>({ options, value, onChange, size = ''relative t-control inline-flex items-center justify-center gap-1.5 px-2.5 rounded-[6px] transition-colors',h,selected ? 'text-white' : 'text-gray-500 hover:text-gray-300',+ o.disabled && 'cursor-not-allowed opacity-45 hover:text-gray-500',)}>{selected && (diff --git a/src/hooks/__tests__/useCloudCreate-ton.test.ts b/src/hooks/__tests__/useCloudCreate-ton.test.tsnew file mode 100644index 00000000..3bf9a849--- /dev/null+++ b/src/hooks/__tests__/useCloudCreate-ton.test.ts@@ -0,0 +1,227 @@+/**+ * Sound in Swap and Motion (14.11.2026, port of the web's useCloudCreate-ton):+ * what the video run sends, and the lip sync step after it. Nothing is+ * rendered or booked: upload, adopt, quote, submit and poll are mocked.+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'++vi.mock('react', async (orig) => {+ const actual = (await orig()) as Record<string, unknown>+ return { ...actual, useCallback: (fn: unknown) => fn }+})++const hoisted = vi.hoisted(() => {+ class FakeCloudJobError extends Error {+ status: number+ code?: string+ constructor(message: string, status: number, meta?: { code?: string }) {+ super(message)+ this.status = status+ this.code = meta?.code+ }+ }+ class FakeQuoteChangedError extends FakeCloudJobError {+ credits: number+ constructor(message: string, credits: number) {+ super(message, 409, { code: 'quote_changed' })+ this.credits = credits+ }+ }+ const submitted: Array<{ kind: string; model: string; prompt: string; params: Record<string, unknown> }> = []+ const steps: string[] = []+ const lipOutcome = { status: 'succeeded' as 'succeeded' | 'failed', error: null as string | null }+ return {+ FakeCloudJobError,+ FakeQuoteChangedError,+ submitted,+ steps,+ lipOutcome,+ uploadInput: vi.fn(async (_blob: unknown, slot: string) => {+ steps.push(`upload ${slot}`)+ return `user-1/staged-${slot}`+ }),+ getJob: vi.fn(async (id: string) => ({ id, result_url: `https://storage.example/${id}.mp3` })),+ submitCloudJob: vi.fn(async (payload: (typeof submitted)[number]) => {+ submitted.push(payload)+ return { id: `job-${submitted.length}` }+ }),+ pollJob: vi.fn(async (id: string) => {+ const lip = id === 'job-2'+ return {+ id, kind: 'video', model: lip ? 'latentsync' : 'scail-2',+ status: lip ? lipOutcome.status : 'succeeded',+ error: lip ? lipOutcome.error : null,+ result_url: lip && lipOutcome.status !== 'succeeded' ? null : `https://storage.example/${id}.mp4`,+ created_at: new Date().toISOString(),+ }+ }),+ cancelJob: vi.fn(async () => ({ status: 'canceled' })),+ adoptInput: vi.fn(async (jobId: string, role: string) => {+ steps.push(`adopt ${jobId} ${role}`)+ return `user-1/adopted-${jobId}-${role}`+ }),+ studioQuote: vi.fn(async () => ({ credits: 42 })),+ }+})+const { submitted, steps, lipOutcome } = hoisted++vi.mock('../useContentPolicy', () => ({+ contentPolicySnapshot: () => 'off' as const,+ loadContentPolicy: async () => 'off' as const,+}))+vi.mock('../../api/cloud/jobs', () => ({+ uploadInput: hoisted.uploadInput,+ getJob: hoisted.getJob,+ submitCloudJob: hoisted.submitCloudJob,+ pollJob: hoisted.pollJob,+ cancelJob: hoisted.cancelJob,+ adoptInput: hoisted.adoptInput,+ CloudJobError: hoisted.FakeCloudJobError,+ QuoteChangedError: hoisted.FakeQuoteChangedError,+}))+vi.mock('../../api/cloud/studio', () => ({+ studioQuote: hoisted.studioQuote,+ StudioQuoteChangedError: hoisted.FakeQuoteChangedError,+}))+// Clip 6.006 s, voice 9 s (no <video>/<audio> in node).+vi.mock('../../components/create/experimental/useStudioPrice', async (orig) => ({+ ...((await orig()) as Record<string, unknown>),+ mediaSeconds: async (_url: string, kind: string) => (kind === 'audio' ? 9 : 6.006),+}))++import { useCloudCreate } from '../useCloudCreate'+import { swapKeyOf } from '../../lib/create/swap-frame'+import { useCreateStore } from '../../stores/createStore'+import { useCloudCatalogStore } from '../../stores/cloudCatalogStore'+import { neuerServer } from '../../lib/render/__tests__/fixtures/test-catalogs'+import { LIPSYNC_ONE_PERSON } from '../../lib/render/sound'++const FOTO = { filename: 'face.png', url: 'data:image/png;base64,AA', width: 512, height: 768 }+const CLIP = { name: 'dance.mp4', url: 'blob:dance', blob: new Blob(['x'], { type: 'video/mp4' }) }+const VOICE = { name: 'voice.mp3', url: 'blob:voice', blob: new Blob(['a'], { type: 'audio/mpeg' }) }++function katalog() {+ return neuerServer().map((m) => (m.id === 'latentsync'+ ? { ...m, credits: { base: 9000, length: { basis: 'audio' as const, block: 1, per_block: 3000, min: 3, max: 300, quote: 10 } } }+ : m))+}++function swapReady(figures: Array<{ image: typeof FOTO; role: string; mark?: { x: number; y: number } }>) {+ useCreateStore.setState({+ videoInput: CLIP, swapConsent: true, swapFigures: figures,+ swapBuilt: { jobId: 'frame-1', url: 'https://x/f.jpg', key: swapKeyOf(CLIP.url, figures), confirmed: true },+ })+}++beforeEach(() => {+ submitted.length = 0+ steps.length = 0+ lipOutcome.status = 'succeeded'+ lipOutcome.error = null+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, blob: async () => new Blob(['x']) })))+ useCreateStore.setState({+ isGenerating: false, error: null, backend: 'cloud',+ source: null, audioInput: null, videoInput: null, voiceFromJob: null,+ extendSource: null, gallery: [], cloudStudioOptions: {}, cloudStudioCredits: null, cloudOpModel: '',+ sound: 'original', lipsyncModel: 'latentsync', lipsyncCredits: null,+ })+ useCloudCatalogStore.setState({ models: katalog() })+ useCreateStore.getState().setIntent('swap_character')+ useCreateStore.setState({ swapFigures: [{ image: null, role: '' }], swapSeconds: null, swapConsent: false, swapBuilt: null, swapFrame: null })+})++describe('Sound of the video run', () => {+ it('Swap sends the original sound by default', async () => {+ swapReady([{ image: FOTO, role: '' }])+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBeNull()+ expect(submitted).toHaveLength(1)+ expect(submitted[0].params.sound).toBe('original')+ })++ it('No sound: sound none, and Kling gets keep_original_sound false', async () => {+ useCreateStore.getState().setCloudOpModel('kling-v3-pro-motion-control')+ useCreateStore.setState({ sound: 'none' })+ swapReady([{ image: FOTO, role: '' }])+ await useCloudCreate().generate()+ const p = submitted[0].params+ expect(p.sound).toBe('none')+ expect(p.studio_options).toEqual({ character_orientation: 'video', keep_original_sound: false })+ // The quote sees the same options.+ expect((hoisted.studioQuote.mock.calls.at(-1) as unknown[])[2]).toMatchObject({ studio_options: p.studio_options })+ })++ it('Motion on the cloud sends the sound, the local lane never reaches here', async () => {+ useCreateStore.getState().setIntent('motion')+ useCreateStore.setState({ source: FOTO as never, videoInput: CLIP })+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBeNull()+ 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 })+ swapReady([{ image: FOTO, role: '', mark: { x: 0.2, y: 0.5 } }, { image: FOTO, role: '', mark: { x: 0.8, y: 0.5 } }])+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBe(`${LIPSYNC_ONE_PERSON}. Pick Original sound or remove the other people.`)+ expect(steps).toEqual([])+ expect(submitted).toHaveLength(0)+ })++ it('stops before any upload without a voice', async () => {+ useCreateStore.setState({ sound: 'lipsync' })+ swapReady([{ image: FOTO, role: '' }])+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBe('Add the new voice: upload audio, make one, or pick an earlier voice.')+ expect(submitted).toHaveLength(0)+ })++ it('Swap: after the video, LatentSync on the own result with the uploaded voice, swap step lipsync with the tick', async () => {+ useCreateStore.setState({ sound: 'lipsync', audioInput: VOICE, lipsyncCredits: 18000 })+ swapReady([{ image: FOTO, role: '' }])+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBeNull()+ expect(submitted).toHaveLength(2)+ // The video run keeps the original sound until the second step.+ expect(submitted[0].params.sound).toBe('original')+ expect(submitted[0].params.audio_path).toBeUndefined()+ const lip = submitted[1]+ expect(lip.model).toBe('latentsync')+ expect(lip.params).toMatchObject({+ op: 'lipsync', video_path: 'user-1/adopted-job-1-video', audio_path: 'user-1/staged-audio',+ fit_audio: true, swap_step: 'lipsync', swap_consent: true, max_credits: 18000, label: 'Lip sync',+ })+ expect(steps).toEqual(['upload video', 'adopt frame-1 image', 'adopt job-1 video', 'upload audio'])+ // Both land in the gallery: the swap and the version with the new voice.+ const g = useCreateStore.getState().gallery+ expect(g.map((x) => x.model).sort()).toEqual(['latentsync', 'scail-2'])+ })++ it('Motion with an earlier voice: adopted, no swap step', async () => {+ useCreateStore.getState().setIntent('motion')+ useCreateStore.setState({ source: FOTO as never, videoInput: CLIP, sound: 'lipsync', voiceFromJob: { jobId: 'tts-9', label: 'Hello' } })+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBeNull()+ expect(submitted).toHaveLength(2)+ const lip = submitted[1].params+ expect(lip.audio_path).toBe('user-1/adopted-tts-9-audio')+ expect(lip.swap_step).toBeUndefined()+ expect(lip.swap_consent).toBeUndefined()+ // 9 s voice on a 6.006 s clip: the voice is cut to the clip, LatentSync+ // bills every started second, 7 s at 3,000.+ expect(lip.max_credits).toBe(21000)+ })++ it('a failed lip sync keeps the swap in the gallery and says so', async () => {+ lipOutcome.status = 'failed'+ lipOutcome.error = 'no face found'+ useCreateStore.setState({ sound: 'lipsync', audioInput: VOICE })+ swapReady([{ image: FOTO, role: '' }])+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBe('Your video is in the gallery, but the lip sync failed: no face found. The lip sync was not charged.')+ expect(useCreateStore.getState().gallery.map((x) => x.model)).toEqual(['scail-2'])+ expect(useCreateStore.getState().isGenerating).toBe(false)+ })+})diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.tsindex 62f51480..7b35f3e7 100644--- a/src/hooks/useCloudCreate.ts+++ b/src/hooks/useCloudCreate.ts@@ -44,6 +44,8 @@ import { modelLabel } from '../lib/render/preset-models'import { isSwapIntent, swapUsesFrame, SWAP_GALLERY_LABEL } from '../lib/render/swap'import { adoptSwapFrame, swapInputError, swapRunParams } from '../lib/create/swap-run'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 { mediaSeconds } from '../components/create/experimental/useStudioPrice'import { IMPROVING_PROMPT } from '../lib/render/improve-prompt'import { improveKindForRun } from '../lib/render/music-ui'@@ -270,6 +272,62 @@ export function takeCloudRunStop(): CloudRunStop | null {return stop}+/** Step 2 of a Swap or Motion run with a new voice (14.11.2026, the web's+ * useCloudCreate): LatentSync or Lipsync-2 on the own video result. The+ * price is the catalogue's rule on the measured voice and clip; a failure+ * keeps the video and says so (lipsyncFailedText). */+async function runLipsyncAfter(job: CloudJob, run: {+ intent: string; model: string; swap: boolean; label: string | undefined+ resultFields: Partial<GalleryItem> & { prompt: string }+ audioInput: { url: string; blob: Blob } | null; voiceFromJob: { jobId: string } | null+ videoUrl: string | undefined; swapSeconds: number | null; lipModel: string; shown: number | null+ signal: AbortSignal; timeoutMs: number+}): Promise<void> {+ const st = useCreateStore.getState()+ st.setProgressPhase('sampling')+ st.setProgress(92, 'Step 2 of 2: lip sync…')+ try {+ const voiceUrl = run.audioInput?.url ?? (run.voiceFromJob ? (await getJob(run.voiceFromJob.jobId).catch(() => null))?.result_url ?? undefined : undefined)+ const audioSeconds = voiceUrl ? await mediaSeconds(voiceUrl, 'audio').catch(() => undefined) : undefined+ const videoSeconds = run.videoUrl ? await mediaSeconds(run.videoUrl, 'video').catch(() => undefined) : undefined+ const clip = soundClipSeconds(run.intent, run.model, run.swapSeconds, videoSeconds)+ // The ceiling: what the panel showed, or the same rule on what was+ // measured now; never above the shown figure.+ const measured = lipsyncCredits(run.lipModel, audioSeconds, clip)+ const credits = run.shown != null && measured != null ? Math.min(run.shown, measured) : run.shown ?? measured+ const lip = await runLipsyncStep({+ videoJobId: job.id,+ audio: run.audioInput ? { type: 'blob', blob: run.audioInput.blob } : { type: 'job', jobId: run.voiceFromJob!.jobId },+ model: run.lipModel,+ credits,+ swap: run.swap,+ }, {+ submitCloudJob, pollJob, cancelJob, uploadInput, adoptInput,+ signal: run.signal, timeoutMs: run.timeoutMs,+ onSubmitted: (id) => { activeJobId = id; activeJobIds = [id] },+ onTick: (j) => { if (j.status === 'running') useCreateStore.getState().setProgress(95, 'Step 2 of 2: lip sync…') },+ })+ const end = useCreateStore.getState()+ if (lip.status === 'succeeded' && lip.result_url) {+ end.setProgressPhase('complete')+ end.setProgress(100, 'Complete!')+ end.addToGallery({+ ...galleryItemFromJob(lip),+ ...run.resultFields,+ model: lip.model || run.lipModel,+ label: run.label ? `${run.label}, lip sync` : 'Lip sync',+ })+ } else if (lip.status !== 'canceled') {+ end.setError(lipsyncFailedText(lip.error))+ }+ } catch (err) {+ if (!(err instanceof Error && err.message === 'polling aborted')) {+ const reason = err instanceof CloudJobError && err.status === 429 ? throttleMessage(err) : err instanceof Error ? err.message : String(err)+ useCreateStore.getState().setError(lipsyncFailedText(reason))+ }+ }+}+export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {const { onQuotaChange } = opts@@ -433,6 +491,17 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {s.setError('Motion control needs a character image and a driving video.')return}+ // 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 people = swap ? s.swapFigures.length : 1+ const invalid = soundInputError(sound, people, 'cloud', !!s.audioInput || !!s.voiceFromJob, s.lipsyncModel)+ if (invalid) {+ s.setError(invalid)+ return+ }+ }if (!specialOp && op !== 'generate' && !s.source) {s.setError('Add a source image first.')return@@ -635,6 +704,14 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {))if (ac.signal.aborted) return}+ // The sound of the result: Kling has a switch of its own, the rest the+ // server's worker does. Lip sync runs after the video (below); until+ // then the video keeps the original sound.+ if (sound) {+ params.sound = soundParam(sound)+ const own = studioModel ? soundStudioOptions(studioModel, sound) : {}+ if (Object.keys(own).length) params.studio_options = { ...(params.studio_options ?? studioOptionsFiltered ?? {}), ...own }+ }if (op === 'lipsync') {if (s.audioInput) {s.setProgress(8, 'Uploading audio…')@@ -975,6 +1052,16 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {st.clearTrainImages()st.setCharacterTab('use')st.bumpCharactersVersion()+ } else if (job.status === 'succeeded' && job.result_url && sound === 'lipsync' && (s.audioInput || s.voiceFromJob)) {+ // Step 2 of 2: the new voice with lips. The video is in the gallery+ // already and stays there if this step fails.+ addResult(job)+ await runLipsyncAfter(job, {+ intent, model: studioModel ?? model, swap, label, resultFields: resultFields(0),+ audioInput: s.audioInput, voiceFromJob: s.voiceFromJob, videoUrl: s.videoInput?.url,+ swapSeconds: s.swapSeconds, lipModel: s.lipsyncModel, shown: s.lipsyncCredits, signal: ac.signal, timeoutMs,+ })+ onQuotaChange?.()} else if (job.status === 'succeeded' && job.result_url) {st.setProgressPhase('complete')st.setProgress(100, 'Complete!')diff --git a/src/lib/create/__tests__/lipsync-chain.test.ts b/src/lib/create/__tests__/lipsync-chain.test.tsnew file mode 100644index 00000000..27800c2b--- /dev/null+++ b/src/lib/create/__tests__/lipsync-chain.test.ts@@ -0,0 +1,62 @@+// The second step of "New voice, lips in sync" (14.11.2026): the own video by+// adopt, the voice by upload or adopt, one job, Cancel and expiry.+import { describe, it, expect, vi } from 'vitest'+import { lipsyncFailedText, runLipsyncStep, type LipsyncStepDeps } from '../lipsync-chain'++function deps(over: Partial<LipsyncStepDeps> = {}) {+ const calls: string[] = []+ const d: LipsyncStepDeps = {+ uploadInput: vi.fn(async (_b: Blob, role) => { calls.push(`upload ${role}`); return `up-${role}` }),+ adoptInput: vi.fn(async (jobId: string, role) => { calls.push(`adopt ${jobId} ${role}`); return `ad-${jobId}` }),+ submitCloudJob: vi.fn(async () => { calls.push('submit'); return { id: 'lip-1' } }),+ pollJob: vi.fn(async (id: string) => ({ id, status: 'succeeded', result_url: 'https://x/lip.mp4' }) as never),+ cancelJob: vi.fn(async () => ({})),+ ...over,+ }+ return { d, calls }+}++describe('runLipsyncStep', () => {+ it('adopts the video, uploads the voice, starts one lip sync job and waits for it', async () => {+ const { d, calls } = deps()+ const seen: string[] = []+ const job = await runLipsyncStep(+ { videoJobId: 'swap-1', audio: { type: 'blob', blob: new Blob(['a']) }, model: 'latentsync', credits: 9000, swap: true },+ { ...d, onSubmitted: (id) => seen.push(id) },+ )+ expect(job.status).toBe('succeeded')+ expect(calls).toEqual(['adopt swap-1 video', 'upload audio', 'submit'])+ expect(seen).toEqual(['lip-1'])+ const body = (d.submitCloudJob as ReturnType<typeof vi.fn>).mock.calls[0][0]+ expect(body.params).toMatchObject({ op: 'lipsync', video_path: 'ad-swap-1', audio_path: 'up-audio', swap_step: 'lipsync', fit_audio: true, max_credits: 9000 })+ })++ it('an earlier voice is adopted as audio', async () => {+ const { d, calls } = deps()+ await runLipsyncStep({ videoJobId: 'm-1', audio: { type: 'job', jobId: 'tts-1' }, model: 'latentsync', credits: null, swap: false }, d)+ expect(calls).toEqual(['adopt m-1 video', 'adopt tts-1 audio', 'submit'])+ })++ it('an expired video reads as a sentence, nothing is started', async () => {+ const { d } = deps({ adoptInput: vi.fn(async () => { throw Object.assign(new Error('gone'), { status: 404 }) }) })+ await expect(runLipsyncStep({ videoJobId: 'x', audio: { type: 'job', jobId: 't' }, model: 'latentsync', credits: 1, swap: false }, d))+ .rejects.toThrow('That video has expired, so the lip sync could not start.')+ expect(d.submitCloudJob).not.toHaveBeenCalled()+ })++ it('a Cancel during the submit cancels the job just taken', async () => {+ const ac = new AbortController()+ const { d } = deps({ submitCloudJob: vi.fn(async () => { ac.abort(); return { id: 'lip-2' } }) })+ await expect(runLipsyncStep({ videoJobId: 'x', audio: { type: 'blob', blob: new Blob(['a']) }, model: 'latentsync', credits: 1, swap: false }, { ...d, signal: ac.signal }))+ .rejects.toThrow('polling aborted')+ expect(d.cancelJob).toHaveBeenCalledWith('lip-2')+ expect(d.pollJob).not.toHaveBeenCalled()+ })+})++describe('lipsyncFailedText', () => {+ it('says the video is there and the step was not charged', () => {+ expect(lipsyncFailedText('no face')).toBe('Your video is in the gallery, but the lip sync failed: no face. The lip sync was not charged.')+ expect(lipsyncFailedText(null)).toBe('Your video is in the gallery, but the lip sync failed. The lip sync was not charged.')+ })+})diff --git a/src/lib/create/lipsync-chain.ts b/src/lib/create/lipsync-chain.tsnew file mode 100644index 00000000..e1bde93d--- /dev/null+++ b/src/lib/create/lipsync-chain.ts@@ -0,0 +1,76 @@+// The second step of "New voice, lips in sync" (14.11.2026, port of the web's+// lib/create/lipsync-chain.ts): after a finished Swap or Motion video,+// LatentSync (or Lipsync-2) lays the new voice under it and moves the lips to+// it.+//+// The video is the own result of the first run (adopt, as the first frame of+// a swap), the sound the chosen voice: uploaded, or an own earlier run (adopt+// as well). A voice longer than the clip is cut by the server (fit_audio).+// No React, no store. The queue calls are handed in like swap-frame.ts does:+// not imported from engine.ts, which pulls the chat's catalogue mirror in.++import type { AdoptRole, CloudJob, CloudJobSubmit, UploadRole } from '../../api/cloud/jobs'+import { lipsyncSubmit } from '../render/sound'++export interface LipsyncStepRequest {+ /** The finished run whose video gets the lips. */+ videoJobId: string+ /** The voice: a file in the app or an own earlier run. */+ audio: { type: 'blob'; blob: Blob } | { type: 'job'; jobId: string }+ model: string+ /** The price the customer saw: the ceiling of the booking. */+ credits: number | null+ /** In Swap it is a swap step and carries the consent tick. */+ swap: boolean+}++export interface LipsyncStepDeps {+ submitCloudJob: (submit: CloudJobSubmit) => Promise<{ id: string }>+ pollJob: (id: string, opts: { signal?: AbortSignal; timeoutMs?: number; onTick?: (job: CloudJob) => void }) => Promise<CloudJob>+ cancelJob: (id: string) => Promise<unknown>+ uploadInput: (file: Blob, role: UploadRole) => Promise<string>+ adoptInput: (jobId: string, role: AdoptRole) => Promise<string>+ signal?: AbortSignal+ timeoutMs?: number+ /** The id of the step, as soon as the server took it (for Cancel). */+ onSubmitted?: (id: string) => void+ onTick?: (job: CloudJob) => void+}++const EXPIRED: Record<'video' | 'audio', string> = {+ video: 'That video has expired, so the lip sync could not start.',+ audio: 'That voice has expired. Pick it again or upload it.',+}++async function adoptOwn(deps: LipsyncStepDeps, jobId: string, role: 'video' | 'audio'): Promise<string> {+ try {+ return await deps.adoptInput(jobId, role)+ } catch (err) {+ const status = (err as { status?: unknown } | null)?.status+ if (status === 404 || status === 409) throw new Error(EXPIRED[role])+ throw err+ }+}++/** Stages video and voice, starts the lip sync step and waits for it. */+export async function runLipsyncStep(req: LipsyncStepRequest, deps: LipsyncStepDeps): Promise<CloudJob> {+ const videoPath = await adoptOwn(deps, req.videoJobId, 'video')+ const audioPath = req.audio.type === 'blob'+ ? await deps.uploadInput(req.audio.blob, 'audio')+ : await adoptOwn(deps, req.audio.jobId, 'audio')+ if (deps.signal?.aborted) throw new Error('polling aborted')+ const { id } = await deps.submitCloudJob(lipsyncSubmit(req.model, videoPath, audioPath, req.credits, req.swap))+ deps.onSubmitted?.(id)+ // A Cancel during the submit found no id yet: the job just taken is+ // canceled at once, so its credits go back (as runCloudJob in engine.ts).+ if (deps.signal?.aborted) {+ void deps.cancelJob(id).catch(() => {})+ throw new Error('polling aborted')+ }+ return deps.pollJob(id, { signal: deps.signal, timeoutMs: deps.timeoutMs ?? 30 * 60_000, onTick: deps.onTick })+}++/** The text when the second step fails: the video is already there. */+export function lipsyncFailedText(reason: string | null | undefined): string {+ return `Your video is in the gallery, but the lip sync failed${reason ? `: ${reason}` : ''}. The lip sync was not charged.`+}diff --git a/src/lib/render/__tests__/sound.test.ts b/src/lib/render/__tests__/sound.test.tsnew file mode 100644index 00000000..c65898d4--- /dev/null+++ b/src/lib/render/__tests__/sound.test.ts@@ -0,0 +1,93 @@+// The rules of the sound choice in Swap and Motion (14.11.2026, port of the+// web's lib/render/__tests__/sound.test.ts).+import { describe, it, expect, beforeEach } from 'vitest'+import { useCloudCatalogStore } from '../../../stores/cloudCatalogStore'+import { neuerServer } from './fixtures/test-catalogs'+import {+ LIPSYNC_CLOUD_ONLY, LIPSYNC_NOT_AVAILABLE, LIPSYNC_ONE_PERSON, SOUND_CHOICES, SOUND_LABEL,+ lipsyncBlocked, lipsyncCredits, lipsyncCut, lipsyncSeconds, lipsyncSubmit, soundApplies, soundClipSeconds,+ soundInputError, soundParam, soundStudioOptions,+} from '../sound'++beforeEach(() => {+ useCloudCatalogStore.setState({+ models: neuerServer().map((m) => (m.id === 'latentsync'+ ? { ...m, credits: { base: 9000, length: { basis: 'audio' as const, block: 1, per_block: 3000, min: 3, max: 300, quote: 10 } } }+ : m.id === 'lipsync-2'+ ? { ...m, credits: { base: 50000, length: { basis: 'video' as const, block: 1, per_block: 5000, min: 1, max: 300, quote: 10 } } }+ : m)),+ })+})++describe('sound choice', () => {+ it('three choices, the original sound first', () => {+ expect(SOUND_CHOICES.map((c) => SOUND_LABEL[c])).toEqual(['Original sound', 'No sound', 'New voice, lips in sync'])+ })++ 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)+ })++ it('lip sync: one person, cloud only, and only when the server lists the model', () => {+ expect(lipsyncBlocked(1, 'cloud')).toBeNull()+ expect(lipsyncBlocked(2, 'cloud')).toBe(LIPSYNC_ONE_PERSON)+ expect(lipsyncBlocked(1, 'local')).toBe(LIPSYNC_CLOUD_ONLY)+ useCloudCatalogStore.setState({ models: neuerServer().filter((m) => m.id !== 'latentsync') })+ expect(lipsyncBlocked(1, 'cloud')).toBe(LIPSYNC_NOT_AVAILABLE)+ })++ it('the video run keeps the original sound until the lip sync step; Kling has a switch', () => {+ expect(soundParam('original')).toBe('original')+ expect(soundParam('lipsync')).toBe('original')+ expect(soundParam('none')).toBe('none')+ expect(soundStudioOptions('kling-v3-pro-motion-control', 'none')).toEqual({ keep_original_sound: false })+ expect(soundStudioOptions('kling-v3-pro-motion-control', 'lipsync')).toEqual({ keep_original_sound: true })+ expect(soundStudioOptions('scail-2', 'none')).toEqual({})+ })++ it('a voice longer than the clip is cut to it', () => {+ expect(lipsyncSeconds(9, 6)).toBe(6)+ expect(lipsyncSeconds(4, 6)).toBe(4)+ expect(lipsyncSeconds(undefined, 6)).toBe(6)+ expect(lipsyncSeconds(4, undefined)).toBe(4)+ expect(lipsyncCut(9, 6)).toBe(true)+ expect(lipsyncCut(6.03, 6)).toBe(false)+ expect(lipsyncCut(undefined, 6)).toBe(false)+ })++ it('prices by the catalogue rule: LatentSync by the voice (at least 3 s), Lipsync-2 by the clip', () => {+ expect(lipsyncCredits('latentsync', 9, 6)).toBe(18000)+ expect(lipsyncCredits('latentsync', 1, 6)).toBe(9000)+ expect(lipsyncCredits('lipsync-2', 2, 6)).toBe(30000)+ useCloudCatalogStore.setState({ models: neuerServer().filter((m) => m.id !== 'latentsync') })+ expect(lipsyncCredits('latentsync', 9, 6)).toBeNull()+ })++ it('the sentences before a start', () => {+ expect(soundInputError('original', 3, 'cloud', false)).toBeNull()+ expect(soundInputError(undefined, 3, 'cloud', false)).toBeNull()+ expect(soundInputError('lipsync', 2, 'cloud', true)).toBe('Lip sync works with one person. Pick Original sound or remove the other people.')+ expect(soundInputError('lipsync', 1, 'cloud', false)).toBe('Add the new voice: upload audio, make one, or pick an earlier voice.')+ expect(soundInputError('lipsync', 1, 'cloud', true)).toBeNull()+ })++ it('the lip sync body: fit_audio, the ceiling, and in Swap the swap step with the tick', () => {+ expect(lipsyncSubmit('latentsync', 'v', 'a', 18000, true)).toEqual({+ kind: 'video', model: 'latentsync', prompt: '',+ params: { op: 'lipsync', video_path: 'v', audio_path: 'a', fit_audio: true, max_credits: 18000, label: 'Lip sync', swap_step: 'lipsync', swap_consent: true },+ })+ const motion = lipsyncSubmit('lipsync-2', 'v', 'a', null, false)+ expect(motion.params.swap_step).toBeUndefined()+ expect(motion.params.max_credits).toBeUndefined()+ })++ it('the clip of the lip sync step: the seconds that run in Swap, the whole video in Motion', () => {+ expect(soundClipSeconds('swap_character', 'scail-2', 4, 6.006)).toBe(4)+ expect(soundClipSeconds('motion', 'scail-2', 4, 6.006)).toBe(6.006)+ expect(soundClipSeconds('motion', 'scail-2', null, undefined)).toBeUndefined()+ })+})diff --git a/src/lib/render/sound.ts b/src/lib/render/sound.tsnew file mode 100644index 00000000..9fdbb04a--- /dev/null+++ b/src/lib/render/sound.ts@@ -0,0 +1,127 @@+// The sound of a Swap or Motion run (David's wish of 14.11.2026,+// uebergabe-310/CHARACTER-HUB-KONZEPT.md, section "Ton"). Port of the web's+// lib/render/sound.ts (commit 2176d1be).+//+// Three choices, the original sound is the default:+// * original: the sound of the clip stays. Kling gets keep_original_sound,+// SCAIL 2 and OpenJutsu pass it through. When an engine returns no sound+// track (Wan 2.2 Animate is not documented), the server's worker lays the+// sound of the input clip under it.+// * none: the result has no sound track. Kling gets keep_original_sound+// false, otherwise the worker removes the track. Costs nothing.+// * lipsync: a new voice, the lips follow it. After the video a second run+// with LatentSync (or Lipsync-2) goes over the result. One person only,+// cloud only.+//+// Desktop differences: the intent is a plain string (no import of the store,+// which would close a module cycle), and the lip sync price comes from the+// server's catalogue (lengthPrice); a catalogue without the model gives null,+// and the panel then says the step is not available on this LU Cloud.++import { cloudModelById, lengthCredits, lengthPrice } from '../../stores/cloudCatalogStore'+import type { CloudJobSubmit } from '../../api/cloud/jobs'+import { isSwapIntent, swapPricedSeconds } from './swap'++export type SoundChoice = 'original' | 'none' | 'lipsync'++export const SOUND_CHOICES: readonly SoundChoice[] = ['original', 'none', 'lipsync']++export const SOUND_LABEL: Record<SoundChoice, string> = {+ original: 'Original sound',+ none: 'No sound',+ lipsync: 'New voice, lips in sync',+}++/** The models of the lip sync step, the recommended one first. */+export const LIPSYNC_STEP_MODELS: readonly string[] = ['latentsync', 'lipsync-2']+export const LIPSYNC_STEP_DEFAULT = 'latentsync'++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+ return intent === 'motion' || isSwapIntent(intent)+}++/** Why "lipsync" cannot be picked right now, or null. */+export function lipsyncBlocked(people: number, backend: string, model: string = LIPSYNC_STEP_DEFAULT): string | null {+ if (backend !== 'cloud') return LIPSYNC_CLOUD_ONLY+ if (people > 1) return LIPSYNC_ONE_PERSON+ if (!cloudModelById(model)) return LIPSYNC_NOT_AVAILABLE+ return null+}++/** The sound as the video run names it to the server. Lip sync runs after it+ * as its own step; until then the video run keeps the original sound. */+export function soundParam(sound: SoundChoice): 'original' | 'none' {+ return sound === 'none' ? 'none' : 'original'+}++/** What a model itself knows about sound: Kling has a switch. */+export function soundStudioOptions(model: string, sound: SoundChoice): Record<string, unknown> {+ return model === 'kling-v3-pro-motion-control' ? { keep_original_sound: sound !== 'none' } : {}+}++/** The seconds of voice the lip sync step gets: never longer than the clip+ * (the server cuts, fit_audio). */+export function lipsyncSeconds(audioSeconds: number | undefined, clipSeconds: number | undefined): number | undefined {+ if (audioSeconds === undefined) return clipSeconds+ if (clipSeconds === undefined) return audioSeconds+ return Math.min(audioSeconds, clipSeconds)+}++/** Is the voice longer than the clip? Then a note says it is cut. */+export function lipsyncCut(audioSeconds: number | undefined, clipSeconds: number | undefined): boolean {+ return audioSeconds !== undefined && clipSeconds !== undefined && audioSeconds > clipSeconds + 0.05+}++/** What the lip sync step costs: the catalogue's price rule (LatentSync by+ * the length of the voice, at least 3 s; Lipsync-2 by the length of the+ * clip). null when the server's catalogue does not list the model. */+export function lipsyncCredits(model: string, audioSeconds: number | undefined, clipSeconds: number | undefined): number | null {+ if (!cloudModelById(model)) return null+ const price = lengthPrice(model, 'lipsync')+ if (!price) return lengthCredits(model) || null+ return lengthCredits(model, price.basis === 'audio' ? lipsyncSeconds(audioSeconds, clipSeconds) : clipSeconds)+}++/** Why a run with this sound cannot start, or null. The same sentences as the+ * web engine (validateCreateJob). */+export function soundInputError(sound: SoundChoice | undefined, people: number, backend: string, hasVoice: boolean, model?: string): string | null {+ if (sound !== 'lipsync') return null+ const blocked = lipsyncBlocked(people, backend, model)+ if (blocked) return `${blocked}. Pick Original sound or remove the other people.`+ if (!hasVoice) return 'Add the new voice: upload audio, make one, or pick an earlier voice.'+ return null+}++/** The body of the lip sync step: the video is the own result of the video+ * run (adopt), the sound the chosen voice. fit_audio lets the server cut a+ * longer voice to the length of the clip. In Swap it is a swap step with+ * the consent tick. */+export function lipsyncSubmit(model: string, videoPath: string, audioPath: string, credits: number | null, swap: boolean): CloudJobSubmit {+ return {+ kind: 'video',+ model,+ prompt: '',+ params: {+ op: 'lipsync',+ video_path: videoPath,+ audio_path: audioPath,+ fit_audio: true,+ ...(credits != null ? { max_credits: credits } : {}),+ label: 'Lip sync',+ ...(swap ? { swap_step: 'lipsync' as const, swap_consent: true } : {}),+ },+ }+}++/** How long the clip is that the lip sync step gets: in Swap the seconds that+ * run (swapPricedSeconds), in Motion the whole video. */+export function soundClipSeconds(intent: string, model: string, chosen: number | null, videoSeconds: number | undefined): number | undefined {+ if (videoSeconds === undefined) return undefined+ return isSwapIntent(intent) ? swapPricedSeconds(model, chosen, videoSeconds) : videoSeconds+}diff --git a/src/lib/render/swap.ts b/src/lib/render/swap.tsindex 349ec2aa..5c3bf89e 100644--- a/src/lib/render/swap.ts+++ b/src/lib/render/swap.ts@@ -344,7 +344,7 @@ export const SWAP_CONSENT_MODELS: readonly string[] = [SWAP_MAIN_MODEL, SWAP_KLIconst ALWAYS_CONSENT = [SWAP_OPENJUTSU_MODEL, SWAP_LONG_MODEL]/** The steps of the two step swap, as the run names them to the server. */-export type SwapStep = 'frame' | 'video'+export type SwapStep = 'frame' | 'video' | 'lipsync'/** Does the server ask for the tick on this run? SCAIL 2 and Kling also run in* Motion Control (animate), there without. In Swap yes: SCAIL 2 in modediff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex ac0e0947..7bfb5c10 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -500,6 +500,14 @@ export interface CreateState {/** Swap Character: the built and (after Continue) confirmed first frame.* Runtime-only. */swapBuilt: SwapBuilt | 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'+ /** The model of the lip sync step after the video. Runtime-only. */+ lipsyncModel: string+ /** What the lip sync step costs as the panel shows it (null: no lip sync).+ * The Create button adds it to the video. Runtime-only. */+ lipsyncCredits: number | null/** Music track length in seconds (billed per second on the cloud). */musicDuration: number/** Music: optional lyrics passed to models that take them. Runtime-only. */@@ -761,6 +769,9 @@ export interface CreateState {setSwapConsent: (consent: boolean) => voidsetSwapFrame: (frame: SwapFrame | null) => voidsetSwapBuilt: (built: SwapBuilt | null) => void+ setSound: (sound: 'original' | 'none' | 'lipsync') => void+ setLipsyncModel: (model: string) => void+ setLipsyncCredits: (credits: number | null) => voidbumpCharactersVersion: () => voidsetLoraListKey: (names: readonly string[]) => voidsetCloudOpModel: (id: string) => void@@ -1261,6 +1272,9 @@ export const useCreateStore = create<CreateState>()(swapConsent: false,swapFrame: null as SwapFrame | null,swapBuilt: null as SwapBuilt | null,+ sound: 'original' as 'original' | 'none' | 'lipsync',+ lipsyncModel: 'latentsync',+ lipsyncCredits: null as number | null,musicDuration: 60,musicLyrics: '',talkingWords: '',@@ -1653,6 +1667,9 @@ export const useCreateStore = create<CreateState>()(setSwapConsent: (swapConsent) => set({ swapConsent }),setSwapFrame: (swapFrame) => set({ swapFrame }),setSwapBuilt: (swapBuilt) => set({ swapBuilt }),+ setSound: (sound) => set({ sound }),+ setLipsyncModel: (lipsyncModel) => set({ lipsyncModel }),+ setLipsyncCredits: (lipsyncCredits) => set({ lipsyncCredits }),bumpCharactersVersion: () => set((s) => ({ charactersVersion: s.charactersVersion + 1 })),setLoraListKey: (names) => set((s) => {const key = names.join('\n')