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): clear references for an explicitly empty list beside other media

Lincoln Steind9434e9d6e5a
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
index 36cfe683c1..886b40fdf3 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
@@ -812,16 +812,21 @@ export const buildVideoRecallSettings = ({
fields.push('media');
} else if (hadMedia && !partial) {
fields.push('media');
- } else if (
+ }
+
+ // A partial record's explicitly empty list asks for no references, whatever other media it names; an absent one
+ // leaves them alone.
+ if (
partial &&
isRecord(metadata) &&
Array.isArray(metadata.minimax_h3_references) &&
metadata.minimax_h3_references.length === 0 &&
values.references.length > 0
) {
- // An explicitly empty list asks for no references; an absent one leaves them alone.
values = { ...values, references: [] };
- fields.push('media');
+ if (!fields.includes('media')) {
+ fields.push('media');
+ }
}
// Recalled alongside the source rather than with the sampling block: it is only meaningful for a
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.test.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.test.ts
index 02846ac842..5d51a26bbd 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.test.ts
@@ -310,6 +310,22 @@ describe('createVideoRecallRuntime', () => {
runtime.dispose();
});
+ it('clears the references for an explicitly empty list sent beside an initial video', async () => {
+ const { runtime, socket, videoValues } = setup(REF2VA);
+
+ for (const name of ['a.mp4', 'b.mp4', 'c.mp4']) {
+ socket.emit(placementEvent('reference_video', { video_name: name }));
+ await flush();
+ }
+ socket.emit(parametersEvent({ minimax_h3_references: [], source_video: { video_name: 'clip.mp4' } }));
+ await flush();
+
+ expect(referenceNames(videoValues())).toEqual(['clip.mp4*']);
+ expect(videoValues()).toMatchObject({ sourceVideo: { video_name: 'clip.mp4' } });
+
+ runtime.dispose();
+ });
+
it('ignores a first frame a Ref2VA panel cannot use, keeping its initial video', async () => {
const { runtime, socket, videoValues } = setup(REF2VA);