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.

fix(webv2): restore LTX-2 dev's negative prompt when the panel carries none

Lincoln Steinb37b0091dc5b
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 7251a2d7fe..46778b7a2b 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@ -1571,6 +1571,91 @@ describe('LTX-2 policy', () => {
expect(getDefaultVideoSettings(wanModel('t2v_a14b')).negativePrompt).toBe('');
});
+ it("restores dev's negative prompt when arriving from a variant that carries none", () => {
+ // The distilled variant runs no unconditional pass and hides the field, so a panel used on it
+ // reaches dev with nothing to guide against -- and dev would then encode an empty string at
+ // CFG 3, which is the one part of the recipe silently missing.
+ const catalog = [ltx2('ltx2_distilled'), ltx2('ltx2_dev'), LTX2_COMPONENTS, LTX2_ENCODER];
+ const onDistilled = {
+ ...getDefaultVideoSettings(ltx2('ltx2_distilled'), catalog),
+ negativePrompt: '',
+ };
+
+ const toDev = getVideoModelSelectionResult({
+ currentSettings: onDistilled,
+ model: ltx2('ltx2_dev'),
+ models: catalog,
+ });
+
+ expect(toDev.settings.negativePrompt).toBe(LTX2_DEFAULT_NEGATIVE_PROMPT);
+ // Filling an empty field in is not something the panel took away.
+ expect(toDev.clearedLabels).not.toContain('Negative prompt');
+ });
+
+ it('leaves an empty negative prompt alone when the panel came from a family that shows the field', () => {
+ // Wan shows the field, so an empty box there is a value the user chose. Overwriting it would
+ // also break recall, which relies on an empty recorded negative prompt leaving the panel's own
+ // negative prompt untouched.
+ const catalog = [wanModel('t2v_a14b'), ltx2('ltx2_dev'), LTX2_COMPONENTS, LTX2_ENCODER];
+ const onWan = { ...getDefaultVideoSettings(wanModel('t2v_a14b'), catalog), negativePrompt: '' };
+
+ const toDev = getVideoModelSelectionResult({ currentSettings: onWan, model: ltx2('ltx2_dev'), models: catalog });
+
+ expect(toDev.settings.negativePrompt).toBe('');
+ });
+
+ it('seeds the list when the panel it came from can no longer be resolved', () => {
+ // The previous model was uninstalled under the panel, or the panel was never seeded at all. The
+ // automatic re-pick has to reach the same place the manual switch does, or dev runs at CFG 3
+ // against an empty string depending on how it was selected.
+ const catalog = [ltx2('ltx2_dev'), LTX2_COMPONENTS, LTX2_ENCODER];
+ const orphaned = {
+ ...getDefaultVideoSettings(ltx2('ltx2_distilled'), catalog),
+ modelKey: 'uninstalled-key',
+ negativePrompt: '',
+ };
+
+ const toDev = getVideoModelSelectionResult({ currentSettings: orphaned, model: ltx2('ltx2_dev'), models: catalog });
+
+ expect(toDev.settings.negativePrompt).toBe(LTX2_DEFAULT_NEGATIVE_PROMPT);
+ });
+
+ it('does not put a list into a negative prompt field the user switched off', () => {
+ const catalog = [ltx2('ltx2_distilled'), ltx2('ltx2_dev'), LTX2_COMPONENTS, LTX2_ENCODER];
+ const disabled = {
+ ...getDefaultVideoSettings(ltx2('ltx2_distilled'), catalog),
+ negativePrompt: '',
+ negativePromptEnabled: false,
+ };
+
+ const toDev = getVideoModelSelectionResult({ currentSettings: disabled, model: ltx2('ltx2_dev'), models: catalog });
+
+ expect(toDev.settings.negativePrompt).toBe('');
+ expect(toDev.settings.negativePromptEnabled).toBe(false);
+ });
+
+ it('carries a written negative prompt through a detour rather than overwriting it', () => {
+ const catalog = [ltx2('ltx2_distilled'), ltx2('ltx2_dev'), LTX2_COMPONENTS, LTX2_ENCODER];
+ const written = 'shaky handheld footage, lens flare';
+ const onDev = {
+ ...getDefaultVideoSettings(ltx2('ltx2_dev'), catalog),
+ negativePrompt: written,
+ };
+
+ const toDistilled = getVideoModelSelectionResult({
+ currentSettings: onDev,
+ model: ltx2('ltx2_distilled'),
+ models: catalog,
+ });
+ const backToDev = getVideoModelSelectionResult({
+ currentSettings: toDistilled.settings,
+ model: ltx2('ltx2_dev'),
+ models: catalog,
+ });
+
+ expect(backToDev.settings.negativePrompt).toBe(written);
+ });
+
it('keeps a hidden CFG so a detour through another family does not destroy it', () => {
// MiniMax H3 hides CFG and never reads it; a value the user tuned for Wan has to survive
// selecting H3 and coming back.
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index f7cca4f91c..ebf8f77890 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -1829,6 +1829,31 @@ export const getVideoModelSelectionResult = ({
}
}
+ // A family that guides against a list ships it as part of the recipe, exactly like the scales
+ // above -- and like them, the fill is from the "this panel carries none" sentinel rather than from
+ // any empty value. A variant whose negative prompt is never used hides the field and encodes
+ // nothing, so a panel arriving from one holds none to carry, and dev would otherwise guide against
+ // an empty string at CFG 3: the one part of the recipe left silently missing. A panel whose
+ // previous model cannot be resolved (never seeded, or the model was uninstalled under it) holds
+ // none for the same reason, so the automatic re-pick agrees with the manual switch.
+ //
+ // An empty box on a variant that does show the field is the user's own value and is left alone --
+ // that is also what keeps recall's contract that an empty recorded negative prompt does not
+ // disturb the panel's. The two cannot be told apart once a panel has passed through a variant that
+ // hides the field, so clearing the box, detouring through distilled and coming back restores the
+ // list; dev quietly running without it is the worse failure. Filling an empty field in is not a
+ // clearing, so it takes no label.
+ if (config.defaultNegativePrompt && next.negativePromptEnabled && !next.negativePrompt.trim()) {
+ const previous = models.find((entry) => entry.key === currentSettings.modelKey);
+ const previousCarriesNone = previous
+ ? isSupportedVideoModel(previous) && getVideoConfig(previous).negativePrompt.usage === 'never'
+ : true;
+
+ if (previousCarriesNone) {
+ next.negativePrompt = config.defaultNegativePrompt;
+ }
+ }
+
// A fixed-schedule checkpoint's step count is not the user's to carry over.
if (!config.stepsEditable && next.steps !== config.defaults.steps) {
next.steps = config.defaults.steps;
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
index 7faada9964..98f03e8e3a 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
@@ -881,6 +881,24 @@ describe('LTX-2 recall', () => {
}
});
+ it('reproduces a dev clip that ran without a negative prompt, from a distilled panel', () => {
+ // Switching to dev seeds the release's list into a panel that carries none -- which is right
+ // when the user picks the model, and wrong here: the clip recorded an empty negative prompt and
+ // a recall has to re-run what was generated, not what the panel would default to.
+ const onDistilled = createDefaultVideoWidgetValues([LTX2_DISTILLED]);
+
+ const result = buildVideoRecallSettings({
+ currentValues: onDistilled,
+ kind: 'all',
+ metadata: ltx2Metadata({ negative_prompt: '' }),
+ models: catalog,
+ });
+
+ expect(result?.values.model).toMatchObject({ key: LTX2_DEV.key });
+ expect(result?.values.cfgScale).toBe(3);
+ expect(result?.values.negativePrompt).toBe('');
+ });
+
it('restores the model, both component slots and every guidance scale', () => {
const result = buildVideoRecallSettings({ currentValues, kind: 'all', metadata: ltx2Metadata(), models: catalog });
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
index 18dceb5d46..d9f26cdf73 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
@@ -529,10 +529,17 @@ export const buildVideoRecallSettings = ({
if (recalledModel && recalledModel.key !== values.model?.key) {
// The canonical family transition first, so frames/fps/resolution snap to
- // the recalled model before its recorded values land on top.
+ // the recalled model before its recorded values land on top. Its negative
+ // prompt is held back: what the clip recorded is authoritative, and an
+ // empty recording deliberately leaves the panel's own alone (below), which
+ // a family default seeded on the way in would silently overrule -- the
+ // recalled clip would then be re-run against a list it never used.
+ const carriedNegativePrompt = values.negativePrompt;
+
values = {
...getVideoModelSelectionResult({ currentSettings: values, model: recalledModel, models }).settings,
model: recalledModel,
+ negativePrompt: carriedNegativePrompt,
};
fields.push('model');
} else if (recalledModel) {