Skip to content

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.

feat(webv2): video Concepts and Model Components sections

Lincoln Stein924d85e7d00c
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 438d249876..676b9d3c20 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -3040,7 +3040,17 @@
"clearStaleMedia": "Clear",
"staleFirstFrame": "A first frame is set, but this model does not support starting from one.",
"staleLastFrame": "A last frame is set, but this model does not support ending on one.",
- "staleSourceVideo": "An initial video is set, but this model does not support extending videos."
+ "staleSourceVideo": "An initial video is set, but this model does not support extending videos.",
+ "addLora": "Search compatible concepts…",
+ "components": "Model Components",
+ "componentRequired": "Required for this model.",
+ "concepts": "Concepts",
+ "loraWeight": "Weight for {{name}}",
+ "noLoras": "No concepts added. Compatible LoRAs adjust style and motion.",
+ "removeLora": "Remove {{name}}",
+ "selectComponent": "Select a component model…",
+ "acceleratorBroken": "Accelerator turned off",
+ "acceleratorBrokenDescription": "One of its LoRAs was removed or disabled, so steps and CFG were restored to the model's defaults."
}
},
"workflowLibrary": {
diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts b/invokeai/frontend/webv2/src/features/video/core/settings.test.ts
index ac118d77c0..e63c6f5055 100644
--- a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/settings.test.ts
@@ -137,6 +137,19 @@ describe('normalizeVideoSettings', () => {
loras: [lightningLora],
})
).toBe(true);
+ // A recorded LoRA that is merely DISABLED also clears the flag: the graph
+ // skips disabled LoRAs, so the fast path would silently run without it.
+ const disabledLightning = { ...lightningLora, isEnabled: false };
+
+ expect(
+ normalizeVideoSettings({
+ ...createSettings(),
+ acceleratorEnabled: true,
+ acceleratorLoraKeys: ['lit'],
+ loras: [disabledLightning],
+ })
+ ).toMatchObject({ acceleratorEnabled: false, acceleratorLoraKeys: [] });
+
// A disabled flag must not carry stale keys.
expect(isVideoSettings({ ...createSettings(), acceleratorEnabled: false, acceleratorLoraKeys: ['lit'] })).toBe(
false
diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.ts b/invokeai/frontend/webv2/src/features/video/core/settings.ts
index 9cd112c900..15c5b77f2e 100644
--- a/invokeai/frontend/webv2/src/features/video/core/settings.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/settings.ts
@@ -81,9 +81,9 @@ const isVideoLora = (value: unknown): value is GenerateLora =>
const getStringArray = (value: unknown): string[] =>
Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : [];
-/** Whether every key the accelerator toggle recorded is still present in the LoRA list. */
+/** Whether every key the accelerator toggle recorded is still present AND enabled in the LoRA list. */
const areAcceleratorLorasPresent = (keys: readonly string[], loras: readonly GenerateLora[]): boolean =>
- keys.length > 0 && keys.every((key) => loras.some((lora) => lora.model.key === key));
+ keys.length > 0 && keys.every((key) => loras.some((lora) => lora.model.key === key && lora.isEnabled));
/**
* Which inputs are filled decides the mode; there is no mode selector. A first
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
index c35915443b..fe171798f9 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@ -458,6 +458,25 @@ describe('component section policy', () => {
).not.toContain('wanLowNoiseModel');
});
+ it('offers the component-source slot only for single-file mains, never listing the main itself', () => {
+ const diffusers = wanModel('i2v_a14b', 'diffusers');
+
+ expect(
+ getVideoComponentSectionPolicy(diffusers, settingsFor(diffusers)).slots.map((slot) => slot.key)
+ ).not.toContain('componentSourceModel');
+
+ const gguf = wanModel('i2v_a14b', 'gguf_quantized');
+ const settings = settingsFor(gguf);
+ const slot = getVideoComponentSectionPolicy(gguf, settings).slots.find((s) => s.key === 'componentSourceModel');
+ const ctx = { model: gguf, selectedComponents: settings, settings };
+
+ expect(slot?.filter?.(wanModel('i2v_a14b', 'diffusers'), ctx)).toBe(true);
+ // A (hypothetical) diffusers-format selected main must not list itself.
+ expect(slot?.filter?.({ ...gguf, format: 'diffusers' }, { ...ctx, model: { ...gguf, format: 'diffusers' } })).toBe(
+ false
+ );
+ });
+
it('constrains the low-noise expert to a different single-file model of the same variant', () => {
const model = wanModel('i2v_a14b', 'gguf_quantized');
const settings = settingsFor(model);
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 827fe9a58c..9252a6dbb3 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -703,14 +703,22 @@ export const getVideoComponentSectionPolicy = (
if (model.base === 'wan') {
const config = getVideoConfig(model);
const slots: VideoComponentSlotPolicy[] = [
- {
- filter: (candidate) => isDiffusersMainForBase('wan')(candidate),
- helpText: 'Select a Diffusers Wan model to provide VAE and text-encoder components.',
- key: 'componentSourceModel',
- label: 'Component source',
- modelTypes: ['main'],
- valueKind: 'main',
- },
+ // A Diffusers main is its own component source; the loader ignores the
+ // input for it, so the slot is only offered for single-file mains — and
+ // never lists the selected main itself.
+ ...(model.format === 'diffusers'
+ ? []
+ : [
+ {
+ filter: (candidate: ModelConfig, ctx: VideoComponentPolicyContext) =>
+ isDiffusersMainForBase('wan')(candidate) && candidate.key !== ctx.model.key,
+ helpText: 'Select a Diffusers Wan model to provide VAE and text-encoder components.',
+ key: 'componentSourceModel',
+ label: 'Component source',
+ modelTypes: ['main'],
+ valueKind: 'main',
+ } satisfies VideoComponentSlotPolicy,
+ ]),
{
filter: isWanVaeForMain,
helpText: 'Required unless a Diffusers component source is available.',
diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
index 82e70128c7..24bdeb5426 100644
--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
@@ -95,7 +95,7 @@ export const syncVideoWidgetValuesWithModels = (
const acceleratorAlive =
base.acceleratorEnabled &&
base.acceleratorLoraKeys.length > 0 &&
- base.acceleratorLoraKeys.every((key) => loras.some((lora) => lora.model.key === key));
+ base.acceleratorLoraKeys.every((key) => loras.some((lora) => lora.model.key === key && lora.isEnabled));
// Reuse the stored array whenever the content is unchanged — the identity
// guarantee below depends on it.
const acceleratorLoraKeys = acceleratorAlive || base.acceleratorLoraKeys.length === 0 ? base.acceleratorLoraKeys : [];
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx
new file mode 100644
index 0000000000..1705b12932
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx
@@ -0,0 +1,124 @@
+import type { MainModelConfig, ModelIdentifierConfig, VaeModelConfig } from '@features/generation/contracts';
+import type { ModelConfig } from '@features/models';
+import type { VideoWidgetValues } from '@features/video/core/types';
+import type {
+ VideoComponentPolicyContext,
+ VideoComponentSlotPolicy,
+ VideoComponentValueKey,
+} from '@features/video/core/videoPolicies';
+
+import { Stack } from '@chakra-ui/react';
+import { GenerationSettingsSection } from '@features/generation/components';
+import { isMainModelConfig, isModelIdentifierConfig, isVaeModelConfig } from '@features/generation/settings';
+import { ModelSelect } from '@features/models/react';
+import { getVideoComponentSectionPolicy } from '@features/video/core/videoPolicies';
+import { Field } from '@platform/ui';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+/**
+ * Model Components for the Video panel — fully policy-driven, like the
+ * generation panel's section: the component renders whatever slots the
+ * capability matrix returns (Wan: component source / VAE / Wan T5 / low-noise
+ * expert; MiniMax H3: the two single-file overrides), with each slot's
+ * compatibility filter and requiredness coming from the policy.
+ */
+
+const coerceSlotValue = (
+ slot: VideoComponentSlotPolicy,
+ candidate: ModelConfig | null
+): MainModelConfig | VaeModelConfig | ModelIdentifierConfig | null => {
+ if (!candidate) {
+ return null;
+ }
+
+ switch (slot.valueKind) {
+ case 'main':
+ return isMainModelConfig(candidate) ? candidate : null;
+ case 'vae':
+ return isVaeModelConfig(candidate) ? candidate : null;
+ case 'component':
+ return isModelIdentifierConfig(candidate) ? candidate : null;
+ }
+};
+
+const ComponentSlotRow = memo(function ComponentSlotRow({
+ ctx,
+ onPatch,
+ slot,
+ value,
+}: {
+ ctx: VideoComponentPolicyContext;
+ onPatch: (patch: Partial<VideoWidgetValues>) => void;
+ slot: VideoComponentSlotPolicy;
+ value: ModelIdentifierConfig | MainModelConfig | VaeModelConfig | null;
+}) {
+ const { t } = useTranslation();
+ const isMissing = Boolean(slot.required?.(ctx)) && !value;
+ const filter = useMemo(
+ () => (slot.filter ? (candidate: ModelConfig) => slot.filter?.(candidate, ctx) ?? true : undefined),
+ [ctx, slot]
+ );
+ const handleChange = useMemo(
+ () => (candidate: ModelConfig | null) => onPatch({ [slot.key]: coerceSlotValue(slot, candidate) }),
+ [onPatch, slot]
+ );
+
+ return (
+ <Field
+ error={isMissing ? (slot.missingMessage ?? t('widgets.video.componentRequired')) : undefined}
+ helpText={isMissing ? undefined : slot.helpText}
+ label={slot.label}
+ >
+ <ModelSelect
+ filter={filter}
+ invalid={isMissing}
+ isClearable
+ modelTypes={slot.modelTypes}
+ placeholder={t('widgets.video.selectComponent')}
+ size="xs"
+ value={value?.key ?? null}
+ onChange={handleChange}
+ />
+ </Field>
+ );
+});
+
+export const VideoComponentsSection = memo(function VideoComponentsSection({
+ onPatch,
+ values,
+}: {
+ onPatch: (patch: Partial<VideoWidgetValues>) => void;
+ values: VideoWidgetValues;
+}) {
+ const { t } = useTranslation();
+ const policy = useMemo(() => getVideoComponentSectionPolicy(values.model ?? undefined, values), [values]);
+ const ctx = useMemo<VideoComponentPolicyContext | null>(
+ () => (values.model ? { model: values.model, selectedComponents: values, settings: values } : null),
+ [values]
+ );
+
+ if (!ctx || policy.slots.length === 0) {
+ return null;
+ }
+
+ return (
+ <GenerationSettingsSection
+ defaultOpen={policy.defaultOpen}
+ label={t('widgets.video.components')}
+ sectionId="video-components"
+ >
+ <Stack gap="3" p="2">
+ {policy.slots.map((slot) => (
+ <ComponentSlotRow
+ key={slot.key}
+ ctx={ctx}
+ slot={slot}
+ value={values[slot.key as VideoComponentValueKey]}
+ onPatch={onPatch}
+ />
+ ))}
+ </Stack>
+ </GenerationSettingsSection>
+ );
+});
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx
new file mode 100644
index 0000000000..837873cc6b
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx
@@ -0,0 +1,151 @@
+import type { GenerateLora, MainModelConfig } from '@features/generation/contracts';
+import type { ModelConfig, ModelTaxonomyType } from '@features/models';
+
+import { HStack, NumberInput, Stack, Switch, Text } from '@chakra-ui/react';
+import { GenerationSettingsSection } from '@features/generation/components';
+import { getDefaultLoraWeight, isLoraCompatibleWithModel, isLoraModelConfig } from '@features/generation/settings';
+import { ModelSelect } from '@features/models/react';
+import { IconButton } from '@platform/ui/Button';
+import { MiddleTruncate } from '@platform/ui/MiddleTruncate';
+import { Trash2Icon } from 'lucide-react';
+import { memo, useCallback, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { areVideoLorasEquivalent, areVideoModelsEquivalent } from './videoComparators';
+
+/**
+ * Concepts (LoRAs) for the Video panel. The picker is an adder (never shows a
+ * selection); compatibility follows the shared generation rule, which for Wan
+ * already encodes the A14B/5B family split. Expert routing is the graph's job
+ * ('auto' reads each LoRA's probed high/low tag), so rows carry no target
+ * control.
+ */
+
+const LORA_MODEL_TYPES: readonly ModelTaxonomyType[] = ['lora'];
+const SWITCH_CHECKED_PROPS = { bg: 'accent.solid' };
+
+const VideoLoraRow = memo(function VideoLoraRow({
+ lora,
+ onRemove,
+ onUpdate,
+}: {
+ lora: GenerateLora;
+ onRemove: (key: string) => void;
+ onUpdate: (key: string, update: Partial<GenerateLora>) => void;
+}) {
+ const { t } = useTranslation();
+ const modelKey = lora.model.key;
+ const handleToggle = useCallback(
+ (details: { checked: boolean }) => onUpdate(modelKey, { isEnabled: details.checked }),
+ [modelKey, onUpdate]
+ );
+ const handleWeightChange = useCallback(
+ ({ valueAsNumber }: NumberInput.ValueChangeDetails) => {
+ if (Number.isFinite(valueAsNumber)) {
+ onUpdate(modelKey, { weight: valueAsNumber });
+ }
+ },
+ [modelKey, onUpdate]
+ );
+ const handleRemove = useCallback(() => onRemove(modelKey), [modelKey, onRemove]);
+
+ return (
+ <HStack bg="bg.subtle" gap="2" p="2" rounded="md">
+ <Switch.Root aria-label={lora.model.name} checked={lora.isEnabled} size="sm" onCheckedChange={handleToggle}>
+ <Switch.HiddenInput />
+ <Switch.Control _checked={SWITCH_CHECKED_PROPS}>
+ <Switch.Thumb />
+ </Switch.Control>
+ </Switch.Root>
+ <MiddleTruncate flex="1" fontSize="xs" minW="0" text={lora.model.name} />
+ <NumberInput.Root
+ max={10}
+ min={-10}
+ size="xs"
+ step={0.05}
+ value={String(lora.weight)}
+ w="20"
+ onValueChange={handleWeightChange}
+ >
+ <NumberInput.Input aria-label={t('widgets.video.loraWeight', { name: lora.model.name })} />
+ </NumberInput.Root>
+ <IconButton
+ aria-label={t('widgets.video.removeLora', { name: lora.model.name })}
+ size="xs"
+ variant="ghost"
+ onClick={handleRemove}
+ >
+ <Trash2Icon />
+ </IconButton>
+ </HStack>
+ );
+});
+
+export const VideoConceptsSection = memo(
+ function VideoConceptsSection({
+ loras,
+ model,
+ onChangeLoras,
+ }: {
+ loras: GenerateLora[];
+ model: MainModelConfig | null;
+ onChangeLoras: (loras: GenerateLora[]) => void;
+ }) {
+ const { t } = useTranslation();
+ const selectedLoraKeys = useMemo(() => new Set(loras.map((lora) => lora.model.key)), [loras]);
+ const loraFilter = useCallback(
+ (candidate: ModelConfig) =>
+ Boolean(model && isLoraModelConfig(candidate) && isLoraCompatibleWithModel(candidate, model)),
+ [model]
+ );
+ const addLora = useCallback(
+ (candidate: ModelConfig | null) => {
+ if (!model || !isLoraModelConfig(candidate) || !isLoraCompatibleWithModel(candidate, model)) {
+ return;
+ }
+
+ onChangeLoras([...loras, { isEnabled: true, model: candidate, weight: getDefaultLoraWeight(candidate) }]);
+ },
+ [loras, model, onChangeLoras]
+ );
+ const updateLora = useCallback(
+ (key: string, update: Partial<GenerateLora>) =>
+ onChangeLoras(loras.map((lora) => (lora.model.key === key ? { ...lora, ...update } : lora))),
+ [loras, onChangeLoras]
+ );
+ const removeLora = useCallback(
+ (key: string) => onChangeLoras(loras.filter((candidate) => candidate.model.key !== key)),
+ [loras, onChangeLoras]
+ );
+
+ return (
+ <GenerationSettingsSection label={t('widgets.video.concepts')} sectionId="video-concepts" defaultOpen>
+ <Stack gap="2" p="2">
+ <ModelSelect
+ disabled={!model}
+ excludeKeys={selectedLoraKeys}
+ filter={loraFilter}
+ modelTypes={LORA_MODEL_TYPES}
+ placeholder={t('widgets.video.addLora')}
+ size="xs"
+ value={null}
+ onChange={addLora}
+ />
+ {loras.length === 0 ? (
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.video.noLoras')}
+ </Text>
+ ) : (
+ loras.map((lora) => (
+ <VideoLoraRow key={lora.model.key} lora={lora} onRemove={removeLora} onUpdate={updateLora} />
+ ))
+ )}
+ </Stack>
+ </GenerationSettingsSection>
+ );
+ },
+ (previous, next) =>
+ previous.onChangeLoras === next.onChangeLoras &&
+ areVideoModelsEquivalent(previous.model, next.model) &&
+ areVideoLorasEquivalent(previous.loras, next.loras)
+);
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
index bceff40943..62e8af8382 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
@@ -27,6 +27,8 @@ import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { areVideoValuesEqual } from './videoComparators';
+import { VideoComponentsSection } from './VideoComponentsSection';
+import { VideoConceptsSection } from './VideoConceptsSection';
import { VideoPromptFields } from './VideoFormFields';
import { VideoFrameImageField } from './VideoFrameImageField';
import { VideoSourceClipField } from './VideoSourceClipField';
@@ -236,6 +238,38 @@ export const VideoWidgetView = () => {
(sourceVideo: VideoSourceClip | null) => patch({ sourceVideo, ...(sourceVideo ? { firstFrameImage: null } : {}) }),
[patch]
);
+ const setLoras = useCallback(
+ (loras: VideoWidgetValues['loras']) => {
+ // Removing or disabling one of the accelerator's LoRAs breaks the fast
+ // path: turn it off explicitly, restore the model's own sampling
+ // defaults (Lightning wrote steps/CFG), keep the user's list edit, and
+ // say so — a silent 4-step run without the distillation pair would just
+ // look like a broken model.
+ const acceleratorBroken =
+ values.acceleratorEnabled &&
+ !values.acceleratorLoraKeys.every((key) => loras.some((lora) => lora.model.key === key && lora.isEnabled));
+
+ if (!acceleratorBroken) {
+ patch({ loras });
+ return;
+ }
+
+ patch({
+ acceleratorEnabled: false,
+ acceleratorLoraKeys: [],
+ cfgScale: policy.defaults.cfgScale,
+ cfgScaleLowNoise: policy.defaults.cfgScaleLowNoise,
+ loras,
+ steps: policy.defaults.steps,
+ });
+ toaster.create({
+ description: t('widgets.video.acceleratorBrokenDescription'),
+ title: t('widgets.video.acceleratorBroken'),
+ type: 'info',
+ });
+ },
+ [patch, policy.defaults, t, values.acceleratorEnabled, values.acceleratorLoraKeys]
+ );
const clearFirstFrame = useCallback(() => patch({ firstFrameImage: null }), [patch]);
const clearLastFrame = useCallback(() => patch({ lastFrameImage: null }), [patch]);
const clearSourceVideo = useCallback(() => patch({ sourceVideo: null }), [patch]);
@@ -525,6 +559,9 @@ export const VideoWidgetView = () => {
</Field>
</Stack>
</GenerationSettingsSection>
+
+ <VideoConceptsSection loras={values.loras} model={values.model} onChangeLoras={setLoras} />
+ <VideoComponentsSection values={values} onPatch={patch} />
</Stack>
);
};
diff --git a/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts b/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts
index 870e408a40..9b4075fe23 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts
+++ b/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts
@@ -18,6 +18,8 @@ export const areVideoLorasEquivalent = (left: VideoWidgetValues['loras'], right:
left.every(
(lora, index) =>
lora.model.key === right[index]?.model.key &&
+ lora.model.name === right[index]?.model.name &&
+ lora.model.hash === right[index]?.model.hash &&
lora.weight === right[index]?.weight &&
lora.isEnabled === right[index]?.isEnabled
);