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): eigener Bildsatz fuer offene Editoren im Swap (Port des Web-Stands)
purple7eeb7a0e5beb
diff --git a/src/lib/create/__tests__/swap-chain.test.ts b/src/lib/create/__tests__/swap-chain.test.tsindex b4e829f0..ef3f0732 100644--- a/src/lib/create/__tests__/swap-chain.test.ts+++ b/src/lib/create/__tests__/swap-chain.test.ts@@ -259,6 +259,9 @@ describe('the filtered editor refuses', () => {await retrySwapOpen(f.deps)expect(f.submits[1].model).toBe('qwen-image-2.1-edit')expect(params(f.submits[1]).max_credits).toBe(swapFrameCredits(1280, 720, 2, 'qwen-image-2.1-edit'))+ // The open editor gets its own sentence: the photos are only face references.+ expect(f.submits[0].prompt).toMatch(/^In the first image, replace/)+ expect(f.submits[1].prompt).toMatch(/^The first image is a frame from a video and is the base image\./)expect(swapChainStore.getState().chain!.stage).toBe('done')})diff --git a/src/lib/create/__tests__/swap-open-prompt.test.ts b/src/lib/create/__tests__/swap-open-prompt.test.tsnew file mode 100644index 00000000..9c803aaa--- /dev/null+++ b/src/lib/create/__tests__/swap-open-prompt.test.ts@@ -0,0 +1,69 @@+/**+ * The sentence of the frame step for open editors (real test of 14.11.2026,+ * port of the web's swap-open-prompt.test.ts): the photos are only face+ * references, the first image stays the base. The two person text must match+ * the real test exactly. And "Check first frame" follows "Uncensored".+ */+import { describe, expect, it, beforeEach } from 'vitest'+import { swapFramePrompt, SWAP_FRAME_MODEL, SWAP_FRAME_OPEN_MODEL } from '../../render/swap'+import { swapFrameSubmit } from '../swap-frame'+import { useSwapOneClick } from '../swap-one-click'++// Real test 14.11.2026: exactly this sentence ran with Qwen Image 2.1 Edit.+const V2 = "The first image is a frame from a video and is the base image. The second and third images are only face references: do not copy their clothing, body, pose, background or framing. Edit only the first image: give the person on the left the face and hair of the person from the second image, and give the person on the right the face and hair of the person from the third image. Keep the face identity and facial features of each new person exactly. Remove all of the original people's hair completely, even long hair. Keep every person in the first image exactly where they are, with the same body, pose, head angle, head size, hands, clothing, mouth position, lighting, colors, camera angle, framing, distance and background. No headsets, no microphones. Every other person stays unchanged. It must look like the same raw phone video frame, just with the other faces."++const req = (frameModel: string) => ({+ frame: { url: 'data:image/jpeg;base64,AA', width: 1280, height: 720 },+ figures: [+ { imageUrl: 'data:image/png;base64,AA', role: '', mark: { x: 0.3, y: 0.4 } },+ { imageUrl: 'data:image/png;base64,AA', role: '', mark: { x: 0.7, y: 0.4 } },+ ],+ model: '', consent: true, credits: 1000, frameModel,+})++describe('the frame sentence for open editors', () => {+ it('two people: exactly the sentence of the real test', () => {+ expect(swapFramePrompt(['the person on the left', 'the person on the right'], undefined, { open: true })).toBe(V2)+ })+ it('one person: the photo only as a face reference, the clothing stays', () => {+ const p = swapFramePrompt(['the person'], undefined, { open: true })+ expect(p).toContain('The second image is only a face reference')+ expect(p).toContain('give the person the face and hair of the person from the second image')+ expect(p).toContain('same body, pose')+ expect(p).toMatch(/other face\.$/)+ })+ it('three people count the images right', () => {+ const p = swapFramePrompt(['a', 'b', 'c'], undefined, { open: true })+ expect(p).toContain('The second, third and fourth images are only face references')+ expect(p).toContain('give c the face and hair of the person from the fourth image')+ })+ it("the customer's fix goes at the end", () => {+ expect(swapFramePrompt(['the person'], 'keep the cap', { open: true })).toMatch(/Fix this from the last attempt: keep the cap$/)+ })+ it('without open the Nano sentence stays as it was', () => {+ expect(swapFramePrompt(['the person'])).toContain('Replace the person in the first image')+ })+ it('the frame step sends the open sentence to every editor but Nano Banana Pro', () => {+ expect(swapFrameSubmit('f', ['a', 'b'], req(SWAP_FRAME_OPEN_MODEL)).prompt).toBe(V2)+ expect(swapFrameSubmit('f', ['a', 'b'], req(SWAP_FRAME_MODEL)).prompt).toMatch(/^In the first image, replace the person on the left/)+ })+})++describe('Check first frame follows Uncensored', () => {+ beforeEach(() => useSwapOneClick.setState({ openModels: false, check: false, checkTouched: false }))+ it('Uncensored on turns the check on, off turns it off again', () => {+ useSwapOneClick.getState().setOpenModels(true)+ expect(useSwapOneClick.getState().check).toBe(true)+ useSwapOneClick.getState().setOpenModels(false)+ expect(useSwapOneClick.getState().check).toBe(false)+ })+ it('filtered the check stays off', () => {+ expect(useSwapOneClick.getState().check).toBe(false)+ })+ it('set by hand it no longer follows', () => {+ useSwapOneClick.getState().setCheck(true)+ useSwapOneClick.getState().setOpenModels(true)+ useSwapOneClick.getState().setOpenModels(false)+ expect(useSwapOneClick.getState().check).toBe(true)+ })+})diff --git a/src/lib/create/swap-chain.ts b/src/lib/create/swap-chain.tsindex 2b6eab6d..35db6f19 100644--- a/src/lib/create/swap-chain.ts+++ b/src/lib/create/swap-chain.ts@@ -25,7 +25,7 @@ import { dataUrlToBlob } from '../render/data-url'import { lipsyncSubmit } from '../render/sound'import {swapFigureRoles, swapFrameFiltered, swapFrameMaxPeople, swapFrameOptionsFor, swapFramePrompt,- SWAP_CONSENT_MISSING, SWAP_FRAME_OPEN_MODEL, type SwapMark,+ SWAP_CONSENT_MISSING, SWAP_FRAME_MODEL, SWAP_FRAME_OPEN_MODEL, type SwapMark,} from '../render/swap'import { adoptResult, describeSubmitError, failedJobText, type RunDeps } from './engine'import { swapFrameCredits, swapFrameSubmit } from './swap-frame'@@ -367,7 +367,7 @@ export function retrySwapFrame(deps: SwapChainDeps, opts: { extra?: string; modeframeSubmit: {...s.frameSubmit,model,- prompt: swapFramePrompt(s.roles, opts.extra),+ prompt: swapFramePrompt(s.roles, opts.extra, { open: model !== SWAP_FRAME_MODEL }),params: {...params,studio_options: swapFrameOptionsFor(model, s.frameSize.width, s.frameSize.height),diff --git a/src/lib/create/swap-frame.ts b/src/lib/create/swap-frame.tsindex a92b2d43..82f8b3c2 100644--- a/src/lib/create/swap-frame.ts+++ b/src/lib/create/swap-frame.ts@@ -74,7 +74,7 @@ export function swapFrameSubmit(framePath: string, figurePaths: string[], req: Sreturn {kind: 'image',model,- prompt: swapFramePrompt(roles, req.extra),+ prompt: swapFramePrompt(roles, req.extra, { open: model !== SWAP_FRAME_MODEL }),params: {op: 'studio',image_paths: [framePath, ...figurePaths],diff --git a/src/lib/render/swap.ts b/src/lib/render/swap.tsindex 69487ba5..2294b575 100644--- a/src/lib/render/swap.ts+++ b/src/lib/render/swap.ts@@ -369,7 +369,7 @@ const IMAGE_ORDINAL = ['second', 'third', 'fourth', 'fifth']* frontal heads). The first image is the video frame, from the second on a* photo per person. What the customer writes under "What's wrong?" goes at* the end. */-export function swapFramePrompt(roles: readonly string[], extra?: string): string {+export function swapFramePrompt(roles: readonly string[], extra?: string, opts: { open?: boolean } = {}): string {const who = roles.length ? roles.map((r) => r.trim() || 'the person') : ['the person']const one = who.length === 1const replace = one@@ -382,6 +382,7 @@ export function swapFramePrompt(roles: readonly string[], extra?: string): strin? 'Keep everything else from the first image identical: same pose, the same head angle as in the first image, same head size, mouth position, camera angle, framing, distance, clothing, background, lighting, colors, text overlays and phone-camera quality. It must look like the same raw phone video frame, just with the other person.': `Every other person stays unchanged. Keep everything else from the first image identical: same poses, the same head angles as in the first image, same head sizes, mouth positions, camera angle, framing, distance, clothing, background, lighting, colors, text overlays and phone-camera quality. It must look like the same raw phone video frame, just with the other people.`const fix = extra?.trim() ? `Fix this from the last attempt: ${extra.trim().slice(0, 500)}` : ''+ if (opts.open) return swapFrameOpenPrompt(who, fix)return [replace, keep,one@@ -392,6 +393,32 @@ export function swapFramePrompt(roles: readonly string[], extra?: string): strin].filter(Boolean).join(' ')}+/** The sentence for every editor but Nano Banana Pro (real test of+ * 14.11.2026, David's call; port of the web's swapFrameOpenPrompt): with the+ * Nano sentence Qwen Image 2.1 Edit pasted the photos in with clothing and+ * body. So it says clearly: the first image stays the base, the photos are+ * only face references, only face and hair are swapped. */+function swapFrameOpenPrompt(who: readonly string[], fix: string): string {+ const one = who.length === 1+ const refs = one+ ? 'The second image is only a face reference: do not copy its clothing, body, pose, background or framing.'+ : `The ${who.map((_, i) => IMAGE_ORDINAL[i]).join(', ').replace(/, ([^,]*)$/, ' and $1')} images are only face references: do not copy their clothing, body, pose, background or framing.`+ const give = `Edit only the first image: ${who.map((r, i) => `give ${r} the face and hair of the person from the ${IMAGE_ORDINAL[i]} image`).join(', and ')}.`+ return [+ 'The first image is a frame from a video and is the base image.',+ refs, give,+ one+ ? "Keep the face identity and facial features of the new person exactly. Remove all of the original person's hair completely, even long hair."+ : "Keep the face identity and facial features of each new person exactly. Remove all of the original people's hair completely, even long hair.",+ one+ ? `Keep ${who[0]} exactly where they are, with the same body, pose, head angle, head size, hands, clothing, mouth position, lighting, colors, camera angle, framing, distance and background.`+ : 'Keep every person in the first image exactly where they are, with the same body, pose, head angle, head size, hands, clothing, mouth position, lighting, colors, camera angle, framing, distance and background.',+ one ? 'No headset, no microphone.' : 'No headsets, no microphones. Every other person stays unchanged.',+ one ? 'It must look like the same raw phone video frame, just with the other face.' : 'It must look like the same raw phone video frame, just with the other faces.',+ fix,+ ].filter(Boolean).join(' ')+}+/** A fingerprint of the inputs of the frame step. When the video, a photo, a* mark or a role changes, the built frame no longer fits and expires. */export function swapFrameKey(videoUrl: string, figures: readonly { imageUrl: string | null; role: string; mark?: SwapMark | null }[]): string {