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): C1 Punkt 8, ModelChip zeigt das echte Animate-Modell
purplee31facb7596d
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsxindex de800b04..31f3be7e 100644--- a/src/components/create/experimental/CreateExperimental.tsx+++ b/src/components/create/experimental/CreateExperimental.tsx@@ -21,6 +21,7 @@ import { BannerText } from './BannerText'import { MaskEditor } from './MaskEditor'import { VhsInstallModal } from './VhsInstallModal'import { INTENT_MAP, isIntentAvailable } from './intents'+import { modelForOp } from '../../../stores/cloudCatalogStore'import { stageShowsSetupCard, laneModelCount } from './stageGate'import { isMlxImageHost } from '../../../api/mlx-image'import { fetchGalleryItemBlob } from './galleryUrl'@@ -216,10 +217,19 @@ function CreateExperimentalInner() {// deliberately skips ...dropAll), but a fresh t2i result was never adopted// as `source` in the first place, so setSource still has to run after it,// exactly like editResultWithMask does for 'edit'. No mask step needed here.+ //+ // C1 nachbessert, Punkt 8: also coerce cloudVideoModel onto a real i2v+ // model via modelForOp, the same coercion submit/the credits gate already+ // apply. Without this the ModelChip kept showing whatever was picked for+ // the PREVIOUS intent (e.g. a t2v-only model), which the run itself never+ // used, since modelForOp silently swaps to i2vModels()[0] at submit time.+ // Web's animateFrom does the equivalent set for parity.const animateResult = useCallback(async (item: GalleryItem) => {- useCreateStore.getState().setIntent('animate')+ const state = useCreateStore.getState()+ state.setIntent('animate')+ state.setCloudVideoModel(modelForOp('video', 'animate', state.cloudVideoModel))try {- useCreateStore.getState().setSource(await adoptResult(item))+ state.setSource(await adoptResult(item))} catch (err) {setError(`Could not load the result for animating: ${err instanceof Error ? err.message : String(err)}`)}diff --git a/src/components/create/experimental/__tests__/animate-result-sets-model-c1.test.ts b/src/components/create/experimental/__tests__/animate-result-sets-model-c1.test.tsnew file mode 100644index 00000000..c31027f9--- /dev/null+++ b/src/components/create/experimental/__tests__/animate-result-sets-model-c1.test.ts@@ -0,0 +1,61 @@+/**+ * C1 nachbessert (review-create.md, Punkt 8): "Animate this image" on a+ * finished result (animateResult in CreateExperimental.tsx) set the intent+ * and adopted the source, but left cloudVideoModel untouched. The ModelChip+ * reads cloudVideoModel, so it kept showing whatever model was picked for+ * the PREVIOUS intent, even though modelForOp('video','animate', picked)+ * silently coerces onto a real i2v model at submit time (see+ * src/stores/__tests__/cloudCatalogStore.test.ts, "animate with a t2v-only+ * pick -> first i2v-capable clip model"). Web parity: createStore's+ * animateFrom (lu-300-web) does the equivalent set.+ *+ * CreateExperimental.tsx pulls in useCreate/useCloudCreate/useCloudSession+ * and a dozen api/discover modules through CreateContext, so a full render+ * of the real component tree is not the smallest unit here (the same+ * tradeoff die-fehlerleiste-ist-lesbar.test.tsx already made for+ * useCreate.ts). This reads the actual animateResult source instead, the+ * same way that file's last test reads useCreate.ts's training-error branch.+ *+ * Run: npx vitest run src/components/create/experimental/__tests__/animate-result-sets-model-c1.test.ts+ */+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'++const src = readFileSync(resolve(__dirname, '..', 'CreateExperimental.tsx'), 'utf8')++function body(fnStart: string): string {+ const i = src.indexOf(fnStart)+ expect(i, `could not find "${fnStart}" in CreateExperimental.tsx`).toBeGreaterThan(-1)+ const rest = src.slice(i)+ return rest.slice(0, rest.indexOf('\n }, ['))+}++describe('animateResult sets the video model chip to what the run will really use (C1)', () => {+ it('imports modelForOp from the cloud catalog store', () => {+ expect(src).toMatch(/import\s*\{[^}]*modelForOp[^}]*\}\s*from\s*'\.\.\/\.\.\/\.\.\/stores\/cloudCatalogStore'/)+ })++ it('calls setCloudVideoModel(modelForOp(\'video\', \'animate\', ...)) before adopting the source', () => {+ const fn = body('const animateResult = useCallback(async (item: GalleryItem) => {')+ const setIntentAt = fn.indexOf("setIntent('animate')")+ const setModelAt = fn.indexOf("setCloudVideoModel(modelForOp('video', 'animate'")+ const setSourceAt = fn.indexOf('setSource(await adoptResult(item))')+ expect(setIntentAt).toBeGreaterThan(-1)+ expect(setModelAt).toBeGreaterThan(-1)+ expect(setSourceAt).toBeGreaterThan(-1)+ // Order matters: the chip must already show the coerced model before the+ // (async, can fail) source adoption runs.+ expect(setIntentAt).toBeLessThan(setModelAt)+ expect(setModelAt).toBeLessThan(setSourceAt)+ })++ it('editResultWithMask (the sibling action for "edit") does NOT need the same call: edit has no per-op model chip coercion', () => {+ // Regression guard for the test itself: editResultWithMask must exist and+ // must NOT contain setCloudVideoModel, so the assertions above are+ // actually specific to animateResult and not accidentally true of any+ // function in the file.+ const fn = body('const editResultWithMask = useCallback(async (item: GalleryItem) => {')+ expect(fn).not.toContain('setCloudVideoModel')+ })+})