Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): address adversarial review findings on video panel polish
Lincoln Stein8a88710cec80
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.tsindex 9252a6dbb3..d161948a62 100644--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts@@ -864,9 +864,15 @@ export const getVideoSettingsWithModelDefaults = (...settings,acceleratorEnabled: modelDefaults.acceleratorEnabled,acceleratorLoraKeys: modelDefaults.acceleratorLoraKeys,+ // The default-bearing layout/component choices reset too: a mispicked+ // VAE or expert is exactly what a user reaches for reset to undo.+ aspectRatioId: modelDefaults.aspectRatioId,cfgScale: modelDefaults.cfgScale,cfgScaleLowNoise: modelDefaults.cfgScaleLowNoise,+ componentSourceModel: modelDefaults.componentSourceModel,fps: modelDefaults.fps,+ h3TextEncoderModel: modelDefaults.h3TextEncoderModel,+ h3TransformerModel: modelDefaults.h3TransformerModel,loras: [...settings.loras.filter((lora) => !previousKeys.has(lora.model.key) && !modelDefaults.loras.some((d) => d.model.key === lora.model.key)@@ -877,6 +883,9 @@ export const getVideoSettingsWithModelDefaults = (numFrames: modelDefaults.numFrames,steps: modelDefaults.steps,targetResolution: modelDefaults.targetResolution,+ vae: modelDefaults.vae,+ wanLowNoiseModel: modelDefaults.wanLowNoiseModel,+ wanT5EncoderModel: modelDefaults.wanT5EncoderModel,};};@@ -907,7 +916,16 @@ export const getVideoModelSelectionResult = ({models: readonly ModelConfig[];}): VideoModelSelectionResult => {const config = getVideoConfig(model);- const next: VideoSettings = { ...currentSettings, modelKey: model.key };+ // A record without a modelKey was healed from a store the panel never+ // seeded (a fresh project, or a pre-open "Send to Video" payload): its+ // sampling values are the model-agnostic healing fallbacks, not user+ // choices. Bootstrap the picked model's own defaults — accelerator+ // included — instead of preserving fallbacks, then reconcile any seeded+ // media below exactly like a normal selection.+ const start = currentSettings.modelKey+ ? currentSettings+ : getVideoSettingsWithModelDefaults(currentSettings, model, models);+ const next: VideoSettings = { ...start, modelKey: model.key };const clearedLabels: string[] = [];const modes = config.modes;diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.tsindex df0a1358f3..b74afaf7c1 100644--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts@@ -2,6 +2,7 @@ import type { GenerationModelCatalogItem, MainModelConfig } from '@features/geneimport { describe, expect, it } from 'vitest';+import { normalizeVideoWidgetValues } from './settings';import { getAcceleratorToggleResult } from './videoPolicies';import {createDefaultVideoWidgetValues,@@ -104,6 +105,31 @@ describe('syncVideoWidgetValuesWithModels', () => {expect(getVideoWidgetValidationReasons(synced, [h3Model()])).toEqual([]);});+ it('bootstraps the picked model’s family defaults (accelerator included) for a never-seeded store', () => {+ // A fresh project's widget store is `{}`; healing yields model-agnostic+ // fallbacks with NO modelKey. The selection transition must bootstrap the+ // picked model's own defaults instead of preserving the fallbacks —+ // otherwise a fresh H3 panel opens at 40 steps / CFG 5 with Turbo off.+ const catalog = [h3Model(), lora('MiniMax H3 Turbo LoRA', 'minimax-h3', null)];+ const healed = normalizeVideoWidgetValues({})!;+ const synced = syncVideoWidgetValuesWithModels(healed, catalog);++ expect(synced.model?.base).toBe('minimax-h3');+ // numFrames 124 is H3's own default — not the Wan fallback (81) snapped+ // onto the H3 grid (90), which is what the preserve path would produce.+ expect(synced).toMatchObject({ acceleratorEnabled: true, cfgScale: 1, fps: 24, numFrames: 124, steps: 6 });++ // A pre-open seeded payload ("Send to Video") keeps its media through the+ // same bootstrap.+ const seeded = normalizeVideoWidgetValues({+ firstFrameImage: { height: 480, image_name: 'seed.png', width: 832 },+ })!;+ const syncedSeeded = syncVideoWidgetValuesWithModels(seeded, catalog);++ expect(syncedSeeded.firstFrameImage).toEqual({ height: 480, image_name: 'seed.png', width: 832 });+ expect(syncedSeeded.acceleratorEnabled).toBe(true);+ });+it('drops uninstalled or incompatible LoRAs and clears an orphaned accelerator flag', () => {const catalog = [model, lora('Wan Lightning High Noise'), lora('Wan Lightning Low Noise')];const enabled = getAcceleratorToggleResult(createDefaultVideoWidgetValues([model]), model, catalog, true).settings;diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoHeaderActions.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoHeaderActions.tsxindex 9b04c805d9..577dae4235 100644--- a/invokeai/frontend/webv2/src/features/video/ui/VideoHeaderActions.tsx+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoHeaderActions.tsx@@ -3,6 +3,7 @@ import { Icon } from '@chakra-ui/react';import { useModelsSelector } from '@features/models';import { normalizeVideoWidgetValues } from '@features/video/core/settings';import { getVideoSettingsWithModelDefaults } from '@features/video/core/videoPolicies';+import { syncVideoWidgetValuesWithModels } from '@features/video/core/widgetValues';import { IconButton, Tooltip } from '@platform/ui';import { RotateCcwIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';@@ -11,10 +12,10 @@ import { areVideoValuesEqual } from './videoComparators';import { useVideoUi } from './VideoUiContext';/**- * Widget-header action: reset every model-governed setting (frames, fps,- * target resolution, steps, CFG, accelerator state) back to the selected- * model's defaults. Prompts, conditioning media, and non-default-bearing- * fields are left untouched.+ * Widget-header action: reset every default-bearing setting (frames, fps,+ * target resolution, steps, CFG, accelerator state, aspect ratio, component+ * selections) back to the selected model's defaults. Prompts and conditioning+ * media are left untouched.*/const sortLorasByKey = <T extends { model: { key: string } }>(loras: readonly T[]): T[] =>[...loras].sort((a, b) => a.model.key.localeCompare(b.model.key));@@ -27,7 +28,11 @@ export const VideoHeaderActions = () => {// pair is "not a default" and strip it as the reset — stay disabled until// the catalog is authoritative.const modelsLoaded = useModelsSelector((snapshot) => snapshot.status) === 'loaded';- const values = normalizeVideoWidgetValues(rawValues);+ // Sync against the catalog exactly like the panel view does: computing from+ // the raw store would judge (and reset to!) a phantom model the view no+ // longer shows — e.g. one uninstalled while the panel was open.+ const normalized = normalizeVideoWidgetValues(rawValues);+ const values = normalized && modelsLoaded ? syncVideoWidgetValuesWithModels(normalized, models) : normalized;const model = values?.model ?? null;const defaults =modelsLoaded && values && model ? { ...getVideoSettingsWithModelDefaults(values, model, models), model } : null;