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.

Merge origin/main into feat/webv2-reference-detail-cost

Lincoln Stein88ffda39ae7e
diff --cc invokeai/frontend/webv2/public/locales/en.json
index 015af92f2f,6681668ad1..47361cac06
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@@ -3462,9 -3572,10 +3573,10 @@@
"referenceVideoCapRace": "All {{max}} video reference slots filled while this one was loading, so it was not added.",
"referenceFromInitialVideo": "Initial video",
"references": "References",
- "referencesHelp": "Up to 3 videos and 9 images condition the generation, in order — reordering references changes the result. A video reference can contribute its image track, its soundtrack, or both.",
+ "referencesHelp": "Up to 3 videos and 9 images condition the generation, in order — reordering references changes the result. A video reference can contribute its image track, its soundtrack, or both. Every reference adds rows to each denoising step, so the first image reference starts at maximum detail and later ones match the generation size.",
"removeReference": "Remove reference",
- "staleReferences": "References are set but the selected model cannot use them."
+ "staleReferences": "References are set but the selected model cannot use them.",
+ "uploadVideoReference": "Upload video"
}
},
"workflowLibrary": {
diff --cc invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
index da892de70d,0cb7091a1a..50d8abbcbd
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
@@@ -6,12 -8,12 +8,13 @@@ import type
} from '@features/video/core/types';
import type { ChangeEvent } from 'react';
- import { Badge, Box, createListCollection, HStack, Image, Input, Spinner, Stack, Text } from '@chakra-ui/react';
+ import { Badge, Box, createListCollection, HStack, Icon, Image, Input, Spinner, Stack, Text } from '@chakra-ui/react';
import { useDndContext, useDndMonitor, useDroppable } from '@dnd-kit/core';
- import { galleryImages, galleryItems, galleryTransfers } from '@features/gallery';
+ import { galleryItems, galleryTransfers, toGalleryItemKey } from '@features/gallery';
+ import { GalleryPickerPopover } from '@features/gallery/picker';
import { galleryImageUrls, galleryVideoUrls, isGalleryItemDragData } from '@features/gallery/utility';
-import { createVideoSourceClip } from '@features/video/core/settings';
+import { resolveMiniMaxH3ReferenceImage } from '@features/video/core/dimensions';
+import { createVideoSourceClip, getDefaultReferenceImageDetail } from '@features/video/core/settings';
import {
assertAccountScopeCurrent,
captureAccountScope,
@@@ -339,8 -316,41 +342,44 @@@ export const VideoReferenceListField =
const handlePickVideo = useCallback(() => videoInputRef.current?.click(), []);
const addImageReference = useCallback(
- async (imageName: string) => {
+ (image: { height: number; name: string; width: number }) => {
setErrorMessage(null);
+
+ // Re-check the cap against the LIVE list: the render-time gate can be
+ // stale by the time a drop resolves or an upload lands, and another
+ // writer (a second drop, the Initial Video placing its anchor) can fill
+ // the slots meanwhile. An over-cap write would survive to normalization,
+ // whose overflow rule then has to delete SOMETHING the user placed.
+ let declined = false;
+
+ onChange((current) => {
+ if (current.filter((entry) => entry.kind === 'image').length >= maxImages) {
+ declined = true;
+
+ return current;
+ }
+
+ return [
+ ...current,
+ {
- detail: 'max',
++ // Read off the LIVE list, beside the cap re-check: which default applies
++ // depends on whether an image reference is already placed, and another
++ // writer can have placed one while this add was in flight.
++ detail: getDefaultReferenceImageDetail(current),
+ image: { height: image.height, image_name: image.name, width: image.width },
+ kind: 'image',
+ },
+ ];
+ });
+ if (declined) {
+ setErrorMessage(t('widgets.video.referenceImageCapRace', { max: maxImages }));
+ }
+ },
+ [maxImages, onChange, t]
+ );
+
+ const adoptImageByName = useCallback(
+ async (imageName: string) => {
setIsLoading(true);
try {