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): end image and several references in Animate, reference images in Create (B38, B45)
purple5dbe04385c7f
diff --git a/src/api/__tests__/animate-takes-an-end-image-and-references.test.ts b/src/api/__tests__/animate-takes-an-end-image-and-references.test.tsnew file mode 100644index 00000000..5d127585--- /dev/null+++ b/src/api/__tests__/animate-takes-an-end-image-and-references.test.ts@@ -0,0 +1,185 @@+/**+ * B38 (Discord 29.10.2026 .molot, 30.10.2026 thirdorbital): Animate took one+ * picture. Asked for: several references where the model takes them, and a+ * start AND an end image (FL2V). Read off ComfyUI master b5a43215 and the+ * Comfy-Org templates video_wan2_2_14B_flf2v, wan2.1_flf2v_720_f16,+ * video_minimax_h3_i2v and video_minimax_h3_r2v:+ * - Wan 2.2 A14B i2v and the Wan 2.1 FLF2V file: WanFirstLastFrameToVideo+ * with start_image and end_image.+ * - MiniMax H3 fl2va: MiniMaxH3ImageToVideo last_frame.+ * - MiniMax H3 ref2va: ref_image_0 to ref_image_8, prompted <Picture N>.+ * A model that cannot take them refuses with the models that can, instead of+ * dropping the picture.+ *+ * Run: npx vitest run src/api/__tests__/animate-takes-an-end-image-and-references.test.ts+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'++vi.mock('../comfyui-nodes', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../comfyui-nodes')>()+ return { ...actual, getAllNodeInfo: vi.fn() }+})+vi.mock('../backend', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../backend')>()+ return { ...actual, localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }+})++import { buildDynamicWorkflow, WorkflowUnavailableError } from '../dynamic-workflow'+import { getAllNodeInfo } from '../comfyui-nodes'+import { localFetch } from '../backend'+import { classTypes, nodeAt, nodeOf } from './graph-test-support'+import { localAnimateReferenceSlots, localEndFrame } from '../../lib/frame-refs'+import { isI2VModel, isT2VCapable } from '../comfyui'+import { studioReadsEndImage } from '../../lib/render/create-studio'++const A14B_HIGH = 'wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors'+const A14B_LOW = 'wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors'+const FLF2V = 'wan2.1_flf2v_720p_14B_fp16.safetensors'+const WAN21_I2V = 'wan2.1_i2v_480p_14B_fp16.safetensors'+const TI2V = 'wan2.2_ti2v_5B_fp16.safetensors'+const FL2VA = 'minimax_h3_fl2va_pruned_int8_convrot.safetensors'+const REF2VA = 'minimax_h3_ref2va_pruned_int8_convrot.safetensors'+const H3_ENCODER = 'qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors'+const H3_VAE = 'minimax_h3_video_vae_int8_convrot.safetensors'+const H3_AUDIO_VAE = 'minimax_h3_audio_vae_fp32.safetensors'++const wanCond = (optional: Record<string, unknown>) => ({+ input: {+ required: { positive: ['CONDITIONING'], negative: ['CONDITIONING'], vae: ['VAE'], width: ['INT'], height: ['INT'], length: ['INT'], batch_size: ['INT'] },+ optional,+ },+ output: ['CONDITIONING', 'CONDITIONING', 'LATENT'],+})++const NODES = {+ UNETLoader: { input: { required: { unet_name: [[A14B_HIGH, A14B_LOW, FLF2V, WAN21_I2V, TI2V, FL2VA, REF2VA]] } } },+ CLIPLoader: { input: { required: { clip_name: [['umt5_xxl_fp8_e4m3fn_scaled.safetensors', H3_ENCODER]] } } },+ VAELoader: { input: { required: { vae_name: [['wan_2.1_vae.safetensors', 'wan2.2_vae.safetensors', H3_VAE, H3_AUDIO_VAE]] } } },+ WanImageToVideo: wanCond({ start_image: ['IMAGE'] }),+ // The schema of comfy_extras/nodes_wan.py, master b5a43215.+ WanFirstLastFrameToVideo: wanCond({ clip_vision_start_image: ['CLIP_VISION_OUTPUT'], clip_vision_end_image: ['CLIP_VISION_OUTPUT'], start_image: ['IMAGE'], end_image: ['IMAGE'] }),+ Wan22ImageToVideoLatent: { input: { required: { vae: ['VAE'], width: ['INT'], height: ['INT'], length: ['INT'], batch_size: ['INT'] }, optional: { start_image: ['IMAGE', {}] } } },+ EmptyHunyuanLatentVideo: { input: { required: {} } },+ ModelSamplingSD3: { input: { required: { model: ['MODEL'], shift: ['FLOAT'] } } },+ KSampler: { input: { required: {} } },+ KSamplerAdvanced: { input: { required: {} } },+ CLIPTextEncode: { input: { required: {} } },+ VAEDecode: { input: { required: {} } },+ ImageScale: { input: { required: {} } },+ LoadImage: { input: { required: {} } },+ VHS_VideoCombine: { input: { required: {} } },+ SaveAnimatedWEBP: { input: { required: {} } },+ LoraLoaderModelOnly: { input: { required: {} } },+ MiniMaxH3ImageToVideo: { input: { required: {} } },+ MiniMaxH3ReferenceToVideo: { input: { required: {} } },+ BasicGuider: { input: { required: {} } },+ BasicScheduler: { input: { required: {} } },+ KSamplerSelect: { input: { required: {} } },+ RandomNoise: { input: { required: {} } },+ SamplerCustomAdvanced: { input: { required: {} } },+ VAEDecodeAudio: { input: { required: {} } },+ CreateVideo: { input: { required: {} } },+ SaveVideo: { input: { required: {} } },+}++beforeEach(() => {+ vi.mocked(getAllNodeInfo).mockResolvedValue(NODES as never)+ vi.mocked(localFetch).mockImplementation((async () => ({+ ok: true, status: 200, json: async () => NODES, text: async () => JSON.stringify(NODES),+ })) as never)+})++const animate = (model: string, extra: Record<string, unknown> = {}) => ({+ model, prompt: 'the girl from image 1 turns, image 2 waves', negativePrompt: '',+ sampler: 'euler', scheduler: 'simple', steps: 20, cfgScale: 5, width: 832, height: 480,+ seed: 42, batchSize: 1, frames: 81, fps: 16, inputImage: 'start.png', ...extra,+}) as never++const loadedImage = (wf: Parameters<typeof nodeAt>[0], ref: unknown) => {+ const [id] = ref as [string, number]+ const node = nodeAt(wf, id)!+ if (node.class_type === 'ImageScale') return nodeAt(wf, (node.inputs.image as [string, number])[0])!.inputs.image+ return node.inputs.image+}++describe('which local models take an end image', () => {+ it('the models whose official template runs first and last frame', () => {+ for (const m of [A14B_HIGH, A14B_LOW, FLF2V, FL2VA]) expect(localEndFrame(m), m).toBe(true)+ })+ it('the ones that start from one image only', () => {+ for (const m of [WAN21_I2V, TI2V, REF2VA, 'fastvideo_fasth3_8step_v2_pruned_bf16.safetensors', 'ltx-2.5-22b-distilled.safetensors', 'svd_xt.safetensors', 'wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors']) {+ expect(localEndFrame(m), m).toBe(false)+ }+ })+ it('the Wan 2.1 FLF2V file is an Animate model, not a text to video one', () => {+ expect(isI2VModel(FLF2V)).toBe(true)+ expect(isT2VCapable(FLF2V)).toBe(false)+ })+ it('LU Cloud: the Studio models with a last_image input', () => {+ for (const m of ['wan-3.0', 'seedance-2.5', 'ltx-2.5-i2v', 'minimax-h3']) expect(studioReadsEndImage(m), m).toBe(true)+ for (const m of ['wan-3.0-ref', 'minimax-h3-ref', 'open-video']) expect(studioReadsEndImage(m), m).toBe(false)+ })+ it('references: MiniMax H3 ref2va reads eight more, nothing else locally', () => {+ expect(localAnimateReferenceSlots(REF2VA)).toBe(8)+ for (const m of [FL2VA, A14B_HIGH, 'wan2.1_vace_14B_fp16.safetensors']) expect(localAnimateReferenceSlots(m), m).toBe(0)+ })+})++describe('Wan: start and end image go through WanFirstLastFrameToVideo', () => {+ it('A14B i2v pair: both images reach the node, both halves sample on it', async () => {+ const wf = await buildDynamicWorkflow(animate(A14B_HIGH, { endImage: 'end.png' }))+ expect(classTypes(wf)).not.toContain('WanImageToVideo')+ const [flfId, flf] = nodeOf(wf, 'WanFirstLastFrameToVideo')!+ expect(loadedImage(wf, flf.inputs.start_image)).toBe('start.png')+ expect(loadedImage(wf, flf.inputs.end_image)).toBe('end.png')+ expect(flf.inputs.length).toBe(81)+ const samplers = Object.values(wf).filter((n) => n.class_type === 'KSamplerAdvanced')+ expect(samplers).toHaveLength(2)+ for (const s of samplers) {+ expect((s.inputs!.positive as [string, number])[0]).toBe(flfId)+ }+ })+ it('the Wan 2.1 FLF2V file', async () => {+ const wf = await buildDynamicWorkflow(animate(FLF2V, { endImage: 'end.png' }))+ expect(loadedImage(wf, nodeOf(wf, 'WanFirstLastFrameToVideo')![1].inputs.end_image)).toBe('end.png')+ })+ it('without an end image nothing changes (regression guard)', async () => {+ const wf = await buildDynamicWorkflow(animate(A14B_HIGH))+ expect(classTypes(wf)).toContain('WanImageToVideo')+ expect(classTypes(wf)).not.toContain('WanFirstLastFrameToVideo')+ })+ it('a model that cannot take it says so and names the ones that can', async () => {+ for (const m of [WAN21_I2V, TI2V]) {+ const err = await buildDynamicWorkflow(animate(m, { endImage: 'end.png' })).catch((e) => e)+ expect(err, m).toBeInstanceOf(WorkflowUnavailableError)+ expect(err.message).toMatch(/cannot also take an end image/)+ expect(err.message).toMatch(/Wan 2\.2 14B i2v/)+ }+ })+})++describe('MiniMax H3', () => {+ it('fl2va ends on the end image (last_frame)', async () => {+ const wf = await buildDynamicWorkflow(animate(FL2VA, { endImage: 'end.png', width: 1344, height: 768, frames: 124, fps: 24 }))+ const enc = nodeOf(wf, 'MiniMaxH3ImageToVideo')![1]+ expect(loadedImage(wf, enc.inputs.first_frame)).toBe('start.png')+ expect(loadedImage(wf, enc.inputs.last_frame)).toBe('end.png')+ })+ it('ref2va takes up to nine pictures and the prompt names them <Picture N>', async () => {+ const refs = Array.from({ length: 10 }, (_, i) => `ref${i + 2}.png`)+ const wf = await buildDynamicWorkflow(animate(REF2VA, { referenceImages: refs, width: 1344, height: 768, frames: 124, fps: 24 }))+ const enc = nodeOf(wf, 'MiniMaxH3ReferenceToVideo')![1]+ expect(loadedImage(wf, enc.inputs['ref_images.ref_image_0'])).toBe('start.png')+ for (let i = 1; i <= 8; i++) expect(loadedImage(wf, enc.inputs[`ref_images.ref_image_${i}`])).toBe(`ref${i + 1}.png`)+ expect(enc.inputs['ref_images.ref_image_9']).toBeUndefined()+ expect(enc.inputs.prompt).toBe('the girl from <Picture 1> turns, <Picture 2> waves')+ })+})++describe('references on a model that reads one picture', () => {+ it('refuse instead of animating the first one alone', async () => {+ const err = await buildDynamicWorkflow(animate(A14B_HIGH, { referenceImages: ['ref2.png'] })).catch((e) => e)+ expect(err).toBeInstanceOf(WorkflowUnavailableError)+ expect(err.message).toMatch(/MiniMax H3 Reference/)+ })+})diff --git a/src/api/__tests__/create-takes-reference-images.test.ts b/src/api/__tests__/create-takes-reference-images.test.tsnew file mode 100644index 00000000..f7d443a6--- /dev/null+++ b/src/api/__tests__/create-takes-reference-images.test.ts@@ -0,0 +1,171 @@+/**+ * B45 (Discord 30.10.2026, boromirofgeo): reference images in Create, text to+ * image, not Edit, for style, pose and camera angle, above all with Krea 2.+ * Each family reads them the way its official Comfy-Org template does+ * (workflow_templates abb9cf64, ComfyUI master b5a43215):+ * - Krea 2: image_krea2_turbo_int8_image_style_reference. The Comfy-Org+ * LoRA krea2_style_reference, ModelSamplingFlux 1.15 / 0.5,+ * TextEncodeQwenImageEditPlus with image1 to image3,+ * FluxKontextMultiReferenceLatentMethod index_timestep_zero, the negative+ * the zeroed positive.+ * - Qwen-Image 2.1: TextEncodeQwenImage21 images.image_N with the VAE, the+ * picture from the empty latent at the canvas size.+ * - FLUX.2: ReferenceLatent on both sides, each image a megapixel through+ * VAEEncode (image_flux2, image_flux2_klein_image_edit_*).+ * Any other model refuses and names the ones that can.+ *+ * Run: npx vitest run src/api/__tests__/create-takes-reference-images.test.ts+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'++vi.mock('../comfyui-nodes', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../comfyui-nodes')>()+ return { ...actual, getAllNodeInfo: vi.fn() }+})+vi.mock('../backend', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../backend')>()+ return { ...actual, localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }+})++import { buildDynamicWorkflow, WorkflowUnavailableError } from '../dynamic-workflow'+import { getAllNodeInfo } from '../comfyui-nodes'+import { localFetch } from '../backend'+import { classTypes, nodeAt, nodeOf, nodesOf } from './graph-test-support'+import { createReferenceSupport, KREA2_STYLE_LORA } from '../../lib/frame-refs'+import { classifyModel } from '../comfyui'++const KREA = 'krea2_turbo_int8_convrot.safetensors'+const QWEN = 'qwen_image_2.1_int8_convrot.safetensors'+const FLUX2 = 'flux-2-klein-4b.safetensors'+const SDXL = 'juggernautXL_v9.safetensors'++const NODES = (loras: string[]) => ({+ UNETLoader: { input: { required: { unet_name: [[KREA, QWEN, FLUX2]] } } },+ CheckpointLoaderSimple: { input: { required: { ckpt_name: [[SDXL]] } } },+ CLIPLoader: { input: { required: { clip_name: [['qwen3vl_4b_fp8_scaled.safetensors', 'qwen3vl_8b_int8_convrot.safetensors', 'qwen_3_4b.safetensors']], type: [['krea2', 'qwen_image', 'flux2', 'stable_diffusion']] } } },+ VAELoader: { input: { required: { vae_name: [['qwen_image_vae.safetensors', 'qwen_image_2.1_vae_bf16.safetensors', 'flux2-vae.safetensors']] } } },+ LoraLoaderModelOnly: { input: { required: { lora_name: [loras] } } },+ LoraLoader: { input: { required: { lora_name: [loras] } } },+ TextEncodeQwenImage21: { input: { required: { clip: ['CLIP'], prompt: ['STRING'], negative_prompt: ['STRING'], resolution: ['INT'] }, optional: { vae: ['VAE'] } } },+ TextEncodeQwenImageEditPlus: { input: { required: {} } },+ FluxKontextMultiReferenceLatentMethod: { input: { required: {} } },+ ModelSamplingFlux: { input: { required: {} } },+ ReferenceLatent: { input: { required: {} } },+ ImageScaleToTotalPixels: { input: { required: {} } },+ VAEEncode: { input: { required: {} } },+ EmptyLatentImage: { input: { required: {} } },+ EmptySD3LatentImage: { input: { required: {} } },+ EmptyFlux2LatentImage: { input: { required: {} } },+ ConditioningZeroOut: { input: { required: {} } },+ KSampler: { input: { required: {} } },+ CLIPTextEncode: { input: { required: {} } },+ VAEDecode: { input: { required: {} } },+ LoadImage: { input: { required: {} } },+ SaveImage: { input: { required: {} } },+})++const serve = (loras: string[] = [KREA2_STYLE_LORA.filename]) => {+ const nodes = NODES(loras)+ vi.mocked(getAllNodeInfo).mockResolvedValue(nodes as never)+ vi.mocked(localFetch).mockImplementation((async () => ({+ ok: true, status: 200, json: async () => nodes, text: async () => JSON.stringify(nodes),+ })) as never)+}+beforeEach(() => serve())++const image = (model: string, refs: string[], extra: Record<string, unknown> = {}) => ({+ model, prompt: 'a knight in the pose of image 1, the armour of image 2', negativePrompt: '',+ sampler: 'euler', scheduler: 'simple', steps: 8, cfgScale: 1, width: 1024, height: 1024,+ seed: 7, batchSize: 1, referenceImages: refs, ...extra,+}) as never++const loaded = (wf: Parameters<typeof nodeAt>[0], ref: unknown) => nodeAt(wf, (ref as [string, number])[0])!.inputs.image++describe('which local image models take reference images', () => {+ it('Krea 2 (style), Qwen-Image 2.1 and FLUX.2 (content)', () => {+ expect(createReferenceSupport(classifyModel(KREA), KREA)).toEqual({ slots: 3, kind: 'style' })+ expect(createReferenceSupport(classifyModel(QWEN), QWEN)).toEqual({ slots: 10, kind: 'content' })+ expect(createReferenceSupport(classifyModel(FLUX2), FLUX2)).toEqual({ slots: 4, kind: 'content' })+ })+ it('none for SDXL, SD 1.5, FLUX.1, Z-Image (IP-Adapter and Redux are not built)', () => {+ for (const m of [SDXL, 'v1-5-pruned.safetensors', 'flux1-dev-fp8.safetensors', 'z_image_turbo_bf16.safetensors']) {+ expect(createReferenceSupport(classifyModel(m), m).slots, m).toBe(0)+ }+ })+})++describe('Krea 2: the official style reference graph', () => {+ it('LoRA, sampling patch, edit encoder with the images, index_timestep_zero, zeroed negative', async () => {+ const wf = await buildDynamicWorkflow(image(KREA, ['a.png', 'b.png', 'c.png', 'd.png']))+ const [, lora] = nodesOf(wf, 'LoraLoaderModelOnly').find(([, n]) => n.inputs.lora_name === KREA2_STYLE_LORA.filename)!+ expect(lora.inputs.strength_model).toBe(1)+ const [shiftId, shift] = nodeOf(wf, 'ModelSamplingFlux')!+ expect(shift.inputs).toMatchObject({ max_shift: 1.15, base_shift: 0.5, width: 1024, height: 1024 })+ const enc = nodeOf(wf, 'TextEncodeQwenImageEditPlus')![1]+ expect([loaded(wf, enc.inputs.image1), loaded(wf, enc.inputs.image2), loaded(wf, enc.inputs.image3)]).toEqual(['a.png', 'b.png', 'c.png'])+ expect(enc.inputs.image4).toBeUndefined()+ expect(enc.inputs.vae).toBeDefined()+ expect(enc.inputs.prompt).toBe('a knight in the pose of Picture 1, the armour of Picture 2')+ const [methodId, method] = nodeOf(wf, 'FluxKontextMultiReferenceLatentMethod')!+ expect(method.inputs.reference_latents_method).toBe('index_timestep_zero')+ const sampler = nodeOf(wf, 'KSampler')![1]+ expect(sampler.inputs.model).toEqual([shiftId, 0])+ expect(sampler.inputs.positive).toEqual([methodId, 0])+ const neg = nodeAt(wf, (sampler.inputs.negative as [string, number])[0])!+ expect(neg.class_type).toBe('ConditioningZeroOut')+ expect(neg.inputs.conditioning).toEqual([methodId, 0])+ })+ it('without the LoRA Create offers it as a checked download', async () => {+ serve([])+ const err = await buildDynamicWorkflow(image(KREA, ['a.png'])).catch((e) => e)+ expect(err).toBeInstanceOf(WorkflowUnavailableError)+ // The download is checked against the sha256 Hugging Face states for it.+ expect(err.missing).toEqual([expect.objectContaining({+ downloadFilename: KREA2_STYLE_LORA.filename, downloadUrl: KREA2_STYLE_LORA.url, subfolder: 'loras', sha256: KREA2_STYLE_LORA.sha256,+ })])+ expect(KREA2_STYLE_LORA.sha256).toBe('f50df5a9e62e4be8aa926a63dd5bb1a64770c4004f763c1208007ae13daa82b8')+ })+ it('without references the plain Krea 2 graph stays (regression guard)', async () => {+ const wf = await buildDynamicWorkflow(image(KREA, []))+ expect(classTypes(wf)).not.toContain('TextEncodeQwenImageEditPlus')+ expect(classTypes(wf)).not.toContain('ModelSamplingFlux')+ })+})++describe('Qwen-Image 2.1: references in the text encoder, picture from the empty latent', () => {+ it('images.image_N with the VAE, <imageN> in the prompt', async () => {+ const wf = await buildDynamicWorkflow(image(QWEN, ['a.png', 'b.png'], { cfgScale: 4, steps: 25 }))+ const enc = nodeOf(wf, 'TextEncodeQwenImage21')![1]+ expect(loaded(wf, enc.inputs['images.image_1'])).toBe('a.png')+ expect(loaded(wf, enc.inputs['images.image_2'])).toBe('b.png')+ expect(enc.inputs.vae).toBeDefined()+ expect(enc.inputs.prompt).toBe('a knight in the pose of <image1>, the armour of <image2>')+ const sampler = nodeOf(wf, 'KSampler')![1]+ expect(nodeAt(wf, (sampler.inputs.latent_image as [string, number])[0])!.class_type).toBe('EmptyLatentImage')+ })+})++describe('FLUX.2: ReferenceLatent on both sides', () => {+ it('each image scaled to a megapixel, encoded, chained', async () => {+ const wf = await buildDynamicWorkflow(image(FLUX2, ['a.png', 'b.png']))+ const refs = nodesOf(wf, 'ReferenceLatent')+ expect(refs).toHaveLength(4)+ for (const [, s] of nodesOf(wf, 'ImageScaleToTotalPixels')) expect(s.inputs.megapixels).toBe(1)+ const sampler = nodeOf(wf, 'KSampler')![1]+ const pos = nodeAt(wf, (sampler.inputs.positive as [string, number])[0])!+ const neg = nodeAt(wf, (sampler.inputs.negative as [string, number])[0])!+ expect(pos.class_type).toBe('ReferenceLatent')+ expect(neg.class_type).toBe('ReferenceLatent')+ const enc = nodeAt(wf, (pos.inputs.latent as [string, number])[0])!+ expect(enc.class_type).toBe('VAEEncode')+ })+})++describe('a model without reference images', () => {+ it('refuses and names the ones that can, instead of ignoring the images', async () => {+ const err = await buildDynamicWorkflow(image(SDXL, ['a.png'])).catch((e) => e)+ expect(err).toBeInstanceOf(WorkflowUnavailableError)+ expect(err.message).toMatch(/cannot take reference images/)+ expect(err.message).toMatch(/Krea 2/)+ })+})diff --git a/src/api/__tests__/qwen-image-21-workflow.test.ts b/src/api/__tests__/qwen-image-21-workflow.test.tsindex 8fb92d0f..645c0f2c 100644--- a/src/api/__tests__/qwen-image-21-workflow.test.ts+++ b/src/api/__tests__/qwen-image-21-workflow.test.ts@@ -544,9 +544,14 @@ describe.each(QWEN21_WEIGHTS)('buildDynamicWorkflow, Qwen-Image 2.1 edit with fuexpect(await at(9, 1536, 1536)).toBe(960)})- // Negative control: references without a source are not an edit at all.- it('a generate run ignores references', async () => {+ // References without a source are not an edit: since B45 (3.0.9) they are+ // the reference images of a text to image run, read by the text encoder,+ // with the picture from the empty latent (create-takes-reference-images).+ it('a generate run takes references as reference images, not as an edit source', async () => {const wf = await buildDynamicWorkflow({ ...baseParams, referenceImages: ['person.png'] } as never)- expect(nodeOf(wf, 'LoadImage')).toBeUndefined()+ const enc = nodeOf(wf, 'TextEncodeQwenImage21')![1]+ expect(enc.inputs['images.image_1']).toBeDefined()+ expect(nodeOf(wf, 'VAEEncode')).toBeUndefined()+ expect(nodeOf(wf, 'EmptyLatentImage')).toBeDefined()})})diff --git a/src/api/__tests__/render-fixup-deps-checks-the-lora-digest.test.ts b/src/api/__tests__/render-fixup-deps-checks-the-lora-digest.test.tsnew file mode 100644index 00000000..c61b168f--- /dev/null+++ b/src/api/__tests__/render-fixup-deps-checks-the-lora-digest.test.ts@@ -0,0 +1,33 @@+/**+ * B45: the Krea 2 style reference LoRA is not in the bundle catalogue (it+ * would need a VRAM figure of its own), so Create downloads it in place from+ * the component the builder names. Its sha256 travels with that component,+ * and the download is checked against it, as a catalogue file is.+ *+ * Run: npx vitest run src/api/__tests__/render-fixup-deps-checks-the-lora-digest.test.ts+ */+import { describe, it, expect, vi } from 'vitest'++const got = vi.hoisted(() => ({ files: [] as Array<Record<string, unknown>> }))+vi.mock('../../lib/bundle-install', async (orig) => ({+ ...((await orig()) as Record<string, unknown>),+ downloadBundleFiles: async (files: Array<Record<string, unknown>>) => { got.files = files },+ waitForModelsVisible: async () => true,+}))+vi.mock('../discover', async (orig) => ({+ ...((await orig()) as Record<string, unknown>),+ modelsNotVisibleInComfy: async () => [],+}))++import { renderFixupDeps } from '../render-fixup-deps'+import { KREA2_STYLE_LORA } from '../../lib/frame-refs'++describe('a component download carries its own digest', () => {+ it('the Krea 2 style LoRA is checked against the sha256 Hugging Face states', async () => {+ await renderFixupDeps(() => undefined).download([{+ matchPatterns: [KREA2_STYLE_LORA.filename], downloadFilename: KREA2_STYLE_LORA.filename,+ downloadUrl: KREA2_STYLE_LORA.url, subfolder: 'loras', sizeGB: 0.43, sha256: KREA2_STYLE_LORA.sha256,+ }] as never).catch(() => undefined)+ expect(got.files).toEqual([expect.objectContaining({ filename: KREA2_STYLE_LORA.filename, subfolder: 'loras', sha256: KREA2_STYLE_LORA.sha256 })])+ })+})diff --git a/src/api/__tests__/wrapper-node-names.test.ts b/src/api/__tests__/wrapper-node-names.test.tsindex f35a0611..4d921f18 100644--- a/src/api/__tests__/wrapper-node-names.test.ts+++ b/src/api/__tests__/wrapper-node-names.test.ts@@ -93,6 +93,14 @@ const CORE_NODES = new Set([// [nodes_qwen.py 185, in the QwenExtension list at 244]. The builder adds// either only when /object_info lists it.'CFGGuider', 'QwenImage21Cache',+ // B38/B45, read in ComfyUI master b5a43215 on 30.10.2026 (schema node_id or+ // NODE_CLASS_MAPPINGS key, the file in brackets) and used by the official+ // Comfy-Org templates named in lib/frame-refs.ts: WanFirstLastFrameToVideo+ // [nodes_wan.py 188], FluxKontextMultiReferenceLatentMethod [nodes_flux.py+ // 158], ModelSamplingFlux [nodes_model_advanced.py 166], ReferenceLatent+ // [nodes_edit_model.py], ImageScaleToTotalPixels [nodes_post_processing.py 234].+ 'WanFirstLastFrameToVideo', 'FluxKontextMultiReferenceLatentMethod', 'ModelSamplingFlux', 'ReferenceLatent',+ 'ImageScaleToTotalPixels','YuE2GenerateMusic', 'EmptyYuE2LatentAudio',// lora'LoraLoader', 'LoraLoaderModelOnly',diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex e1d37d5c..9d89d2ca 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -99,6 +99,9 @@ export interface VideoParams extends GenerateParams {frames: numberfps: numberinputImage?: string // Uploaded image filename for I2V models (SVD, FramePack)+ /** Animate: the picture the clip ends on (B38), for the models+ * lib/frame-refs localEndFrame names. Any other model refuses it. */+ endImage?: string// SVD motion strength (motion_bucket_id, 1–255). Lower = more faithful to the// source still / calmer motion; 127 (SVD default) drifts hard. We default ~90// for I2V fidelity (2026-06-11). Honoured only by the SVD path.@@ -503,6 +506,9 @@ export function isI2VModel(name: string): boolean {if (isFastH3(lower)) return false// An A14B half is one or the other, never both like the TI2V-5B.if (isWan22A14B(lower)) return lower.includes('i2v') || !lower.includes('t2v')+ // Wan 2.1 FLF2V (wan2.1_flf2v_720p_14B) starts from an image and ends on+ // a second one (B38); its name carries no i2v tag.+ if (/(^|[^a-z0-9])flf2v([^a-z0-9]|$)/.test(lower)) return truereturn lower.includes('i2v') || lower.includes('svd') || lower.includes('framepack')|| lower.includes('ti2v') || lower.includes('wan2.2') || lower.includes('wan2_2') || lower.includes('wan22')|| lower.includes('ltx') || lower.includes('video2world') || classifyModel(name) === 'minimaxh3'@@ -526,7 +532,7 @@ export function isT2VCapable(name: string): boolean {if (lower.includes('ti2v') || lower.includes('wan2.2') || lower.includes('wan2_2') || lower.includes('wan22')) return trueif (lower.includes('svd') || lower.includes('framepack')) return falseif (lower.includes('video2world')) return false- if (lower.includes('i2v')) return false+ if (lower.includes('i2v') || /(^|[^a-z0-9])flf2v([^a-z0-9]|$)/.test(lower)) return falsereturn true}diff --git a/src/api/component-registry.ts b/src/api/component-registry.tsindex 6aa8770e..fd91cef4 100644--- a/src/api/component-registry.ts+++ b/src/api/component-registry.ts@@ -30,6 +30,10 @@ export interface ComponentSpec {subfolder?: string/** Size, for the "download N GB now?" question in Create. */sizeGB?: number+ /** The file's sha256 where the component is not in the bundle catalogue+ * (B45: the Krea 2 style reference LoRA). The download is checked+ * against it; a catalogue file takes its digest from the catalogue. */+ sha256?: string}export interface ComponentRequirements {diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.tsindex ce70e574..4707ed9c 100644--- a/src/api/dynamic-workflow.ts+++ b/src/api/dynamic-workflow.ts@@ -63,6 +63,7 @@ export { promptFilenamePrefix, videoDecodeNode } from './comfyui-graph'import { promptFilenamePrefix, videoDecodeNode, addVideoSave } from './comfyui-graph'import { extraReferenceSlots, isQwenImageEditModel, referenceSide } from '../lib/edit-references'import { canonicalImageRefs } from '../lib/image-ref-names'+import { KREA2_STYLE_LORA, LOCAL_END_FRAME_MODELS, createReferenceSupport, localAnimateReferenceSlots, localEndFrame, CREATE_REFERENCE_MODELS } from '../lib/frame-refs'import { nativeUpscaleScale, upscaleTarget, type UpscaleFactor } from '../lib/local-upscale'import { WAN_FAST, findWanSpeedLora, isFastSampling, wanSamplingFor, wanSpeedKind, wanSpeedLoraNames } from '../lib/wan-speed'import { addAudioStitch, addContextWindows, addContinueSource, addStitch, CONTINUE_NEEDS_UPDATE, type ContinueSource } from './video-continue'@@ -627,6 +628,14 @@ export async function buildDynamicWorkflow(// picture Phantom and MAGREF stay the text to video runs they always were;// VACE has no such run in LU.const refFamily = isVideo ? ref2vFamily(params.model) : null+ // B38: never drop an end image or further references without a word. A+ // model that cannot take them refuses, and Create shows why.+ if (isVideo && videoParams.endImage && !localEndFrame(params.model)) {+ throw new WorkflowUnavailableError(`${params.model} starts from one image and cannot also take an end image. ${LOCAL_END_FRAME_MODELS}`, 'unavailable')+ }+ if (isVideo && (gp.referenceImages?.length ?? 0) > 0 && localAnimateReferenceSlots(params.model) === 0) {+ throw new WorkflowUnavailableError(`${params.model} reads one picture. Several references work with MiniMax H3 Reference (ref2va) here, and in LU Cloud with Wan 3.0 Reference and MiniMax H3 Reference.`, 'unavailable')+ }if (refFamily && (videoParams.inputImage || refFamily === 'vace')) {const refusal = ref2vRefusal(params.model)if (refusal) throw new WorkflowUnavailableError(refusal, 'unavailable')@@ -1099,11 +1108,44 @@ export async function buildDynamicWorkflow(const references = (isQwenEdit || isQwen1Edit)? (gp.referenceImages ?? []).slice(0, extraReferenceSlots(type, params.model)): []+ // B45 (Discord 30.10.2026): reference images for text to image, read the+ // way each family's official template reads them (lib/frame-refs). A model+ // without such a path refuses instead of drawing from the prompt alone.+ const createRefsAsked = !isVideo && !gp.inputImage ? (gp.referenceImages ?? []) : []+ const createRefSupport = createReferenceSupport(type, params.model)+ const createRefStrategy = strategy === 'unet_krea2' || strategy === 'unet_qwenimage' || strategy === 'unet_flux2'+ if (createRefsAsked.length > 0 && (createRefSupport.slots === 0 || !createRefStrategy)) {+ throw new WorkflowUnavailableError(`${params.model} cannot take reference images. ${CREATE_REFERENCE_MODELS}`, strategy)+ }+ const createRefs = createRefsAsked.slice(0, createRefSupport.slots)+ const krea2StyleRef = strategy === 'unet_krea2' && createRefs.length > 0+ if (krea2StyleRef) {+ requireRelease(allNodes, ['TextEncodeQwenImageEditPlus', 'FluxKontextMultiReferenceLatentMethod', 'ModelSamplingFlux', 'LoraLoaderModelOnly'],+ 'Reference images with Krea 2 need a newer ComfyUI. Update ComfyUI, then try again.', strategy)+ }+ if (strategy === 'unet_flux2' && createRefs.length > 0) {+ requireRelease(allNodes, ['ReferenceLatent', 'VAEEncode', 'ImageScaleToTotalPixels'],+ 'Reference images with FLUX.2 need a newer ComfyUI. Update ComfyUI, then try again.', strategy)+ }+ // The style reference LoRA of the Krea 2 template. Without it the images+ // would reach the model but not steer the style, so Create offers the file.+ let krea2StyleLora: string | null = null+ if (krea2StyleRef) {+ krea2StyleLora = nodeComboOptions(allNodes, 'LoraLoaderModelOnly', 'lora_name')+ .find((l) => (l.split(/[\\/]/).pop() ?? '').toLowerCase() === KREA2_STYLE_LORA.filename) ?? null+ if (!krea2StyleLora) {+ throw new WorkflowUnavailableError(+ `Reference images with Krea 2 need the Krea 2 style reference LoRA (${KREA2_STYLE_LORA.filename}, 436 MB) in ComfyUI/models/loras.`,+ strategy, undefined,+ { missing: [{ matchPatterns: [KREA2_STYLE_LORA.filename], downloadFilename: KREA2_STYLE_LORA.filename, downloadUrl: KREA2_STYLE_LORA.url, subfolder: 'loras', sizeGB: 0.43, sha256: KREA2_STYLE_LORA.sha256 }] },+ )+ }+ }// The graphics card, read only for an edit with further images: past what// it carries, ComfyUI 0.37 ends the run in "aimdo memory compile error"// (lib/comfy-edit-memory). Not on a Mac, where ComfyUI has no such compiler// and the figure is the shared memory.- const cardGb = references.length > 0 && !isMacOS()+ const cardGb = (references.length > 0 || (strategy === 'unet_qwenimage' && createRefs.length > 1)) && !isMacOS()? await getSystemVRAM().catch(() => null): nullconst fullImages = comfyEditFullImages(cardGb)@@ -1152,9 +1194,11 @@ export async function buildDynamicWorkflow(// however the user spelled them (lib/image-ref-names).prompt: isQwenEdit? canonicalImageRefs(params.prompt, 1 + references.length, 'qwen21')+ : createRefs.length > 0 ? canonicalImageRefs(params.prompt, createRefs.length, 'qwen21'): gp.transparent ? transparentPrompt(params.prompt) : params.prompt,negative_prompt: isQwenEdit? canonicalImageRefs(params.negativePrompt || '', 1 + references.length, 'qwen21')+ : createRefs.length > 0 ? canonicalImageRefs(params.negativePrompt || '', createRefs.length, 'qwen21'): params.negativePrompt || '',// With more images in an edit than the card carries at full size// (four, fewer on a card under 24 GB) they share a pixel budget@@ -1163,6 +1207,7 @@ export async function buildDynamicWorkflow(// first, so such an edit comes out smaller than the canvas.resolution: isQwenEdit? referenceSide(qwenEditResolution(params.width, params.height), 1 + references.length, fullImages)+ : createRefs.length > 0 ? referenceSide(qwenEditResolution(params.width, params.height), createRefs.length, fullImages): qwenEditResolution(params.width, params.height),}if (isQwenEdit) {@@ -1175,6 +1220,15 @@ export async function buildDynamicWorkflow(qwenInputs[`images.image_${i + 1}`] = [loadId, 0]}qwenInputs.vae = [vaeSourceId, vaeOutputSlot]+ } else if (createRefs.length > 0) {+ // B45: references without a source. They are image_1 and up; the+ // picture still comes from the empty latent at the canvas size below.+ for (const [i, image] of createRefs.entries()) {+ const loadId = String(n++)+ workflow[loadId] = { class_type: 'LoadImage', inputs: { image } }+ qwenInputs[`images.image_${i + 1}`] = [loadId, 0]+ }+ qwenInputs.vae = [vaeSourceId, vaeOutputSlot]}workflow[posId] = { class_type: 'TextEncodeQwenImage21', inputs: qwenInputs }} else if (isQwen1Edit) {@@ -1203,6 +1257,28 @@ export async function buildDynamicWorkflow(const pictures = (text: string) => canonicalImageRefs(text, 1 + references.length, 'qwenEditPlus')workflow[posId] = { class_type: 'TextEncodeQwenImageEditPlus', inputs: editInputs(pictures(params.prompt)) }workflow[negId] = { class_type: 'TextEncodeQwenImageEditPlus', inputs: editInputs(pictures(params.negativePrompt || '')) }+ } else if (krea2StyleRef) {+ // B45: the official Krea 2 style reference template. The images go+ // through TextEncodeQwenImageEditPlus (image1 to image3), the reference+ // latents are placed with index_timestep_zero, and the negative is the+ // zeroed positive at CFG 1, as the template runs it.+ const encId = String(n++)+ const encInputs: ComfyNodeInputs = {+ clip: [clipSourceId, clipOutputSlot],+ prompt: canonicalImageRefs(params.prompt, createRefs.length, 'qwenEditPlus'),+ vae: [vaeSourceId, vaeOutputSlot],+ }+ for (const [i, image] of createRefs.entries()) {+ const loadId = String(n++)+ workflow[loadId] = { class_type: 'LoadImage', inputs: { image } }+ encInputs[`image${i + 1}`] = [loadId, 0]+ }+ workflow[encId] = { class_type: 'TextEncodeQwenImageEditPlus', inputs: encInputs }+ workflow[posId] = {+ class_type: 'FluxKontextMultiReferenceLatentMethod',+ inputs: { conditioning: [encId, 0], reference_latents_method: 'index_timestep_zero' },+ }+ workflow[negId] = { class_type: 'ConditioningZeroOut', inputs: { conditioning: [posId, 0] } }} else {workflow[posId] = {class_type: 'CLIPTextEncode',@@ -1451,10 +1527,14 @@ export async function buildDynamicWorkflow(strategy,)}+ // B38: an end image turns the Wan run into first and last frame+ // (WanFirstLastFrameToVideo, the node of the official FLF2V templates).+ const endImage = continueFrom ? undefined : videoParams.endImageconst i2vNode =strategy === 'unet_ltx' ? 'LTXVImgToVideo': strategy === 'unet_cosmos' ? 'CosmosImageToVideoLatent': type === 'hunyuan' ? 'HunyuanImageToVideo'+ : endImage ? 'WanFirstLastFrameToVideo': 'WanImageToVideo'const meta = allNodes[i2vNode]if (!meta) {@@ -1493,6 +1573,11 @@ export async function buildDynamicWorkflow(if (decl.start_image) inputs.start_image = startRefelse if (decl.image) inputs.image = startRefelse if (decl.init_image) inputs.init_image = startRef+ if (endImage && decl.end_image) {+ const endId = String(n++)+ workflow[endId] = { class_type: 'LoadImage', inputs: { image: endImage } }+ inputs.end_image = [endId, 0]+ }// SVI-style anti-drift padding (core WanImageToVideo, 2026): the empty// frames of a continued section are filled with the clip's first picture// instead of grey, so faces and colours stay where the clip started.@@ -1543,6 +1628,36 @@ export async function buildDynamicWorkflow(// official templates: AuraFlow shift 1 (Chroma), 6 (Lumina 2), 3.1 / 3// (Qwen-Image / -Edit); ModelSamplingSD3 shift 3 (HiDream fast/full) or 6// (dev). Qwen-Image-Edit also runs CFGNorm at strength 1.+ // B45: FLUX.2 reads references as ReferenceLatent on the conditioning,+ // each image scaled to about a megapixel and encoded, chained one after+ // the other on both sides (image_flux2, the Klein edit templates).+ if (strategy === 'unet_flux2' && createRefs.length > 0) {+ for (const image of createRefs) {+ const loadId = String(n++)+ const scaleId = String(n++)+ const encId = String(n++)+ workflow[loadId] = { class_type: 'LoadImage', inputs: { image } }+ workflow[scaleId] = { class_type: 'ImageScaleToTotalPixels', inputs: { image: [loadId, 0], upscale_method: 'lanczos', megapixels: 1, resolution_steps: 1 } }+ workflow[encId] = { class_type: 'VAEEncode', inputs: { pixels: [scaleId, 0], vae: [vaeSourceId, vaeOutputSlot] } }+ const posRefId = String(n++)+ const negRefId = String(n++)+ workflow[posRefId] = { class_type: 'ReferenceLatent', inputs: { conditioning: positiveRef, latent: [encId, 0] } }+ workflow[negRefId] = { class_type: 'ReferenceLatent', inputs: { conditioning: negativeRef, latent: [encId, 0] } }+ positiveRef = [posRefId, 0]+ negativeRef = [negRefId, 0]+ }+ }+ // B45: the Krea 2 style reference LoRA and the template's flux sampling+ // patch (max shift 1.15, base shift 0.5 at the canvas size), after the+ // user's own LoRA stack.+ if (krea2StyleRef && krea2StyleLora) {+ const loraId = String(n++)+ const shiftId = String(n++)+ workflow[loraId] = { class_type: 'LoraLoaderModelOnly', inputs: { model: [samplerModelId, 0], lora_name: krea2StyleLora, strength_model: 1 }, _meta: { title: 'Krea 2 style reference' } }+ workflow[shiftId] = { class_type: 'ModelSamplingFlux', inputs: { model: [loraId, 0], max_shift: 1.15, base_shift: 0.5, width: params.width, height: params.height } }+ samplerModelId = shiftId+ }+const auraShift = strategy === 'unet_chroma' ? 1: strategy === 'unet_lumina2' ? 6: strategy === 'unet_qwenimage1' ? (isQwenImageEditModel(params.model) ? 3 : 3.1)@@ -2223,6 +2338,27 @@ async function buildMiniMaxH3Workflow(params: VideoParams, seed: number, allNodeif (isRef2va) encodeInputs['ref_images.ref_image_0'] = [scaleId, 0]else encodeInputs.first_frame = [scaleId, 0]}+ // B38: fl2va ends on a second picture (last_frame, center crop like the+ // node itself), ref2va takes up to nine references (ref_image_0 to _8).+ // The node scales references on its own ("match"), so they go in as they are.+ if (params.endImage && !isRef2va) {+ const endId = String(n++)+ const endScaleId = String(n++)+ workflow[endId] = { class_type: 'LoadImage', inputs: { image: params.endImage } }+ workflow[endScaleId] = { class_type: 'ImageScale', inputs: { image: [endId, 0], upscale_method: 'lanczos', width, height, crop: 'center' } }+ encodeInputs.last_frame = [endScaleId, 0]+ }+ if (isRef2va) {+ const more = params.inputImage ? (params.referenceImages ?? []).slice(0, localAnimateReferenceSlots(params.model)) : []+ for (const [i, image] of more.entries()) {+ const refId = String(n++)+ workflow[refId] = { class_type: 'LoadImage', inputs: { image } }+ encodeInputs[`ref_images.ref_image_${i + 1}`] = [refId, 0]+ }+ // The node numbers its pictures <Picture 1> and up; "image 2" in the+ // prompt means the second of them (lib/image-ref-names).+ if (more.length > 0) encodeInputs.prompt = canonicalImageRefs(params.prompt, 1 + more.length, 'minimaxH3')+ }if (isRef2va) {encodeInputs.audio_vae = [audioVaeId, 0]encodeInputs.ref_image_size = 'match'diff --git a/src/api/render-fixup-deps.ts b/src/api/render-fixup-deps.tsindex 7b285294..6c502764 100644--- a/src/api/render-fixup-deps.ts+++ b/src/api/render-fixup-deps.ts@@ -37,7 +37,7 @@ export function renderFixupDeps(onStatus: (line: string) => void, signal?: Abortfor (const f of files) dl.setMeta(f.downloadFilename, f.downloadUrl, f.subfolder)dl.startPolling()await downloadBundleFiles(- files.map((f) => ({ filename: f.downloadFilename, subfolder: f.subfolder, downloadUrl: f.downloadUrl, sizeGB: f.sizeGB, sha256: catalogDigestFor(f.downloadFilename, f.downloadUrl).sha256 })),+ files.map((f) => ({ filename: f.downloadFilename, subfolder: f.subfolder, downloadUrl: f.downloadUrl, sizeGB: f.sizeGB, sha256: f.sha256 ?? catalogDigestFor(f.downloadFilename, f.downloadUrl).sha256 })),{start: startModelDownload,progress: getDownloadProgress,diff --git a/src/components/create/experimental/FrameRefs.tsx b/src/components/create/experimental/FrameRefs.tsxnew file mode 100644index 00000000..2451a32c--- /dev/null+++ b/src/components/create/experimental/FrameRefs.tsx@@ -0,0 +1,241 @@+// B38 and B45 (Discord 29.10. and 30.10.2026): the end image of Animate and+// the reference images of the Image tab. Each one shows where the model on+// screen reads it, and where it does not, a line says so and which models do+// (lib/frame-refs). An image kept from an earlier model stays on screen,+// marked "not sent", the way the Edit references do.+import { useRef, useState } from 'react'+import { ImagePlus, Loader2, X } from 'lucide-react'+import { useCreateStore } from '../../../stores/createStore'+import { classifyModel } from '../../../api/comfyui'+import { isMlxImageHost } from '../../../api/mlx-image'+import {+ CREATE_REFERENCE_MODELS, LOCAL_END_FRAME_MODELS, createReferenceLine, createReferenceSupport,+ laneVideoModel, localEndFrame, type CreateReferenceKind,+} from '../../../lib/frame-refs'+import { studioPickFor, studioReadsEndImage } from '../../../lib/render/create-studio'+import { laneImageModel } from '../../../lib/image-engines'+import { imageRefWords, withImageRef } from '../../../lib/image-ref-names'+import { loadImageRef } from './loadImage'+import { GALLERY_DRAG_TYPE, fetchGalleryItemBlob } from './galleryUrl'+import { cn } from '../ui/cn'++const TILE = 'w-16 h-16 rounded-lg shrink-0'++/** The cloud line where the Studio model on Animate starts from one image. */+export const CLOUD_END_FRAME_MODELS = 'This model starts from one image. Wan 3.0, Seedance 2.5, LTX 2.5 and MiniMax H3 also take an end image.'++/** Does the Animate model on screen take an end image? */+export function useEndImageSupport(): { supported: boolean; hint: string } {+ const backend = useCreateStore((s) => s.backend)+ const cloudModel = useCreateStore((s) => studioPickFor('animate', s))+ const localModel = useCreateStore((s) => laneVideoModel(s.videoModelList, s.videoModel, 'animate'))+ if (backend === 'cloud') {+ return studioReadsEndImage(cloudModel) ? { supported: true, hint: '' } : { supported: false, hint: CLOUD_END_FRAME_MODELS }+ }+ // The Mac's own video engine takes one start image.+ if (isMlxImageHost()) return { supported: false, hint: `The video engine of this Mac starts from one image. ${LOCAL_END_FRAME_MODELS}` }+ return localEndFrame(localModel) ? { supported: true, hint: '' } : { supported: false, hint: LOCAL_END_FRAME_MODELS }+}++async function fileFromDrop(e: React.DragEvent, gallery: ReturnType<typeof useCreateStore.getState>['gallery']): Promise<File | null> {+ const file = e.dataTransfer.files[0]+ if (file) return file+ const item = gallery.find((g) => g.id === e.dataTransfer.getData(GALLERY_DRAG_TYPE))+ if (!item) return null+ const blob = await fetchGalleryItemBlob(item)+ return new File([blob], item.filename || 'image.png', { type: blob.type || 'image/png' })+}++/** Animate: the picture the clip ends on, beside the start image. */+export function EndImageSlot() {+ const intent = useCreateStore((s) => s.intent())+ const endImage = useCreateStore((s) => s.endImage)+ const setEndImage = useCreateStore((s) => s.setEndImage)+ const setError = useCreateStore((s) => s.setError)+ const gallery = useCreateStore((s) => s.gallery)+ const { supported, hint } = useEndImageSupport()+ const inputRef = useRef<HTMLInputElement>(null)+ const [loading, setLoading] = useState(false)+ if (intent !== 'animate') return null++ const take = async (file: File | null) => {+ if (!file) return+ if (!file.type.startsWith('image/')) {+ setError('That file type is not supported. Use PNG, JPG or WebP.')+ return+ }+ setLoading(true)+ setError(null)+ try {+ setEndImage(await loadImageRef(file))+ } catch (err) {+ setError(`Could not load the image: ${err instanceof Error ? err.message : String(err)}`)+ } finally {+ setLoading(false)+ }+ }++ if (!supported && !endImage) {+ return <p className="mt-3 t-micro leading-snug text-gray-500 text-center max-w-md mx-auto text-balance" data-testid="end-image-unsupported">{hint}</p>+ }+ return (+ <div className="mt-3 flex flex-col items-center gap-1.5" data-testid="end-image-slot">+ <div+ className="flex items-center gap-2"+ onDragOver={(e) => { if (supported) e.preventDefault() }}+ onDrop={(e) => { e.preventDefault(); if (supported && !loading) void fileFromDrop(e, gallery).then(take) }}+ >+ {endImage ? (+ <div className={cn(TILE, 'relative')} data-not-sent={supported ? undefined : 'true'}>+ <img src={endImage.url} alt="end image" className={cn(TILE, 'object-cover border border-white/[0.06]', !supported && 'opacity-40')} />+ <span className="lu-on-dark absolute bottom-1 left-1 t-micro text-gray-200 bg-black/60 px-1 rounded">{supported ? 'End' : 'not sent'}</span>+ <button+ onClick={() => setEndImage(null)}+ className="lu-on-dark absolute top-1 right-1 w-5 h-5 flex items-center justify-center rounded-md bg-black/60 text-gray-300 hover:text-white"+ title="Remove the end image"+ aria-label="Remove the end image"+ >+ <X size={11} />+ </button>+ </div>+ ) : (+ <button+ onClick={() => inputRef.current?.click()}+ disabled={loading}+ className={cn(TILE, 'border-2 border-dashed border-white/10 hover:border-white/25 text-gray-500 hover:text-gray-300 flex flex-col items-center justify-center gap-0.5 transition-colors')}+ title="Add the picture the clip should end on"+ data-testid="end-image-add"+ >+ {loading ? <Loader2 size={16} className="animate-spin" /> : <ImagePlus size={16} />}+ <span className="t-micro">End image</span>+ </button>+ )}+ <input ref={inputRef} type="file" accept="image/*" className="hidden" onChange={(e) => { void take(e.target.files?.[0] ?? null); e.target.value = '' }} />+ </div>+ <p className="t-micro leading-snug text-gray-500 text-center max-w-md text-balance" data-testid="end-image-line">+ {supported+ ? endImage ? 'The clip starts on the image above and ends on this one.' : 'Optional: add the picture the clip should end on.'+ : `${hint} The end image here is not sent.`}+ </p>+ </div>+ )+}++/** What the Image tab's model does with reference images, and how many. */+export function useImageReferenceSupport(): { slots: number; kind?: CreateReferenceKind; hint: string } {+ const backend = useCreateStore((s) => s.backend)+ const model = useCreateStore((s) => laneImageModel(s.imageModelList, s.imageModel, 'image'))+ const listedType = useCreateStore((s) => s.imageModelList.find((m) => m.name === laneImageModel(s.imageModelList, s.imageModel, 'image'))?.type)+ if (backend === 'cloud') {+ return { slots: 0, hint: 'The LU Cloud image models make the picture from the prompt alone. To work from your own images, use Edit with Seedream 5, Qwen-Image 2.1 Edit or MiniMax H3 Edit.' }+ }+ // The Mac's own image engine runs prompt to picture only.+ if (isMlxImageHost()) return { slots: 0, hint: 'The image engine of this Mac makes the picture from the prompt alone. Reference images work through ComfyUI with Krea 2, Qwen-Image 2.1 and FLUX.2.' }+ const support = createReferenceSupport(listedType ?? classifyModel(model), model)+ return support.slots > 0 ? { ...support, hint: '' } : { slots: 0, hint: CREATE_REFERENCE_MODELS }+}++/** Image tab: reference images for style, pose and camera angle (B45). */+export function ImageReferenceStrip() {+ const refs = useCreateStore((s) => s.imageReferences)+ const add = useCreateStore((s) => s.addImageReference)+ const remove = useCreateStore((s) => s.removeImageReference)+ const setError = useCreateStore((s) => s.setError)+ const setPrompt = useCreateStore((s) => s.setPrompt)+ const gallery = useCreateStore((s) => s.gallery)+ const { slots, kind, hint } = useImageReferenceSupport()+ const inputRef = useRef<HTMLInputElement>(null)+ const [loading, setLoading] = useState(false)+ const [open, setOpen] = useState(false)++ const takeFiles = async (files: File[]) => {+ let room = slots - refs.length+ setLoading(true)+ setError(null)+ try {+ for (const file of files) {+ if (room <= 0) break+ if (!file.type.startsWith('image/')) { setError('That file type is not supported. Use PNG, JPG or WebP.'); continue }+ add(await loadImageRef(file))+ room--+ }+ } catch (err) {+ setError(`Could not load the image: ${err instanceof Error ? err.message : String(err)}`)+ } finally {+ setLoading(false)+ }+ }++ if (slots === 0 && refs.length === 0) {+ // One quiet line, opened on demand: the empty Image tab is not crowded+ // with a sentence about a feature most of its models do not have.+ return (+ <div className="mt-2 flex flex-col items-center" data-testid="image-references-unsupported">+ <button type="button" onClick={() => setOpen((o) => !o)} className="t-micro text-gray-500 hover:text-gray-300 underline underline-offset-2">+ Reference images?+ </button>+ {open && <p className="mt-1 t-micro leading-snug text-gray-500 text-center max-w-md text-balance">{hint}</p>}+ </div>+ )+ }+ const canAdd = refs.length < slots+ return (+ <div className="mt-3 flex flex-col items-center gap-2" data-testid="image-references">+ <div+ className="flex flex-wrap justify-center items-center gap-2 rounded-xl p-1 max-w-md"+ onDragOver={(e) => { if (canAdd) e.preventDefault() }}+ onDrop={(e) => {+ e.preventDefault()+ if (!canAdd || loading) return+ if (e.dataTransfer.files.length) { void takeFiles(Array.from(e.dataTransfer.files)); return }+ void fileFromDrop(e, gallery).then((f) => (f ? takeFiles([f]) : undefined))+ }}+ >+ {refs.map((ref, i) => {+ const sent = i < slots+ return (+ <div key={`${ref.url.slice(-24)}-${i}`} className={cn(TILE, 'relative')} data-not-sent={sent ? undefined : 'true'}>+ <img src={ref.url} alt={imageRefWords(i + 1)} className={cn(TILE, 'object-cover border border-white/[0.06]', !sent && 'opacity-40')} />+ {sent && kind !== 'style' ? (+ <button+ type="button"+ onClick={() => setPrompt(withImageRef(useCreateStore.getState().prompt, i + 1))}+ className="lu-on-dark absolute bottom-1 left-1 t-micro text-gray-200 bg-black/60 hover:bg-black/80 hover:text-white px-1 rounded"+ title={`Refer to it as ${imageRefWords(i + 1)} in your prompt. Click to add it.`}+ >+ Image {i + 1}+ </button>+ ) : !sent ? (+ <span className="lu-on-dark absolute bottom-1 left-1 t-micro text-gray-300 bg-black/70 px-1 rounded">not sent</span>+ ) : null}+ <button+ onClick={() => remove(i)}+ className="lu-on-dark absolute top-1 right-1 w-5 h-5 flex items-center justify-center rounded-md bg-black/60 text-gray-300 hover:text-white"+ title={`Remove reference ${i + 1}`}+ aria-label={`Remove reference ${i + 1}`}+ >+ <X size={11} />+ </button>+ </div>+ )+ })}+ {canAdd && (+ <button+ onClick={() => inputRef.current?.click()}+ disabled={loading}+ className={cn(TILE, 'border-2 border-dashed border-white/10 hover:border-white/25 text-gray-500 hover:text-gray-300 flex flex-col items-center justify-center gap-0.5 transition-colors')}+ title="Add a reference image"+ data-testid="image-reference-add"+ >+ {loading ? <Loader2 size={16} className="animate-spin" /> : <ImagePlus size={16} />}+ <span className="t-micro">Reference</span>+ </button>+ )}+ <input ref={inputRef} type="file" accept="image/*" multiple className="hidden" onChange={(e) => { void takeFiles(Array.from(e.target.files ?? [])); e.target.value = '' }} />+ </div>+ <p className="t-micro leading-snug text-gray-500 text-center max-w-md text-balance" data-testid="image-references-line">+ {slots === 0 ? `${hint} The images here are not sent.` : createReferenceLine(kind, Math.min(refs.length, slots))}+ </p>+ </div>+ )+}diff --git a/src/components/create/experimental/ReferenceStrip.tsx b/src/components/create/experimental/ReferenceStrip.tsxindex d76ac8ba..3d565c2b 100644--- a/src/components/create/experimental/ReferenceStrip.tsx+++ b/src/components/create/experimental/ReferenceStrip.tsx@@ -73,7 +73,9 @@ export function ReferenceStrip() {// Mac's own engine keeps its canvas, only the images shrink there, so it// says nothing. Qwen-Image-Edit (two slots) cannot shrink them: past the// card it is refused at Create, and the strip says so first.- const comfyLane = !cloud && !macEngine+ // Only an edit shrinks its images; a reference video model (MiniMax H3+ // ref2va, B38) scales its references itself.+ const comfyLane = !cloud && !macEngine && intent === 'edit'const shrinks = comfyLane && slots > 2 && 1 + shown.length > comfyEditFullImages(cardGb)const overCard = comfyLane && slots === 2 ? qwenEditPlusOverCard(1 + Math.min(shown.length, slots), cardGb) : nulldiff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsxindex 1ac6c09b..12b530a8 100644--- a/src/components/create/experimental/Stage.tsx+++ b/src/components/create/experimental/Stage.tsx@@ -29,6 +29,7 @@ import { getVideoBundles } from '../../../api/discover'import { lipsyncFitLine } from './lipsyncFit'import { useGraphicsCardGb } from '../../../hooks/useGraphicsMemory'import { ReferenceStrip } from './ReferenceStrip'+import { EndImageSlot, ImageReferenceStrip, useImageReferenceSupport } from './FrameRefs'import { FitStage, FIT_SIDE_FROM } from './FitStage'import { BatchStrip, UseOriginalButton, useBatchPickers } from './BatchStrip'import { addBatchFiles, useBatchOffered, useBatchOriginalOffer } from './batchRun'@@ -136,6 +137,12 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu// source was loaded — otherwise an older gallery item would hijack the stage.const freshResult = displayed && displayed.createdAt >= sourceSetAt+ // B45: the Image tab's references stand beside a result too, where the+ // model reads them or some are kept, so the next run shows what it uses.+ const imageRefCount = useCreateStore((s) => s.imageReferences.length)+ const imageRefSlots = useImageReferenceSupport().slots+ const imageRefSide = intent === 'image' && (imageRefSlots > 0 || imageRefCount > 0)+const characterTab = useCreateStore((s) => s.characterTab)const characterTrain = intent === 'character' && characterTab === 'train'// The example chips of Music are style descriptions. Where the prompt of a@@ -197,7 +204,7 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResuonSaveCharacter={displayed.type === 'video' && onSaveCharacter ? () => onSaveCharacter(displayed) : undefined}// The source and its references stay on screen beside the result// (FitStage), so the next run shows what it starts from.- side={meta.needsSource && source ? <ResultInputs /> : undefined}+ side={meta.needsSource && source ? <ResultInputs /> : imageRefSide ? <ImageReferenceStrip /> : undefined}/>)} else {@@ -227,6 +234,7 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu))}</div>)}+ {intent === 'image' && <ImageReferenceStrip />}{/* How it works: the cloud tabs only, the films show the cloud. */}{howtoTopic && (<div className="pt-1">@@ -527,6 +535,7 @@ function SourcePreview({ onOpenMaskEditor }: { onOpenMaskEditor: () => void }) {const controls = (<><ReferenceStrip />+ <EndImageSlot />{!batchOn && (<div className="flex items-center gap-2 mt-4">{meta.allowsMask && !noMask && (@@ -603,6 +612,7 @@ function ResultInputs() {</div></div><ReferenceStrip />+ <EndImageSlot /><BatchStrip /></div>)diff --git a/src/components/create/experimental/__tests__/end-image-and-image-references-show-where-they-work.test.tsx b/src/components/create/experimental/__tests__/end-image-and-image-references-show-where-they-work.test.tsxnew file mode 100644index 00000000..9dc48413--- /dev/null+++ b/src/components/create/experimental/__tests__/end-image-and-image-references-show-where-they-work.test.tsx@@ -0,0 +1,119 @@+// @vitest-environment jsdom+/**+ * B38 and B45 on the Stage: the end image slot of Animate and the reference+ * images of the Image tab show where the model on screen reads them. Where+ * it does not, a line says so and names the models that do, and an image+ * kept from an earlier model is marked "not sent".+ *+ * Run: npx vitest run src/components/create/experimental/__tests__/end-image-and-image-references-show-where-they-work.test.tsx+ */+import { describe, expect, it, beforeEach, vi } from 'vitest'+import { cleanup, render, screen } from '@testing-library/react'++// The cloud catalog is not loaded in a unit test, so the Animate pick is the+// stored one (the real resolution is studioPickFor's own tests).+vi.mock('../../../../lib/render/create-studio', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../../../../lib/render/create-studio')>()+ return { ...actual, studioPickFor: (_: string, s: { cloudVideoModel: string }) => s.cloudVideoModel || undefined }+})+import { EndImageSlot, ImageReferenceStrip } from '../FrameRefs'+import { ReferenceStrip } from '../ReferenceStrip'+import { useCreateStore } from '../../../../stores/createStore'++const PIC = { filename: 'p.png', url: 'data:image/png;base64,p', width: 8, height: 8 }+const A14B = 'wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors'+const TI2V = 'wan2.2_ti2v_5B_fp16.safetensors'+const REF2VA = 'minimax_h3_ref2va_pruned_int8_convrot.safetensors'++function animateWith(model: string, type: string) {+ useCreateStore.setState({ backend: 'local', videoModel: model, videoModelList: [{ name: model, type }] as never, endImage: null, references: [] })+ useCreateStore.getState().setIntent('animate')+ useCreateStore.getState().setSource(PIC)+}+function imageWith(model: string, type: string) {+ useCreateStore.setState({ backend: 'local', imageModel: model, imageModelList: [{ name: model, type }] as never, imageReferences: [] })+ useCreateStore.getState().setIntent('image')+}++beforeEach(() => cleanup())++describe('Animate: end image', () => {+ it('offered for Wan 2.2 14B i2v', () => {+ animateWith(A14B, 'wan')+ render(<EndImageSlot />)+ expect(screen.getByTestId('end-image-add')).toBeTruthy()+ expect(screen.getByTestId('end-image-line').textContent).toContain('the picture the clip should end on')+ })+ it('the TI2V-5B says it starts from one image and which models take an end image', () => {+ animateWith(TI2V, 'wan22')+ render(<EndImageSlot />)+ expect(screen.queryByTestId('end-image-add')).toBeNull()+ expect(screen.getByTestId('end-image-unsupported').textContent).toContain('Wan 2.2 14B i2v')+ })+ it('an end image kept from another model is marked not sent', () => {+ animateWith(TI2V, 'wan22')+ useCreateStore.setState({ endImage: PIC })+ render(<EndImageSlot />)+ expect(screen.getByTestId('end-image-slot').querySelector('[data-not-sent="true"]')).toBeTruthy()+ expect(screen.getByTestId('end-image-line').textContent).toContain('not sent')+ })+ it('LU Cloud: Wan 3.0 takes one, Wan 3.0 Reference does not', () => {+ animateWith(A14B, 'wan')+ useCreateStore.setState({ backend: 'cloud', cloudVideoModel: 'wan-3.0' })+ render(<EndImageSlot />)+ expect(screen.getByTestId('end-image-add')).toBeTruthy()+ cleanup()+ useCreateStore.setState({ cloudVideoModel: 'wan-3.0-ref' })+ render(<EndImageSlot />)+ expect(screen.getByTestId('end-image-unsupported').textContent).toContain('Wan 3.0, Seedance 2.5, LTX 2.5 and MiniMax H3')+ })+ it('a removed start image takes the end image with it', () => {+ animateWith(A14B, 'wan')+ useCreateStore.setState({ endImage: PIC })+ useCreateStore.getState().setSource(null)+ expect(useCreateStore.getState().endImage).toBeNull()+ })+})++describe('Animate: several references with MiniMax H3 ref2va', () => {+ it('the reference strip opens with eight more slots', () => {+ animateWith(REF2VA, 'minimaxh3')+ render(<ReferenceStrip />)+ expect(screen.getByTestId('reference-strip-names').textContent).toContain('Add up to 8 more images')+ })+})++describe('Image tab: reference images', () => {+ it('Krea 2 says it takes the style, not pose or angle', () => {+ imageWith('krea2_turbo_int8_convrot.safetensors', 'krea2')+ render(<ImageReferenceStrip />)+ expect(screen.getByTestId('image-reference-add')).toBeTruthy()+ expect(screen.getByTestId('image-references-line').textContent).toMatch(/style.*not the pose or camera angle/)+ })+ it('Qwen-Image 2.1 offers ten', () => {+ imageWith('qwen_image_2.1_int8_convrot.safetensors', 'qwenimage')+ useCreateStore.setState({ imageReferences: Array.from({ length: 9 }, () => PIC) })+ render(<ImageReferenceStrip />)+ expect(screen.getByTestId('image-reference-add')).toBeTruthy()+ cleanup()+ useCreateStore.setState({ imageReferences: Array.from({ length: 10 }, () => PIC) })+ render(<ImageReferenceStrip />)+ expect(screen.queryByTestId('image-reference-add')).toBeNull()+ })+ it('SDXL: the honest line, and kept images are marked not sent', () => {+ imageWith('juggernautXL_v9.safetensors', 'sdxl')+ render(<ImageReferenceStrip />)+ expect(screen.getByTestId('image-references-unsupported')).toBeTruthy()+ cleanup()+ useCreateStore.setState({ imageReferences: [PIC] })+ render(<ImageReferenceStrip />)+ expect(screen.getByTestId('image-references').querySelector('[data-not-sent="true"]')).toBeTruthy()+ expect(screen.getByTestId('image-references-line').textContent).toContain('Krea 2 (style), Qwen-Image 2.1 and FLUX.2')+ })+ it('LU Cloud points to Edit', () => {+ imageWith('krea2_turbo_int8_convrot.safetensors', 'krea2')+ useCreateStore.setState({ backend: 'cloud', imageReferences: [PIC] })+ render(<ImageReferenceStrip />)+ expect(screen.getByTestId('image-references-line').textContent).toContain('use Edit')+ })+})diff --git a/src/components/create/experimental/__tests__/fit-stage-height.test.ts b/src/components/create/experimental/__tests__/fit-stage-height.test.tsindex d49da448..1a5f0b0d 100644--- a/src/components/create/experimental/__tests__/fit-stage-height.test.ts+++ b/src/components/create/experimental/__tests__/fit-stage-height.test.ts@@ -40,7 +40,8 @@ describe('who uses it', () => {it('the source preview and the result of a source tool, on every platform', () => {const stage = source('Stage.tsx')expect(stage).toContain('return <FitStage picture={picture} side={controls} capVh={52} onDragOver={onDragOver} onDrop={onDrop} />')- expect(stage).toContain('side={meta.needsSource && source ? <ResultInputs /> : undefined}')+ // B45: the Image tab hands the result its reference images as the side.+ expect(stage).toContain('side={meta.needsSource && source ? <ResultInputs /> : imageRefSide ? <ImageReferenceStrip /> : undefined}')// No host is asked, and the column that scrolled is gone.expect(stage).not.toMatch(/isMlxImageHost\(\)[^\n]*FitStage|FitStage[^\n]*isMlxImageHost\(\)/)expect(stage).not.toContain('ResultSourceActions')diff --git a/src/components/create/experimental/referenceSlots.ts b/src/components/create/experimental/referenceSlots.tsindex 19bb2896..1b5e7964 100644--- a/src/components/create/experimental/referenceSlots.ts+++ b/src/components/create/experimental/referenceSlots.ts@@ -10,6 +10,8 @@ import { getSharedMemoryGb } from '../../../lib/hardware'import { laneImageModel } from '../../../lib/image-engines'import { macEditReferenceRoom } from '../../../lib/mac-edit-memory'import { referenceModel, studioExtraPhotoSlots } from '../../../lib/render/create-studio'+import { isMlxImageHost } from '../../../api/mlx-image'+import { laneVideoModel, localAnimateReferenceSlots } from '../../../lib/frame-refs'export function useReferenceSlots(): number {const backend = useCreateStore((s) => s.backend)@@ -22,13 +24,18 @@ export function useReferenceSlots(): number {const cloudImageModel = useCreateStore((s) => s.cloudImageModel)const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)const cloudOpModel = useCreateStore((s) => s.cloudOpModel)+ const localAnimateModel = useCreateStore((s) => laneVideoModel(s.videoModelList, s.videoModel, 'animate'))// The type from the fetched list carries the header sniff; the name is the// fallback, exactly as useCreate decides the pipeline.if (backend === 'cloud') {const pick = referenceModel(intent, { cloudImageModel, cloudVideoModel, cloudOpModel })return pick ? studioExtraPhotoSlots(pick) : 0}- return intent === 'edit' ? extraReferenceSlots(listedType ?? classifyModel(imageModel), imageModel) : 0+ return intent === 'edit' ? extraReferenceSlots(listedType ?? classifyModel(imageModel), imageModel)+ // B38: a local reference video model that reads several pictures (MiniMax+ // H3 ref2va). The Mac's own video engine reads one.+ : intent === 'animate' && !isMlxImageHost() ? localAnimateReferenceSlots(localAnimateModel)+ : 0}/** The memory of this Mac, read once for every strip. */diff --git a/src/hooks/__tests__/useCloudCreate-endbild.test.ts b/src/hooks/__tests__/useCloudCreate-endbild.test.tsnew file mode 100644index 00000000..eacbb436--- /dev/null+++ b/src/hooks/__tests__/useCloudCreate-endbild.test.ts@@ -0,0 +1,149 @@+/**+ * B38 (Discord 30.10.2026, thirdorbital): Animate in LU Cloud mit Start- UND+ * Endbild. Die Studio-Modelle mit last_image im Anbieter-Schema (Wan 3.0,+ * Seedance 2.5, LTX 2.5, MiniMax H3) bekommen das Endbild als+ * last_image_path, eigener Upload. Ein Modell ohne dieses Feld bekommt es nie.+ *+ * Nichts wird erzeugt: Absenden, Hochladen und Preisbestaetigung sind gemockt+ * (dieselbe Vorrichtung wie useCloudCreate-mehrere-bilder.test.ts).+ */+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 }+})++type Payload = { kind: string; model: string; prompt: string; params: Record<string, unknown> }+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 FakeQuoteChanged extends FakeCloudJobError {+ credits: number+ constructor(message: string, credits: number) {+ super(message, 409, { code: 'quote_changed' })+ this.credits = credits+ }+ }+ const plan = {+ booked: undefined as number | undefined,+ stopped: undefined as 'credits_exhausted' | 'error' | undefined,+ oldServer: false,+ outcome: {} as Record<string, 'succeeded' | 'failed'>,+ upload: 0,+ cancel409: new Set<string>(),+ }+ return {+ FakeCloudJobError,+ FakeQuoteChanged,+ plan,+ submitted: [] as Payload[],+ abgebrochen: [] as string[],+ hochgeladen: [] as string[],+ quote: vi.fn(async (..._a: unknown[]) => ({ credits: 5000 })),+ }+})+const { submitted, abgebrochen, hochgeladen, plan } = hoisted++vi.mock('../useContentPolicy', () => ({+ contentPolicySnapshot: () => 'off' as const,+ loadContentPolicy: async () => 'off' as const,+}))+vi.mock('../../api/cloud/jobs', () => ({+ uploadInput: vi.fn(async (_b: unknown, slot: string) => { hochgeladen.push(slot); return `user-1/staged-${slot}-${++plan.upload}.png` }),+ getJob: vi.fn(),+ cancelJob: vi.fn(async (id: string) => {+ if (plan.cancel409.has(id)) throw new hoisted.FakeCloudJobError('running', 409)+ abgebrochen.push(id)+ return { status: 'canceled' }+ }),+ submitCloudJob: vi.fn(async (payload: Payload) => {+ submitted.push(payload)+ const asked = (payload.params.count as number | undefined) ?? 1+ const booked = plan.booked ?? asked+ const ids = Array.from({ length: booked }, (_, i) => `job-${i}`)+ if (asked === 1 || plan.oldServer) return { id: ids[0], quota: { cost: 300 } }+ return {+ id: ids[0], quota: { cost: 300 },+ jobs: ids.map((id) => ({ id, status: 'queued', cost: 300 })), requested: asked,+ ...(plan.stopped ? { stopped: plan.stopped } : {}),+ }+ }),+ pollJob: vi.fn(async (id: string) => {+ const status = plan.outcome[id] ?? 'succeeded'+ return {+ id, kind: 'image', model: 'flux-schnell', status,+ result_url: status === 'succeeded' ? `https://storage.example/${id}.png` : null,+ error: status === 'failed' ? 'provider said no' : null,+ created_at: new Date().toISOString(), params: {},+ }+ }),+ CloudJobError: hoisted.FakeCloudJobError,+ QuoteChangedError: hoisted.FakeQuoteChanged,+}))+vi.mock('../../api/cloud/studio', () => ({+ studioQuote: hoisted.quote,+ StudioQuoteChangedError: hoisted.FakeQuoteChanged,+}))++import { useCloudCreate } from '../useCloudCreate'+import { useCreateStore } from '../../stores/createStore'+import { useCloudCatalogStore } from '../../stores/cloudCatalogStore'+import { neuerServer } from '../../lib/render/__tests__/fixtures/test-catalogs'++const BILD = { filename: 'a.png', url: 'data:image/png;base64,AA', width: 512, height: 512 }++beforeEach(() => {+ submitted.length = 0; abgebrochen.length = 0; hochgeladen.length = 0+ plan.booked = undefined; plan.stopped = undefined; plan.oldServer = false; plan.outcome = {}; plan.upload = 0; plan.cancel409.clear()+ hoisted.quote.mockClear()+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, blob: async () => new Blob(['x']) })))+ useCreateStore.setState({+ isGenerating: false, error: null, backend: 'cloud', source: null, mask: null, references: [],+ gallery: [], cloudStudioOptions: {}, cloudStudioCredits: null, cloudImageCount: 1,+ })+ useCreateStore.getState().setPrompt('a neutral placeholder line')+ useCloudCatalogStore.setState({ models: neuerServer() })+})++const ENDE = { filename: 'z.png', url: 'data:image/png;base64,ZZ', width: 512, height: 512 }++describe('Animate mit Endbild', () => {+ it('Wan 3.0 bekommt Start- und Endbild, das Endbild als eigener Upload', async () => {+ const s = useCreateStore.getState()+ s.setIntent('animate'); s.setCloudVideoModel('wan-3.0')+ useCreateStore.setState({ source: BILD, endImage: ENDE })+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toBeNull()+ expect(submitted[0].model).toBe('wan-3.0')+ expect(submitted[0].params.source_path).toBe('user-1/staged-source-1.png')+ expect(submitted[0].params.last_image_path).toBe('user-1/staged-source-2.png')+ expect(hochgeladen).toHaveLength(2)+ // Die bestaetigte Zahl kennt das Endbild auch.+ expect((hoisted.quote.mock.calls[0][2] as { last_image_path?: string }).last_image_path).toBe('user-1/staged-source-2.png')+ })++ it('ohne Endbild bleibt es beim Startbild (Rueckfall-Waechter)', async () => {+ const s = useCreateStore.getState()+ s.setIntent('animate'); s.setCloudVideoModel('wan-3.0')+ useCreateStore.setState({ source: BILD, endImage: null })+ await useCloudCreate().generate()+ expect(submitted[0].params.last_image_path).toBeUndefined()+ expect(hochgeladen).toHaveLength(1)+ })++ it('ein Referenzmodell ohne last_image bekommt kein Endbild', async () => {+ const s = useCreateStore.getState()+ s.setIntent('animate'); s.setCloudVideoModel('minimax-h3-ref')+ useCreateStore.setState({ source: BILD, endImage: ENDE, references: [] })+ await useCloudCreate().generate()+ expect(submitted[0].params.last_image_path).toBeUndefined()+ })+})diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.tsindex d9f3e9c5..492303c0 100644--- a/src/hooks/useCloudCreate.ts+++ b/src/hooks/useCloudCreate.ts@@ -544,6 +544,13 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {params.image_paths = [params.source_path, ...more]}if (!reads.includes('source_path')) delete params.source_path+ // B38: an end image for a Studio model that reads one+ // (last_image_path). The Stage shows the slot only for those.+ if (intent === 'animate' && s.endImage && reads.includes('last_image_path')) {+ if (ac.signal.aborted) return+ s.setProgress(7, 'Uploading the end image…')+ params.last_image_path = await uploadInput(dataUrlToBlob(s.endImage.url), 'source', ...uploadEnds(ac))+ }}}if ((op === 'edit' && !editIsMaskless) || op === 'eraser') {diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.tsindex 733b118f..1be2e5c0 100644--- a/src/hooks/useCreate.ts+++ b/src/hooks/useCreate.ts@@ -84,6 +84,7 @@ import { enhancerNames, pickQwenEnhancer, rewrittenByName, type ImproveWriter }import { buildQwenEnhancerWorkflow, runQwenEnhancer } from '../api/qwen-enhancer'import { enhancePromptOnMac } from '../api/mlx-enhancer'import { extraReferenceSlots, referenceSide } from '../lib/edit-references'+import { END_IMAGE_ONE_CLIP, createReferenceSupport, localAnimateReferenceSlots, localEndFrame } from '../lib/frame-refs'import { canonicalImageRefs } from '../lib/image-ref-names'import { macEditReferenceRoom } from '../lib/mac-edit-memory'import { getSharedMemoryGb } from '../lib/hardware'@@ -1610,6 +1611,23 @@ export function useCreate() {const listedModel = (mode === 'image' ? state.imageModelList : state.videoModelList).find((m) => m.name === activeModel)const imageModelType = localOp ? classifyModel(activeModel) : (listedModel?.type ?? classifyModel(activeModel))+ // B38: Animate hands the builder an end image and further references only+ // for a model that reads them (lib/frame-refs). The Stage marks the ones+ // a model does not read as not sent, so nothing is dropped unseen.+ const animateSlots = intent === 'animate' ? localAnimateReferenceSlots(activeModel) : 0+ const animateExtras = intent === 'animate'+ ? {+ ...(state.endImage?.filename && localEndFrame(activeModel) ? { endImage: state.endImage.filename } : {}),+ ...(animateSlots > 0 && references.some((r) => r.filename)+ ? { referenceImages: references.map((r) => r.filename).filter(Boolean).slice(0, animateSlots) }+ : {}),+ }+ : {}+ // B45: reference images for text to image, as many as the model reads.+ const createRefSlots = intent === 'image' && !isI2I ? createReferenceSupport(imageModelType, activeModel).slots : 0+ const createRefNames = createRefSlots > 0+ ? state.imageReferences.map((r) => r.filename).filter(Boolean).slice(0, createRefSlots)+ : []// Background removal is prompt-free and model-independent (RMBG node);// lipsync/motion drive off their media inputs (the builder supplies a@@ -1824,6 +1842,7 @@ export function useCreate() {...(isI2I && !isRemoveBg && effInputImage && references.some((r) => r.filename)? { referenceImages: references.map((r) => r.filename).filter(Boolean) }: {}),+ ...(createRefNames.length > 0 ? { referenceImages: createRefNames } : {}),...(!isRemoveBg && maskFilename ? { maskImage: maskFilename, growMaskBy } : {}),// Advanced adjustments. LoRA feeds the builder's `lora`/`loraStrength`// contract (string[] + number[]); the old `loras` key was read by nobody,@@ -1952,7 +1971,7 @@ export function useCreate() {if (customWf) {builderUsed = 'custom'setProgress(5, `Using workflow: ${customWf.name}...`)- const params = mode === 'video' ? { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}) } : baseParams+ const params = mode === 'video' ? { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}), ...animateExtras } : baseParams// The values changed under "Workflow parameters" go in last (GitHub wish #8).const overrides = useWorkflowStore.getState().paramOverrides[customWf.id]workflow = await injectParameters(customWf.workflow, customWf.parameterMap, params, imageModelType, overrides)@@ -1960,7 +1979,7 @@ export function useCreate() {// Dynamic workflow builder — auto-detects nodes and builds the right pipelinesetProgress(5, 'Building workflow...')try {- const genParams = mode === 'video' ? { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}), ...longVideoParams(opts) } : baseParams+ const genParams = mode === 'video' ? { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}), ...animateExtras, ...longVideoParams(opts) } : baseParams// A missing text encoder / VAE or a too-old ComfyUI is fixed in// place after one question, then the build runs again.workflow = await buildWithFixups(@@ -2050,7 +2069,7 @@ export function useCreate() {return}// Re-build the workflow now that the new node is available- const genParams = { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}), ...longVideoParams(opts) }+ const genParams = { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}), ...animateExtras, ...longVideoParams(opts) }workflow = await buildDynamicWorkflow(genParams, imageModelType)setProgress(10, 'VHS installed, generating MP4...')} catch (instErr) {@@ -2563,6 +2582,12 @@ export function useCreate() {fps: s.fps, frames: s.frames, extendClip: s.extendClip,})if (long?.kind === 'error') { s.setError(long.message); return }+ // B38: a clip in sections would end its FIRST section on the end+ // image. Said instead of done wrong.+ if (long && intent === 'animate' && s.endImage && localEndFrame(model)) {+ s.setError(END_IMAGE_ONE_CLIP)+ return+ }if (long?.kind === 'one-pass') { await runOnce({ frames: long.frames }, { contextWindows: true }); return }if (long?.kind === 'sections') {const own = new AbortController()diff --git a/src/lib/frame-refs.ts b/src/lib/frame-refs.tsnew file mode 100644index 00000000..c6bb7504--- /dev/null+++ b/src/lib/frame-refs.ts@@ -0,0 +1,110 @@+// Which model takes what besides the one start image (B38, B45, 3.0.9).+//+// Discord 29.10. and 30.10.2026: Animate should take more than one picture+// (several references, a start and an end image), and Create should take+// reference images for style, pose and camera angle, above all with Krea 2.+// One reader for the picker lines, the Stage, the builder and the submit+// guard, so none of them offers what another refuses.+//+// Read off the node schemas of ComfyUI master b5a43215 (30.10.2026) and the+// official Comfy-Org templates (workflow_templates abb9cf64):+// - WanFirstLastFrameToVideo takes start_image and end_image. The templates+// run it with the Wan 2.2 A14B i2v pair (video_wan2_2_14B_flf2v) and the+// Wan 2.1 FLF2V 14B file (wan2.1_flf2v_720_f16). The TI2V-5B goes through+// Wan22ImageToVideoLatent, which has a start_image only.+// - MiniMaxH3ImageToVideo (fl2va) takes first_frame and last_frame;+// MiniMaxH3ReferenceToVideo (ref2va) takes ref_image_0 to ref_image_8.+// - WanVaceToVideo reads reference_image[:1], one picture only.+// - Krea 2 reads reference latents. The template+// image_krea2_turbo_int8_image_style_reference runs them through+// TextEncodeQwenImageEditPlus (image1 to image3) with the Comfy-Org LoRA+// krea2_style_reference: a STYLE reference, not pose or angle.+// - TextEncodeQwenImage21 has the reference slots image_1 to image_16.+// - FLUX.2 chains ReferenceLatent (image_flux2, the Klein edit templates).+import { classifyModel, isFastH3, isWan22A14B, videoLaneModels, type ClassifiedModel, type ModelType } from '../api/comfyui'+import { MAX_EXTRA_REFERENCES } from './edit-references'++/** Can the local graph of this video model take an end image as well? */+export function localEndFrame(model: string | null | undefined): boolean {+ if (!model) return false+ const lower = model.toLowerCase()+ const type = classifyModel(model)+ if (type === 'minimaxh3') return !isFastH3(lower) && !/ref2va/.test(lower)+ if (type !== 'wan') return false+ if (/(^|[^a-z0-9])fl?f2v([^a-z0-9]|$)/.test(lower)) return true+ return isWan22A14B(lower) && /(^|[^a-z])i2v([^a-z]|$)/.test(lower)+}++/** The line Animate shows where a local model takes the start image only. */+export const LOCAL_END_FRAME_MODELS = 'An end image works with Wan 2.2 14B i2v, Wan 2.1 FLF2V and MiniMax H3 here, and in LU Cloud with Wan 3.0, Seedance 2.5, LTX 2.5 and MiniMax H3.'++/** A long clip is made in sections (B18), and only one clip can end on the+ * end image. */+export const END_IMAGE_ONE_CLIP = 'An end image works for one clip up to the model\'s own length. Set the length back to one clip, or remove the end image.'++/** How many further pictures a LOCAL Animate model reads besides the one on+ * the Stage. MiniMax H3 ref2va reads nine references in all. VACE reads+ * one, the picture on the Stage, so it takes no further ones. */+export function localAnimateReferenceSlots(model: string | null | undefined): number {+ if (!model) return 0+ if (classifyModel(model) === 'minimaxh3' && !isFastH3(model) && /ref2va/i.test(model)) return 8+ return 0+}++/** What a reference image does for a local Create (text to image) model. */+export type CreateReferenceKind = 'style' | 'content'++export interface CreateReferenceSupport {+ /** How many reference images the model reads. 0: none. */+ slots: number+ kind?: CreateReferenceKind+}++/** The most references LU hands FLUX.2 in one run. Each one is encoded at+ * about a megapixel and joins the sequence, so on a 12 GB card four is+ * already a lot. */+export const FLUX2_MAX_REFERENCES = 4+/** TextEncodeQwenImageEditPlus has image1 to image3. */+export const KREA2_MAX_REFERENCES = 3++/** Reference images for Create (text to image) on the local lane. */+export function createReferenceSupport(type: ModelType | null | undefined, model: string | null | undefined): CreateReferenceSupport {+ const t = type ?? (model ? classifyModel(model) : null)+ if (t === 'krea2') return { slots: KREA2_MAX_REFERENCES, kind: 'style' }+ if (t === 'qwenimage') return { slots: MAX_EXTRA_REFERENCES + 1, kind: 'content' }+ if (t === 'flux2') return { slots: FLUX2_MAX_REFERENCES, kind: 'content' }+ return { slots: 0 }+}++/** The honest line where the model on screen takes no reference image. */+export const CREATE_REFERENCE_MODELS = 'Reference images work with Krea 2 (style), Qwen-Image 2.1 and FLUX.2 (style, pose, camera angle, people). This model makes the picture from the prompt alone.'++/** The line over the reference tiles. */+export function createReferenceLine(kind: CreateReferenceKind | undefined, count: number): string {+ if (kind === 'style') {+ return 'Krea 2 takes the style of these images (colours, brushwork, mood), not the pose or camera angle. It needs the free Krea 2 style reference LoRA (436 MB), which Create offers to download on the first run.'+ }+ return count > 0+ ? `Name them in the prompt as ${count === 1 ? 'image 1' : count === 2 ? 'image 1 and image 2' : `image 1 to image ${count}`}, for example "the pose of image 1, the jacket from image 2".`+ : 'Add images for the style, the pose, the camera angle or a person, and say in the prompt what to take from each.'+}++/** The official style reference LoRA of the Krea 2 template, from the+ * Comfy-Org repack (Hugging Face Comfy-Org/Krea-2, not gated,+ * krea-2-community-license). Size and sha256 as the Hugging Face tree API+ * states them on 30.10.2026. */+export const KREA2_STYLE_LORA = {+ filename: 'krea2_style_reference.safetensors',+ url: 'https://huggingface.co/Comfy-Org/Krea-2/resolve/main/loras/krea2_style_reference.safetensors',+ sizeBytes: 457111760,+ sha256: 'f50df5a9e62e4be8aa926a63dd5bb1a64770c4004f763c1208007ae13daa82b8',+} as const++/** The video model a local run of `intent` actually uses: the stored pick+ * where the lane can run it, else the first one it can (useCreate does the+ * same before it builds). */+export function laneVideoModel(list: ClassifiedModel[], stored: string, intent: string): string {+ if (list.length === 0) return stored+ const lane = videoLaneModels(list, intent)+ return lane.some((m) => m.name === stored) ? stored : (lane[0]?.name ?? stored)+}diff --git a/src/lib/image-ref-names.ts b/src/lib/image-ref-names.tsindex 4e3d1663..bcfa513b 100644--- a/src/lib/image-ref-names.ts+++ b/src/lib/image-ref-names.ts@@ -11,16 +11,18 @@// as `<image1>`, `<image2>`.// - Qwen-Image-Edit 2509/2511 (TextEncodeQwenImageEditPlus) labels them// "Picture 1: ", "Picture 2: ".+// - MiniMax H3 ref2va (MiniMaxH3ReferenceToVideo, B38) asks the prompt for+// "<Picture 1>", "<Picture 2>", the tags its node description names.// So right before the graph is built, every way a user writes the number of// an image that is really there is rewritten to the label the encoder put in// front of it. The prompt the user typed, in the history and the gallery,// stays as typed.-export type ImageRefStyle = 'qwen21' | 'qwenEditPlus'+export type ImageRefStyle = 'qwen21' | 'qwenEditPlus' | 'minimaxH3'/** The label an encoder puts in front of image `n` (1 is the source). */export function canonicalImageRef(n: number, style: ImageRefStyle): string {- return style === 'qwen21' ? `<image${n}>` : `Picture ${n}`+ return style === 'qwen21' ? `<image${n}>` : style === 'minimaxH3' ? `<Picture ${n}>` : `Picture ${n}`}// A word that names an image, then the number, in any case:diff --git a/src/lib/render/create-studio.ts b/src/lib/render/create-studio.tsindex d5d47f67..44e47578 100644--- a/src/lib/render/create-studio.ts+++ b/src/lib/render/create-studio.ts@@ -184,6 +184,13 @@ export function studioPhotoCap(model: string): number {return Math.min(studioSchema(model).properties?.[field]?.maxItems ?? 1, MAX_STUDIO_PHOTOS)}+/** Liest dieses Studio-Modell ein Endbild (last_image_path)? Animate bietet+ * dann neben dem Startbild ein zweites Feld an (B38, Discord 30.10.2026). */+export function studioReadsEndImage(model: string | null | undefined): boolean {+ if (!model) return false+ return Object.values(STUDIO_MODELS[model]?.inputs ?? {}).includes('last_image_path')+}+/** Wie viele WEITERE Fotos neben dem Standbild die Referenzleiste fuer dieses* Modell anbietet. */export function studioExtraPhotoSlots(model: string): number {diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex cca4e925..e319e3af 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -22,7 +22,7 @@ import { cleanFolderName, newFolderId, sanitizeFolders, FOLDER_CAP, type Gallery* results, the in-flight flag). Everything else in the blob is a preference.*/const RUNTIME_ONLY_KEYS: readonly string[] = [- 'backend', 'source', 'mask', 'references', 'caps', 'isGenerating', 'comfyCorsBlocked',+ 'backend', 'source', 'mask', 'references', 'endImage', 'imageReferences', 'caps', 'isGenerating', 'comfyCorsBlocked',// A queue of source images from yesterday must never start a run today.'batchSources', 'batchRun', 'batchOriginal',// Ein gespeicherter Preis von gestern ist eine Luege (siehe partialize@@ -473,6 +473,14 @@ export interface CreateState {/** Edit: further reference images after the source, for a model that takes* them (lib/edit-references). Runtime-only like `source`; cleared with it. */references: ImageRef[]+ /** Animate: the picture the clip ends on (B38), for a model that takes+ * one (lib/frame-refs, studioReadsEndImage). Runtime-only like `source`;+ * cleared with it. */+ endImage: ImageRef | null+ /** Image (text to image): reference images for style, pose and camera+ * angle (B45), for a model that reads them (lib/frame-refs). Runtime-only,+ * kept apart from the Edit references. */+ imageReferences: ImageRef[]/** Several source images, one edit (lib/batch-edit): the files that get the* same run, one after the other. Empty for a single image, else two or more,* and `source` shows the first. Runtime-only like `source`. */@@ -689,6 +697,9 @@ export interface CreateState {addReference: (img: ImageRef) => voidremoveReference: (index: number) => voidsetReferences: (refs: ImageRef[]) => void+ setEndImage: (img: ImageRef | null) => void+ addImageReference: (img: ImageRef) => void+ removeImageReference: (index: number) => voidsetBatchSources: (list: MediaRef[]) => voidsetBatchRun: (run: BatchRunState | null) => voidsetBatchOriginal: (img: ImageRef | null) => void@@ -1120,6 +1131,8 @@ export const useCreateStore = create<CreateState>()(growMaskBy: 6,source: null as ImageRef | null,references: [] as ImageRef[],+ endImage: null as ImageRef | null,+ imageReferences: [] as ImageRef[],batchSources: [] as MediaRef[],batchRun: null as BatchRunState | null,batchOriginal: null as ImageRef | null,@@ -1263,7 +1276,7 @@ export const useCreateStore = create<CreateState>()(// removebg/animate keep the source but drop a stale mask. Video/animate// mirror setMode's reset so image resolution never leaks into video.// A stale error from the previous intent never carries over.- const dropAll = { source: null, mask: null, sourceSetAt: 0, references: [] }+ const dropAll = { source: null, mask: null, sourceSetAt: 0, references: [], endImage: null }// Back from a tab that runs another model (the video tabs, Music), the// image lane gets its own values again; inside the image lane a switch// keeps what the user tuned. Music has mode 'image', so asking the mode@@ -1529,13 +1542,16 @@ export const useCreateStore = create<CreateState>()(setSource: (source) => {// The list of further source images goes with the image it belongs to.if (!source) get().setBatchSources([])- set({ source, sourceSetAt: source ? Date.now() : 0, ...(source ? {} : { mask: null, references: [] }) })+ set({ source, sourceSetAt: source ? Date.now() : 0, ...(source ? {} : { mask: null, references: [], endImage: null }) })},// Capped at the most any model takes, local or cloud (lib/edit-references);// the UI offers fewer for a model with fewer slots and the builder slices.addReference: (img) => set((s) => ({ references: [...s.references, img].slice(0, MAX_STORED_REFERENCES) })),removeReference: (index) => set((s) => ({ references: s.references.filter((_, i) => i !== index) })),setReferences: (references) => set({ references }),+ setEndImage: (endImage) => set({ endImage }),+ addImageReference: (img) => set((s) => ({ imageReferences: [...s.imageReferences, img].slice(0, MAX_STORED_REFERENCES + 1) })),+ removeImageReference: (index) => set((s) => ({ imageReferences: s.imageReferences.filter((_, i) => i !== index) })),setBatchSources: (batchSources) => {releaseDroppedMediaRefs(get().batchSources, batchSources)set({ batchSources })