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
fix(create): a saved character clicked in Edit keeps the source image
purpleea24675f9031
diff --git a/src/components/create/experimental/ReferenceStrip.tsx b/src/components/create/experimental/ReferenceStrip.tsxindex b8d302ad..e53e19ad 100644--- a/src/components/create/experimental/ReferenceStrip.tsx+++ b/src/components/create/experimental/ReferenceStrip.tsx@@ -122,8 +122,8 @@ export function ReferenceStrip() {: `Name them in the prompt as ${shown.map((_, i) => `image ${i + 2}`).join(', ')}.`}</p>{/* A character saved from a video (lib/saved-characters) loads its photos- here with one click: the first becomes the source, the rest fill the- strip. */}+ here with one click: they join the strip, and the first becomes the+ source only when none is loaded. */}<SavedCharacterChipslabel="Saved characters"disabled={loading}diff --git a/src/components/create/experimental/__tests__/save-character.test.tsx b/src/components/create/experimental/__tests__/save-character.test.tsxindex 8535bf01..c79c65c5 100644--- a/src/components/create/experimental/__tests__/save-character.test.tsx+++ b/src/components/create/experimental/__tests__/save-character.test.tsx@@ -165,15 +165,17 @@ describe('what a saved character does next', () => {expect(s.trainImages.map((t) => t.name)).toEqual(['mira-01.jpg', 'mira-02.jpg'])})- it('the reference strip loads a saved character with one click', async () => {+ it('the reference strip loads a saved character with one click, next to the source that is loaded', async () => {await saveCharacter('Mira', [photo('a'), photo('b'), photo('c'), photo('d'), photo('e'), photo('f')])useCreateStore.getState().setIntent('edit')useCreateStore.getState().setSource({ filename: 'scene.png', url: 'data:image/png;base64,AA', width: 8, height: 8 })render(<ReferenceStrip />)fireEvent.click(await screen.findByTitle('Load the photos of Mira'))- await waitFor(() => expect(useCreateStore.getState().source?.filename).toBe('up_mira-01.jpg'))// The store keeps four further photos at most, a model shows what it reads.- expect(useCreateStore.getState().references).toHaveLength(4)+ await waitFor(() => expect(useCreateStore.getState().references).toHaveLength(4))+ expect(useCreateStore.getState().references[0].filename).toBe('up_mira-01.jpg')+ // The picture being edited is not replaced (box run, 03.10.2026).+ expect(useCreateStore.getState().source?.filename).toBe('scene.png')})it('the Character Studio board adds the photos of a saved character', async () => {diff --git a/src/components/create/experimental/__tests__/saved-character-keeps-the-source.test.ts b/src/components/create/experimental/__tests__/saved-character-keeps-the-source.test.tsnew file mode 100644index 00000000..2da53b03--- /dev/null+++ b/src/components/create/experimental/__tests__/saved-character-keeps-the-source.test.ts@@ -0,0 +1,68 @@+// @vitest-environment jsdom+/**+ * A saved character clicked in Edit (box run, 03.10.2026): the click replaced+ * the picture the user was editing with the character's first photo. With a+ * source loaded the photos are reference photos, all of them; only an empty+ * slot takes the first photo as the source.+ */+import { beforeEach, describe, expect, it, vi } from 'vitest'++vi.mock('../loadImage', () => ({+ loadImageRef: vi.fn(async (file: File) => ({ filename: file.name, url: `blob:${file.name}`, width: 8, height: 8 })),+}))++import { loadPhotosAsReferences } from '../characterPhotos'+import { useCreateStore, type ImageRef } from '../../../../stores/createStore'+import { MAX_STORED_REFERENCES } from '../../../../lib/edit-references'++const photo = () => new Blob(['x'], { type: 'image/jpeg' })+const ref = (filename: string): ImageRef => ({ filename, url: `blob:${filename}`, width: 8, height: 8 })+const names = (list: readonly ImageRef[]) => list.map((r) => r.filename)++beforeEach(() => {+ useCreateStore.setState({+ backend: 'local', cloudOp: null, utilityOp: null, removebg: false,+ source: null, mask: null, references: [], batchSources: [],+ } as never)+ useCreateStore.getState().setIntent('edit')+})++describe('a saved character clicked in Edit', () => {+ it('a source is loaded: it stays, and every photo joins the reference photos', async () => {+ const mask = ref('mask.png')+ useCreateStore.setState({ source: ref('street.png'), mask, references: [ref('hat.png')] } as never)+ const loaded = await loadPhotosAsReferences('probe', [photo(), photo(), photo()])+ const s = useCreateStore.getState()+ expect(s.source?.filename).toBe('street.png')+ expect(s.mask).toBe(mask)+ expect(names(s.references)).toEqual(['hat.png', 'probe-01.jpg', 'probe-02.jpg', 'probe-03.jpg'])+ expect(loaded).toBe(3)+ })++ it('a full strip takes only what fits and says how many it took', async () => {+ const full = Array.from({ length: MAX_STORED_REFERENCES - 1 }, (_, i) => ref(`r${i}.png`))+ useCreateStore.setState({ source: ref('street.png'), references: full } as never)+ const loaded = await loadPhotosAsReferences('probe', [photo(), photo(), photo()])+ const s = useCreateStore.getState()+ expect(s.references).toHaveLength(MAX_STORED_REFERENCES)+ expect(names(s.references).at(-1)).toBe('probe-01.jpg')+ expect(loaded).toBe(1)+ })++ it('no source: the first photo becomes the source, the rest are reference photos', async () => {+ await loadPhotosAsReferences('probe', [photo(), photo(), photo()])+ const s = useCreateStore.getState()+ expect(s.source?.filename).toBe('probe-01.jpg')+ expect(names(s.references)).toEqual(['probe-02.jpg', 'probe-03.jpg'])+ })++ it('from another tab: Create switches to Edit and the photos replace what was loaded there', async () => {+ useCreateStore.setState({ source: ref('old.png'), references: [ref('hat.png')] } as never)+ useCreateStore.getState().setIntent('image')+ await loadPhotosAsReferences('probe', [photo(), photo()])+ const s = useCreateStore.getState()+ expect(s.intent()).toBe('edit')+ expect(s.source?.filename).toBe('probe-01.jpg')+ expect(names(s.references)).toEqual(['probe-02.jpg'])+ })+})diff --git a/src/components/create/experimental/characterPhotos.ts b/src/components/create/experimental/characterPhotos.tsindex 13485058..abd02d3f 100644--- a/src/components/create/experimental/characterPhotos.ts+++ b/src/components/create/experimental/characterPhotos.ts@@ -12,20 +12,30 @@ function asFiles(name: string, photos: readonly Blob[]): File[] {}/**- * The first photo becomes the source image, the next ones fill the reference- * strip under it. Edit and Animate Image keep their tab, every other tab- * switches to Edit. A model shows and sends only as many photos as it reads.+ * Loads the photos for an edit. With a source image already loaded in Edit or+ * Animate Image it stays, with its mask, and the photos join the reference+ * strip as far as it has room. Otherwise the first photo becomes the source+ * and the next ones fill the strip. Edit and Animate Image keep their tab,+ * every other tab switches to Edit and starts over with these photos. A model+ * shows and sends only as many photos as it reads.* Returns how many photos were loaded.*/export async function loadPhotosAsReferences(name: string, photos: readonly Blob[]): Promise<number> {- const files = asFiles(name, photos).slice(0, MAX_STORED_REFERENCES + 1)- if (files.length === 0) return 0const st = useCreateStore.getState()const intent = st.intent()- if (intent !== 'edit' && intent !== 'animate') st.setIntent('edit')+ const stays = intent === 'edit' || intent === 'animate'+ if (!stays) st.setIntent('edit')+ const keepSource = stays && !!st.source+ const room = keepSource ? MAX_STORED_REFERENCES - st.references.length : MAX_STORED_REFERENCES + 1+ const files = asFiles(name, photos).slice(0, Math.max(0, room))+ if (files.length === 0) return 0const refs = []for (const file of files) refs.push(await loadImageRef(file))const now = useCreateStore.getState()+ if (keepSource && now.source) {+ now.setReferences([...now.references, ...refs].slice(0, MAX_STORED_REFERENCES))+ return refs.length+ }now.setBatchSources([])now.setMask(null)now.setSource(refs[0])