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 remote-tracking branch 'origin/main' into fix/canvas-v7-feedback

Josh Corbettd437cd378712
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.browser.test.tsx
index c958aa8b15,1782377a1e..868d399ef7
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.browser.test.tsx
@@@ -1,12 -1,7 +1,12 @@@
/* oxlint-disable react-perf/jsx-no-new-object-as-prop */
- import type { GenerateSettings, MainModelConfig } from '@features/generation/core/types';
+ import type { GenerateModelConfig, GenerateSettings, MainModelConfig } from '@features/generation/core/types';
import { ChakraProvider } from '@chakra-ui/react';
+import {
+ resetArchitectureCapabilities,
+ setArchitectureCapabilities,
+} from '@features/generation/core/architectureCapabilities';
+import { architectureCapabilitiesFixture } from '@features/generation/core/architectureCapabilities.testing';
import { getDefaultGenerateSettings } from '@features/generation/core/baseGenerationPolicies';
import { createExternalStoreCore } from '@platform/state/externalStoreCore';
import { system } from '@theme/system';
@@@ -14,11 -9,14 +14,15 @@@ import { createInstance } from 'i18next
import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { I18nextProvider, initReactI18next } from 'react-i18next';
-import { afterEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { userEvent } from 'vitest/browser';
+ import type { CanvasRenderSizeProps } from './GenerationUiContext';
+
import { GenerateDimensionFields } from './GenerateDimensionFields';
+ const harness = vi.hoisted(() => ({ invocationSourceId: 'generate' }));
+
vi.mock('./GenerationUiContext', () => ({
useGenerationQueueInsights: (select: (insights: unknown) => unknown) =>
select({ secondsPerRun: null, seedHistory: [] }),
@@@ -43,11 -47,7 +53,12 @@@ void i18n.use(initReactI18next).init(
height: 'Height',
lockAspectRatio: 'Lock aspect ratio',
megapixelsValue: '{{value}} MP',
+ providerSize: 'Provider size',
+ resetSize: 'Reset size',
+ resetSizeModelDefaults: 'Model defaults',
+ resetSizeOptimalForCurrentRatio: 'Optimal size for current ratio',
+ resetSizeOptimalForRatio: 'Optimal size for {{ratio}}',
+ resetSizeSquareNative: 'Square at native size',
size: 'Size',
swapWidthAndHeight: 'Swap width and height',
unlockAspectRatio: 'Unlock aspect ratio',
@@@ -111,9 -119,85 +131,90 @@@ const unmountAndReset = async () =>
host?.remove();
host = null;
root = null;
+};
+
- afterEach(unmountAndReset);
++afterEach(async () => {
++ harness.invocationSourceId = 'generate';
++ await unmountAndReset();
+ });
+
+ describe('GenerateDimensionFields canvas render size', () => {
+ it('lays out the render-size controls and the resized badge for a local model on the canvas', async () => {
+ harness.invocationSourceId = 'canvas';
+ await render({ height: 512, width: 512 });
+
+ expect(host?.querySelector('[data-testid="render-size-controls"]')).not.toBeNull();
+ expect(host?.textContent).toContain('512x512 → 1024x1024');
+ });
+
+ it('shows a hosted provider only the frame, which is the size the provider is asked for', async () => {
+ harness.invocationSourceId = 'canvas';
+ await render({ height: 512, width: 512 }, gptImage);
+
+ expect(host?.querySelector('[data-testid="render-size-controls"]')).toBeNull();
+ expect(host?.textContent).not.toContain('→');
+ expect(host?.textContent).toContain('512x512');
+ });
+ });
+
+ describe('GenerateDimensionFields provider size', () => {
+ const geminiImage: GenerateModelConfig = {
+ ...gptImage,
+ provider_id: 'gemini',
+ capabilities: {
+ modes: ['txt2img'],
+ resolution_presets: [
+ { aspect_ratio: '1:1', height: 1024, image_size: '1K', label: '1:1 (1K)', width: 1024 },
+ { aspect_ratio: '16:9', height: 1152, image_size: '2K', label: '16:9 (2K)', width: 2048 },
+ ],
+ },
+ };
+ const providerTrigger = () => {
+ const providerLabel = [...(host?.querySelectorAll('label') ?? [])].find(
+ (label) => label.textContent === 'Provider size'
+ );
+
+ return host?.querySelector<HTMLButtonElement>(`[role="combobox"][aria-labelledby~="${providerLabel?.id}"]`) ?? null;
+ };
+
+ it('selects the preset from the panel dimensions, breaking a same-size tie by the stored name', async () => {
+ await render({ externalImageSize: null, height: 1152, width: 2048 }, geminiImage);
+ expect(providerTrigger()?.textContent).toContain('16:9 (2K)');
+
+ await settle(() => root?.unmount());
+ host?.remove();
+
+ const duplicateSizes: GenerateModelConfig = {
+ ...geminiImage,
+ capabilities: {
+ modes: ['txt2img'],
+ resolution_presets: [
+ ...(geminiImage.capabilities?.resolution_presets ?? []),
+ { aspect_ratio: '1:1', height: 1024, image_size: 'HD', label: '1:1 (HD)', width: 1024 },
+ ],
+ },
+ };
+ await render({ externalImageSize: 'HD', height: 1024, width: 1024 }, duplicateSizes);
+ expect(providerTrigger()?.textContent).toContain('1:1 (HD)');
+ });
+
+ it('commits the hosted preset through the dimension panel with its dimensions and name', async () => {
- const onCommit = await render({ externalImageSize: null, height: 1024, width: 1024 }, geminiImage);
++ const { onCommit } = await render({ externalImageSize: null, height: 1024, width: 1024 }, geminiImage);
+
+ expect(providerTrigger()?.textContent).toContain('1:1 (1K)');
+ await settle(() => providerTrigger()?.click());
+ await settle(() => document.querySelector<HTMLElement>('[role="option"][data-value="16:9|2K"]')?.click());
+
+ expect(onCommit).toHaveBeenCalledWith({
+ aspectRatioId: '16:9',
+ aspectRatioIsLocked: true,
+ aspectRatioValue: 2048 / 1152,
+ externalImageSize: '2K',
+ height: 1152,
+ width: 2048,
+ });
+ });
+ });
describe('GenerateDimensionFields aspect ratio', () => {
it('reshapes the size to a chosen preset and locks it', async () => {
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx
index 8e9533fe1c,be5cfd452c..fb172e331a
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx
@@@ -1,23 -1,20 +1,22 @@@
/* eslint-disable react-perf/jsx-no-new-object-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-jsx-as-prop */
import type { AspectRatioId, GenerateModelConfig, GenerateSettings } from '@features/generation/core/types';
-import { Badge, Box, HStack, Icon, Stack, Text } from '@chakra-ui/react';
+import { Badge, Box, HStack, Icon, Menu, Portal, Stack, Text } from '@chakra-ui/react';
import { getDefaultGenerateSettings, getGenerationDimensions } from '@features/generation/core/baseGenerationPolicies';
+ import { MAX_DIMENSION, MIN_DIMENSION } from '@features/generation/core/dimensionLimits';
import {
ASPECT_RATIO_MAP,
calculateNewSize,
clampDimension,
deriveAspectRatioId,
isAspectRatioLocked,
- MAX_DIMENSION,
- MIN_DIMENSION,
} from '@features/generation/core/settings';
import { useExternalStoreSelector } from '@platform/state/selectors';
-import { Button, IconButton, Tooltip } from '@platform/ui';
+import { IconButton } from '@platform/ui/Button';
+import { MenuContent } from '@platform/ui/Menu';
import { ScrubberField } from '@platform/ui/ScrubberField';
-import { ArrowLeftRightIcon, LockIcon } from 'lucide-react';
+import { Tooltip, useTooltipTriggerIds } from '@platform/ui/Tooltip';
+import { ArrowLeftRightIcon, CheckIcon, LockIcon, RotateCcwIcon } from 'lucide-react';
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx
index 3a6e328efd,31d9533907..335e336775
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx
@@@ -22,9 -22,9 +22,10 @@@ import { useRegisterGenerateDraftFlushe
import { getSettingsWithLatestPromptFields } from './generateFormViewModel';
import { GenerateGuidanceSection } from './GenerateGuidanceSection';
import { GenerateModelCard } from './GenerateModelCard';
+ import { GenerateProviderOptionsSection } from './GenerateProviderOptionsSection';
import { GenerateRefinerSection } from './GenerateRefinerSection';
import { GenerateRenderSection } from './GenerateRenderSection';
+import { useGenerationUi } from './GenerationUiContext';
import { GeneratePromptFields } from './promptFields';
const GENERATE_INPUT_DEBOUNCE_MS = 250;
diff --cc invokeai/frontend/webv2/src/workbench/settings/contracts.ts
index 58715549bc,e1a0418496..9a011f63ab
--- a/invokeai/frontend/webv2/src/workbench/settings/contracts.ts
+++ b/invokeai/frontend/webv2/src/workbench/settings/contracts.ts
@@@ -101,10 -107,12 +107,14 @@@ export interface WorkbenchPreferences
workflowEdgeStyle: 'curved' | 'square';
/** Keep connections of a selected node beneath nodes instead of raising them over node controls. */
workflowEdgesBehindNodes: boolean;
+ /** Order of the workflow library's own templates. */
+ workflowLibrarySort: WorkflowLibrarySortId;
+ /** How workflow library and project cards show their thumbnails. */
+ workflowLibraryThumbnailFit: WorkflowLibraryThumbnailFit;
/** Raise text and border contrast on every theme (a11y). */
highContrast: boolean;
+ /** Select Object processes each prompt edit automatically; kept across sessions, Reset, and reloads. */
+ selectObjectAutoProcess: boolean;
/** Account-bound overrides keyed by hotkey id (`app.invoke`, `gallery.galleryNavLeft`, etc.). */
customHotkeys: Record<string, string[]>;
/** Generate panel section open/closed overrides keyed by section id; absent = section default. */