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(workflows): localize snapshot metadata

JPPhotoc4514f4b4ad2
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index ae08cc6288..fbd4debb68 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -1445,8 +1445,22 @@
"dependenciesRequired": "Dependencies required",
"dependenciesRequiredDescription": "{{name}} requires dependencies from {{dependencyFile}}. Install them, then restart InvokeAI.",
"details": "Node Pack Details",
+ "fieldInfo": "Field: {{name}} · Type: {{type}}",
"fieldName": "Field: {{name}}",
"fieldType": "Type: {{type}}",
+ "required": "Required",
+ "optional": "Optional",
+ "inputModes": {
+ "connection": "Connection only",
+ "direct": "Direct value only",
+ "any": "Direct value or connection"
+ },
+ "pinnedToLinearUi": "Pinned to Linear UI.",
+ "batch": "batch",
+ "any": "Any",
+ "anyInput": "Any input",
+ "anyOutput": "Any output",
+ "connectorTitle": "Connector: {{input}} → {{output}}",
"filterAndSort": "Filter and sort node packs",
"gitUrl": "Git URL",
"gitUrlHelp": "Paste a public Git repository URL. InvokeAI clones it into your custom nodes directory.",
diff --git a/invokeai/frontend/webv2/public/locales/fr.json b/invokeai/frontend/webv2/public/locales/fr.json
index 0967ef424b..d7e15f0fb0 100644
--- a/invokeai/frontend/webv2/public/locales/fr.json
+++ b/invokeai/frontend/webv2/public/locales/fr.json
@@ -1 +1,33 @@
-{}
+{
+ "nodes": {
+ "fieldInfo": "Champ : {{name}} · Type : {{type}}",
+ "fieldName": "Champ : {{name}}",
+ "fieldType": "Type : {{type}}",
+ "required": "Obligatoire",
+ "optional": "Facultatif",
+ "inputModes": {
+ "connection": "Connexion uniquement",
+ "direct": "Valeur directe uniquement",
+ "any": "Valeur directe ou connexion"
+ },
+ "pinnedToLinearUi": "Épinglé dans l’interface linéaire.",
+ "batch": "en lot",
+ "providedByConnection": "Fourni par une connexion.",
+ "any": "Tout",
+ "anyInput": "N’importe quelle entrée",
+ "anyOutput": "N’importe quelle sortie",
+ "connectorTitle": "Connecteur : {{input}} → {{output}}",
+ "nodeType": "Type : {{type}}",
+ "nodePackLabel": "Pack de nœuds : {{name}}",
+ "nodeVersion": "Version : {{version}}",
+ "nodeClassification": "Classification : {{classification}}",
+ "nodeCategory": "Catégorie : {{category}}",
+ "nodeUpdateAvailable": "Version {{from}} → {{to}} : mise à jour disponible",
+ "nodeNewerThanBackend": "La version {{from}} est plus récente que celle prise en charge par cette installation d’Invoke ({{to}}) ; mettez Invoke à jour",
+ "nodeVersionIncompatible": "La version {{from}} ne peut pas être mise à jour vers {{to}} ; supprimez et ajoutez de nouveau le nœud",
+ "noBatchGroup": "sans groupe",
+ "executionFailed": "Échec",
+ "childWorkflowError": "Erreur dans le workflow enfant : {{error}}",
+ "output": "Sortie"
+ }
+}
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx
index 6f082e2763..9141a72a37 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx
@@ -6,10 +6,11 @@ import {
getWorkflowNodeHandleStyle,
WORKFLOW_NODE_HANDLE_SIZE,
} from '@features/workflow/ui/nodeChrome';
-import { CONNECTOR_INPUT_HANDLE, CONNECTOR_OUTPUT_HANDLE, getFieldTypeLabel } from '@features/workflow/utility';
+import { CONNECTOR_INPUT_HANDLE, CONNECTOR_OUTPUT_HANDLE } from '@features/workflow/utility';
import { Tooltip } from '@platform/ui';
import { Handle, Position, type NodeProps } from '@xyflow/react';
import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import type { ConnectorFlowNode as ConnectorFlowNodeType } from './flowAdapters';
@@ -27,19 +28,13 @@ const genericHandleStyle: React.CSSProperties = {
const getConnectorHandleStyle = (type: FieldType | null, side: 'left' | 'right'): React.CSSProperties =>
type ? getWorkflowNodeHandleStyle(type, side) : genericHandleStyle;
-const getConnectorTitle = (inputType: FieldType | null, outputType: FieldType | null): string => {
- const inputLabel = inputType ? getFieldTypeLabel(inputType) : 'Any input';
- const outputLabel = outputType ? getFieldTypeLabel(outputType) : 'Any output';
-
- return `Connector: ${inputLabel} -> ${outputLabel}`;
-};
-
const ConnectorFlowNodeComponent = ({ data, selected }: NodeProps<ConnectorFlowNodeType>) => {
const node = data.documentNode;
const isWorkflowImageExport = useIsWorkflowImageExport();
- const inputTooltip = getHandleTypeTooltip(data.inputFieldType, 'Any input');
- const connectorTooltip = getConnectorTitle(data.inputFieldType, data.outputFieldType);
- const outputTooltip = getHandleTypeTooltip(data.outputFieldType, 'Any output');
+ const { t } = useTranslation();
+ const inputTooltip = getHandleTypeTooltip(data.inputFieldType, t('nodes.anyInput'), t);
+ const outputTooltip = getHandleTypeTooltip(data.outputFieldType, t('nodes.anyOutput'), t);
+ const connectorTooltip = t('nodes.connectorTitle', { input: inputTooltip, output: outputTooltip });
const inputHandleStyle = useMemo(
() => ({ ...getConnectorHandleStyle(data.inputFieldType, 'left'), left: -WORKFLOW_NODE_HANDLE_SIZE / 2 }),
[data.inputFieldType]
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
index 70275bac35..e453b467fb 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
@@ -14,6 +14,8 @@ import { memo } from 'react';
import type { CurrentImageFlowNode as CurrentImageFlowNodeType } from './flowAdapters';
+import { useIsWorkflowImageExport } from './InvocationFlowNode';
+
const getLatestImage = (values: Record<string, unknown>): GeneratedImageContract | null => {
const recentImages = Array.isArray(values.recentImages) ? (values.recentImages as GeneratedImageContract[]) : [];
@@ -23,6 +25,7 @@ const getLatestImage = (values: Record<string, unknown>): GeneratedImageContract
const CurrentImageFlowNodeComponent = ({ data, selected }: NodeProps<CurrentImageFlowNodeType>) => {
const galleryValues = useWorkflowProjectSelector((project) => project.galleryValues);
const progressImage = useProgressImage();
+ const isWorkflowImageExport = useIsWorkflowImageExport();
const node = data.documentNode;
const latestImage = getLatestImage(galleryValues);
@@ -52,7 +55,7 @@ const CurrentImageFlowNodeComponent = ({ data, selected }: NodeProps<CurrentImag
})}
fit="contain"
h="18rem"
- liveImage={progressImageToStreamingSource(progressImage)}
+ liveImage={isWorkflowImageExport ? null : progressImageToStreamingSource(progressImage)}
w="full"
>
<Flex align="center" color="fg.subtle" fontSize="2xs" h="full" justify="center" px="4" textAlign="center">
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.browser.test.tsx
index 0d40515006..0e81b5f886 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.browser.test.tsx
@@ -7,58 +7,53 @@ import type { ProjectGraphAction } from '@features/workflow/utility';
import { ChakraProvider } from '@chakra-ui/react';
import { WorkflowUiProvider } from '@features/workflow/ui/WorkflowUiContext';
import { setNodePreviewCollapsed } from '@features/workflow/ui/workflowUiStore';
-import { createProjectGraph, projectGraphReducer } from '@features/workflow/utility';
+import { buildCurrentImageNode, createProjectGraph, projectGraphReducer } from '@features/workflow/utility';
import { system } from '@theme/system';
import { applyNodeChanges, ReactFlow, type NodeChange } from '@xyflow/react';
+import { createInstance } from 'i18next';
import { act, startTransition, useCallback, useEffect, useState, useSyncExternalStore } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { page, userEvent } from 'vitest/browser';
import { ConnectorFlowNode } from './ConnectorFlowNode';
+import { CurrentImageFlowNode } from './CurrentImageFlowNode';
import { toFlowEdges, toFlowNodes } from './flowAdapters';
import { InvocationFlowNode, WorkflowImageExportProvider } from './InvocationFlowNode';
import { exportWorkflowAsPng, WORKFLOW_EXPORT_TIMEOUT_MS } from './workflowImageExport';
import '@xyflow/react/dist/style.css';
-const exportMocks = vi.hoisted(() => ({ toBlob: vi.fn() }));
+const exportMocks = vi.hoisted(() => ({
+ progressImage: null as null | { dataUrl: string; height: number; width: number },
+ toBlob: vi.fn(),
+ translate: ((key: string) => key) as (key: string, options?: Record<string, unknown>) => string,
+}));
vi.mock('html-to-image', () => ({ toBlob: exportMocks.toBlob }));
vi.mock('@platform/browser/downloadBlob', () => ({ downloadBlob: vi.fn() }));
+vi.mock('@features/queue/react', () => ({ useProgressImage: () => exportMocks.progressImage }));
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
vi.mock('react-i18next', () => ({
useTranslation: () => ({
- t: (
- key: string,
- options?: {
- category?: string;
- classification?: string;
- error?: string;
- name?: string;
- type?: string;
- version?: string;
- }
- ) =>
- ({
- 'nodes.childWorkflowError': `Child workflow error: ${options?.error ?? ''}`,
- 'nodes.executionFailed': 'Failed',
- 'nodes.executionCompleted': 'Completed',
- 'nodes.fieldName': `Field: ${options?.name ?? ''}`,
- 'nodes.fieldType': `Type: ${options?.type ?? ''}`,
- 'nodes.latestOutput': 'Latest output',
- 'nodes.latestOutputImage': 'Latest output of this node',
- 'nodes.nodeCategory': `Category: ${options?.category ?? ''}`,
- 'nodes.nodeClassification': `Classification: ${options?.classification ?? ''}`,
- 'nodes.nodePackLabel': `Node pack: ${options?.name ?? ''}`,
- 'nodes.nodeType': `Node type: ${options?.type ?? ''}`,
- 'nodes.nodeVersion': `Node version: ${options?.version ?? ''}`,
- 'nodes.output': 'Output',
- })[key] ?? key,
+ t: exportMocks.translate,
}),
}));
+const i18n = createInstance();
+await i18n.init({
+ fallbackLng: 'en',
+ fallbackNS: 'translation',
+ interpolation: { escapeValue: false },
+ lng: 'en',
+ resources: {
+ en: { translation: await fetch('/locales/en.json').then((response) => response.json()) },
+ fr: { translation: await fetch('/locales/fr.json').then((response) => response.json()) },
+ },
+});
+exportMocks.translate = (key, options) => i18n.t(key, options as never) as unknown as string;
+
const NODE_ID = 'preview-node';
/** The preview's fixed height (10rem) in CSS pixels, however the root font is sized. */
const previewHeightPx = () => parseFloat(getComputedStyle(document.documentElement).fontSize) * 10;
@@ -129,7 +124,10 @@ const documentNode: WorkflowInvocationNode = {
const projectGraph: ProjectGraphState = { ...createProjectGraph('preview-test'), nodes: [documentNode] };
const templates = { preview: template };
const flowNodes = toFlowNodes(projectGraph, [], templates);
-const nodeTypes = { connector: ConnectorFlowNode, invocation: InvocationFlowNode };
+const currentImageNode = buildCurrentImageNode({ x: 20, y: 20 });
+const currentImageGraph: ProjectGraphState = { ...createProjectGraph('current-image-test'), nodes: [currentImageNode] };
+const currentImageNodes = toFlowNodes(currentImageGraph, []);
+const nodeTypes = { connector: ConnectorFlowNode, current_image: CurrentImageFlowNode, invocation: InvocationFlowNode };
const callNodeId = 'call-node';
const callNode: WorkflowInvocationNode = {
@@ -197,10 +195,10 @@ const preferencesSnapshot = {
workflowValidateConnections: true,
};
const PROJECT_ID = 'project-1';
-const projectSnapshotFor = (graph: ProjectGraphState) => ({
+const projectSnapshotFor = (graph: ProjectGraphState, galleryValues: Record<string, unknown> = {}) => ({
activeWorkflow: { document: graph },
activeWorkflowId: graph.id,
- galleryValues: {},
+ galleryValues,
id: PROJECT_ID,
isWorkflowRunning: false,
projectGraph: graph,
@@ -219,7 +217,8 @@ const withOrigin = (
});
const createAdapter = (
- nodeExecution: Pick<WorkflowUiAdapter['nodeExecution'], 'get' | 'subscribe'>
+ nodeExecution: Pick<WorkflowUiAdapter['nodeExecution'], 'get' | 'subscribe'>,
+ snapshot = projectSnapshot
): WorkflowUiAdapter =>
({
capabilities: { getSnapshot: () => ({ canUseCache: true }), subscribe: () => () => {} },
@@ -235,7 +234,7 @@ const createAdapter = (
setWorkflowSource: vi.fn(),
undo: vi.fn(),
},
- getProjectGraph: () => projectGraph,
+ getProjectGraph: () => snapshot.projectGraph,
nodeExecution: withOrigin(nodeExecution),
notifications: { error: vi.fn(), info: vi.fn(), success: vi.fn() },
openAddModels: vi.fn(),
@@ -245,7 +244,7 @@ const createAdapter = (
time: <T,>(_name: string, _source: unknown, callback: () => T) => callback(),
},
preferences: { getSnapshot: () => preferencesSnapshot, subscribe: () => () => {} },
- project: { getSnapshot: () => projectSnapshot, subscribe: () => () => {} },
+ project: { getSnapshot: () => snapshot, subscribe: () => () => {} },
registerModalHotkeyLayer: vi.fn(() => vi.fn()),
widgets: { open: vi.fn(), patchValues: vi.fn() },
}) as unknown as WorkflowUiAdapter;
@@ -265,6 +264,8 @@ describe('InvocationFlowNode output preview', () => {
afterEach(async () => {
await act(() => root.unmount());
host.remove();
+ exportMocks.progressImage = null;
+ await i18n.changeLanguage('en');
});
const render = (adapter: WorkflowUiAdapter, zoom = 1, isExporting = false, nodes = flowNodes) =>
@@ -361,9 +362,9 @@ describe('InvocationFlowNode output preview', () => {
expect(capturedClone?.textContent).toContain('Node export note');
expect(capturedClone?.textContent).toContain('Field export description');
expect(capturedClone?.textContent).toContain('Output export description');
- expect(capturedClone?.textContent).toContain('Node type: preview');
+ expect(capturedClone?.textContent).toContain('Type: preview');
expect(capturedClone?.textContent).toContain('Node pack: invokeai');
- expect(capturedClone?.textContent).toContain('Node version: 1.0.0');
+ expect(capturedClone?.textContent).toContain('Version: 1.0.0');
expect(capturedClone?.textContent).toContain('Classification: stable');
expect(capturedClone?.textContent).toContain('Category: Export category');
expect(capturedClone?.textContent).toContain('Field: a');
@@ -371,7 +372,7 @@ describe('InvocationFlowNode output preview', () => {
expect(capturedClone?.textContent).toContain('Connection only');
expect(capturedClone?.textContent).toContain('Output');
expect(capturedClone?.textContent).toContain('Any input');
- expect(capturedClone?.textContent).toContain('Connector: Any input -> Any output');
+ expect(capturedClone?.textContent).toContain('Connector: Any input → Any output');
expect(capturedClone?.textContent).toContain('Any output');
expect(capturedClone?.textContent).toContain(longOutput);
const outputTitle = capturedClone?.querySelector<HTMLElement>('[data-workflow-export-output-title="true"]');
@@ -416,6 +417,139 @@ describe('InvocationFlowNode output preview', () => {
expect(capturedClone?.querySelector('[data-node-progress-strip="true"]')).toBeNull();
});
+ it('uses the saved current image in exports while the editor shows the live generation frame', async () => {
+ const liveImageUrl = 'data:image/png;base64,bGl2ZQ==';
+ const savedImageUrl = 'data:image/png;base64,c2F2ZWQ=';
+ let capturedClone: HTMLElement | undefined;
+ exportMocks.progressImage = { dataUrl: liveImageUrl, height: 2, width: 2 };
+ exportMocks.toBlob.mockImplementation((clone: HTMLElement) => {
+ capturedClone = clone;
+ return Promise.resolve(new Blob(['png'], { type: 'image/png' }));
+ });
+ const savedImage = {
+ height: 2,
+ imageName: 'saved.png',
+ imageUrl: savedImageUrl,
+ queuedAt: '2026-01-01T00:00:00Z',
+ sourceQueueItemId: 'queue-item',
+ thumbnailUrl: savedImageUrl,
+ width: 2,
+ };
+ const adapter = createAdapter(
+ createExecutionPort().port,
+ projectSnapshotFor(currentImageGraph, { recentImages: [savedImage] })
+ );
+
+ await render(adapter, 1, false, currentImageNodes);
+ expect(host.querySelector<HTMLImageElement>('.react-flow__node img')?.src).toBe(liveImageUrl);
+
+ await render(adapter, 1, true, currentImageNodes);
+ const flowElement = host.querySelector<HTMLElement>('.react-flow')!;
+ await exportWorkflowAsPng({
+ bounds: { x: 20, y: 20, width: 300, height: 260 },
+ fallbackWorkflowName: 'Untitled Workflow',
+ flowElement,
+ workflowName: 'Current image',
+ });
+
+ const exportedImage = capturedClone?.querySelector<HTMLImageElement>('.react-flow__node img');
+ expect(exportedImage?.src).toBe(savedImageUrl);
+ expect(exportedImage?.src).not.toBe(liveImageUrl);
+ });
+
+ it('localizes exported field and connector metadata using the selected language catalog', async () => {
+ await i18n.changeLanguage('fr');
+ const batchType = { ...template.inputs.a!.type, batch: true };
+ const localizedTemplate: InvocationTemplate = {
+ ...template,
+ inputs: { a: { ...template.inputs.a!, required: true, type: batchType } },
+ outputs: { value: { ...template.outputs.value!, type: batchType } },
+ };
+ const localizedNode: WorkflowInvocationNode = {
+ ...documentNode,
+ data: { ...documentNode.data, inputs: { a: { label: 'A', name: 'a', value: null } } },
+ };
+ const connector = {
+ data: { label: '' },
+ id: 'localized-connector',
+ position: { x: 380, y: 300 },
+ type: 'connector' as const,
+ };
+ const batchConnector = {
+ data: { label: '' },
+ id: 'localized-batch-connector',
+ position: { x: 500, y: 300 },
+ type: 'connector' as const,
+ };
+ const graph = { ...projectGraph, nodes: [localizedNode, connector, batchConnector] };
+ const nodes = toFlowNodes(graph, [], { preview: localizedTemplate });
+ const localizedConnector = nodes.find(
+ (node) => node.type === 'connector' && node.data.documentNode.id === 'localized-batch-connector'
+ );
+ if (localizedConnector?.type === 'connector') {
+ localizedConnector.data.inputFieldType = batchType;
+ localizedConnector.data.outputFieldType = batchType;
+ }
+ const adapter = createAdapter(createExecutionPort().port, projectSnapshotFor(graph));
+ let capturedClone: HTMLElement | undefined;
+ exportMocks.toBlob.mockImplementation((clone: HTMLElement) => {
+ capturedClone = clone;
+ return Promise.resolve(new Blob(['png'], { type: 'image/png' }));
+ });
+
+ await render(adapter, 1, true, nodes);
+ const flowElement = host.querySelector<HTMLElement>('.react-flow')!;
+ await exportWorkflowAsPng({
+ bounds: { x: 20, y: 20, width: 300, height: 260 },
+ fallbackWorkflowName: 'Untitled Workflow',
+ flowElement,
+ workflowName: 'Workflow localisé',
+ });
+
+ const exportedText = capturedClone?.textContent ?? '';
+ expect(exportedText).toContain('Champ : a');
+ expect(exportedText).toContain('Type : Integer');
+ expect(exportedText).toContain('Obligatoire');
+ expect(exportedText).toContain('Connexion uniquement');
+ expect(exportedText).toContain('Integer en lot');
+ expect(exportedText).not.toContain(' batch');
+ expect(exportedText).toContain('N’importe quelle entrée');
+ expect(exportedText).toContain('Connecteur : N’importe quelle entrée → N’importe quelle sortie');
+ expect(exportedText).toContain('N’importe quelle sortie');
+ });
+
+ it('includes a failed node reason in the export even though its outcome icon is hidden', async () => {
+ const execution = createExecutionPort(callNodeId);
+ execution.set({
+ error: 'Child node failed',
+ latestOutput: null,
+ outputImageUrl: null,
+ progress: null,
+ progressMessage: null,
+ status: 'failed',
+ });
+ const adapter = createAdapter(execution.port);
+ let capturedClone: HTMLElement | undefined;
+ exportMocks.toBlob.mockImplementation((clone: HTMLElement) => {
+ capturedClone = clone;
+ return Promise.resolve(new Blob(['png'], { type: 'image/png' }));
+ });
+
+ await render(adapter, 1, true, callFlowNodes);
+ const flowElement = host.querySelector<HTMLElement>('.react-flow')!;
+ await exportWorkflowAsPng({
+ bounds: { x: 20, y: 20, width: 300, height: 260 },
+ fallbackWorkflowName: 'Untitled Workflow',
+ flowElement,
+ workflowName: 'Failed workflow',
+ });
+
+ expect(capturedClone?.querySelector('[data-node-status-indicator="true"]')?.getAttribute('style')).toContain(
+ 'display: none'
+ );
+ expect(capturedClone?.textContent).toContain('Failed: Child workflow error: Child node failed');
+ });
+
it('blocks a third capture after two timeouts and recovers when one rasterization settles', async () => {
vi.useFakeTimers();
exportMocks.toBlob.mockClear();
@@ -973,7 +1107,7 @@ describe('InvocationFlowNode template version', () => {
</ChakraProvider>
)
);
- const updateIcon = () => host.querySelector('.react-flow__node [role="img"][aria-label^="nodes.node"]');
+ const updateIcon = () => host.querySelector('.react-flow__node [role="img"][aria-label*="Version"]');
const borderColor = () => getComputedStyle(host.querySelector<HTMLElement>('.react-flow__node > div')!).borderColor;
it('marks a node whose template moved on with a warning border and an update tooltip, and leaves a current one alone', async () => {
@@ -982,11 +1116,13 @@ describe('InvocationFlowNode template version', () => {
const currentBorder = borderColor();
await render(toFlowNodes(projectGraph, [], { preview: { ...template, version: '1.1.0' } }));
- expect(updateIcon()?.getAttribute('aria-label')).toBe('nodes.nodeUpdateAvailable');
+ expect(updateIcon()?.getAttribute('aria-label')).toBe('Version 1.0.0 → 1.1.0: update available');
expect(borderColor()).not.toBe(currentBorder);
await render(toFlowNodes(projectGraph, [], { preview: { ...template, version: '2.0.0' } }));
- expect(updateIcon()?.getAttribute('aria-label')).toBe('nodes.nodeVersionIncompatible');
+ expect(updateIcon()?.getAttribute('aria-label')).toBe(
+ 'Version 1.0.0 cannot be updated to 2.0.0; delete and re-add the node'
+ );
});
});
@@ -1077,6 +1213,6 @@ describe('InvocationFlowNode batch nodes', () => {
expect(host.textContent).not.toContain('Use Cache');
await render('None');
- expect(header().textContent).toContain('(nodes.noBatchGroup)');
+ expect(header().textContent).toContain('(no group)');
});
});
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
index 9f66204f4e..548e3853ec 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
@@ -273,18 +273,6 @@ const NodeTitle = ({ node, title }: { node: WorkflowInvocationNode; title: strin
);
};
-const getInputModeLabel = (input: FieldInputTemplate['input']): string => {
- if (input === 'connection') {
- return 'Connection only';
- }
-
- if (input === 'direct') {
- return 'Direct value only';
- }
-
- return 'Direct value or connection';
-};
-
const InputFieldTooltip = ({
description,
isConnected,
@@ -297,19 +285,22 @@ const InputFieldTooltip = ({
isExposed: boolean;
label: string;
template: FieldInputTemplate;
-}) => (
- <Stack gap="0.5" maxW="18rem">
- <Text fontWeight="700">{label}</Text>
- <Text color="fg.subtle">Field: {template.name}</Text>
- <Text color="fg.subtle">Type: {getFieldTypeLabel(template.type)}</Text>
- <Text color="fg.subtle">
- {template.required ? 'Required' : 'Optional'} · {getInputModeLabel(template.input)}
- </Text>
- {isConnected ? <Text color="fg.subtle">Connected by graph edge.</Text> : null}
- {isExposed ? <Text color="fg.subtle">Pinned to Linear UI.</Text> : null}
- {description ? <Text>{description}</Text> : null}
- </Stack>
-);
+}) => {
+ const { t } = useTranslation();
+
+ return (
+ <Stack gap="0.5" maxW="18rem">
+ <Text fontWeight="700">{label}</Text>
+ <Text color="fg.subtle">
+ {t('nodes.fieldInfo', { name: template.name, type: getFieldTypeLabel(template.type) })} ·{' '}
+ {t(template.required ? 'nodes.required' : 'nodes.optional')} · {t(`nodes.inputModes.${template.input}`)}
+ {isConnected ? ` · ${t('nodes.providedByConnection')}` : null}
+ {isExposed ? ` · ${t('nodes.pinnedToLinearUi')}` : null}
+ </Text>
+ {description ? <Text>{description}</Text> : null}
+ </Stack>
+ );
+};
const OutputFieldTooltip = ({
includeTitle = true,
@@ -323,9 +314,9 @@ const OutputFieldTooltip = ({
return (
<Stack gap="0.5" maxW="18rem">
{includeTitle ? <Text fontWeight="700">{template.title}</Text> : null}
- <Text color="fg.subtle">{t('nodes.fieldName', { name: template.name })}</Text>
- <Text color="fg.subtle">{t('nodes.fieldType', { type: getFieldTypeLabel(template.type) })}</Text>
- <Text color="fg.subtle">{t('nodes.output')}</Text>
+ <Text color="fg.subtle">
+ {t('nodes.fieldInfo', { name: template.name, type: getFieldTypeLabel(template.type) })} · {t('nodes.output')}
+ </Text>
{template.description ? <Text>{template.description}</Text> : null}
</Stack>
);
@@ -400,9 +391,11 @@ const NodeUpdateIcon = ({
};
const NodeInfoTooltipContent = ({
+ executionError,
node,
template,
}: {
+ executionError?: string | null;
node: WorkflowInvocationNode;
template: InvocationNodeTemplateView['template'];
}) => {
@@ -420,6 +413,11 @@ const NodeInfoTooltipContent = ({
{updateStatusText ? <Text color="fg.warning">{updateStatusText}</Text> : null}
<Text color="fg.subtle">{t('nodes.nodeClassification', { classification: template.classification })}</Text>
<Text color="fg.subtle">{t('nodes.nodeCategory', { category: template.category })}</Text>
+ {executionError ? (
+ <Text color="fg.error">
+ {t('nodes.executionFailed')}: {executionError}
+ </Text>
+ ) : null}
{template.description ? <Text fontStyle="italic">{template.description}</Text> : null}
{node.data.notes ? <Text>{node.data.notes}</Text> : null}
</Stack>
@@ -587,6 +585,7 @@ const InputFieldRow = ({
template: FieldInputTemplate;
}) => {
const isWorkflowImageExport = useIsWorkflowImageExport();
+ const { t } = useTranslation();
const { editGraph } = useProjectGraphCommands();
const instance = node.data.inputs[template.name];
const fieldIdentifier = { fieldName: template.name, nodeId: node.id };
@@ -599,7 +598,7 @@ const InputFieldRow = ({
value: instance?.value,
});
const isInvalid = invalidReason !== null;
- const handleTooltip = getHandleTypeTooltip(template.type);
+ const handleTooltip = getHandleTypeTooltip(template.type, t('nodes.any'), t);
const canReset = showsControl && !isWorkflowFieldValueDefault(template, instance?.value);
if (isSkeleton) {
@@ -763,7 +762,8 @@ const OutputFieldRow = ({
template: FieldOutputTemplate;
}) => {
const isWorkflowImageExport = useIsWorkflowImageExport();
- const handleTooltip = getHandleTypeTooltip(template.type);
+ const { t } = useTranslation();
+ const handleTooltip = getHandleTypeTooltip(template.type, t('nodes.any'), t);
const value = latestResult === undefined ? null : formatOutputFieldValue(latestResult, template.name);
return (
@@ -1055,7 +1055,11 @@ const ExpandedInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNode
</Flex>
{isWorkflowImageExport ? (
<Box data-workflow-export-content="true" maxW="full" px={WORKFLOW_NODE_DENSITY.rowPaddingX} py="1">
- <NodeInfoTooltipContent node={node} template={template} />
+ <NodeInfoTooltipContent
+ executionError={execution?.status === 'failed' ? getNodeExecutionError(node, execution.error, t) : null}
+ node={node}
+ template={template}
+ />
</Box>
) : null}
<NodeProgressStrip execution={execution} />
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/handleTooltip.ts b/invokeai/frontend/webv2/src/features/workflow/ui/editor/handleTooltip.ts
index deecc52267..b6a6f264cf 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/handleTooltip.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/handleTooltip.ts
@@ -2,12 +2,16 @@ import type { FieldType } from '@features/workflow/contracts';
import { getFieldTypeLabel } from '@features/workflow/utility';
-export const getHandleTypeTooltip = (type: FieldType | null, fallback = 'Any'): string => {
+export const getHandleTypeTooltip = (
+ type: FieldType | null,
+ fallback = 'Any',
+ translate?: (key: string) => string
+): string => {
if (!type) {
return fallback;
}
const label = getFieldTypeLabel(type);
- return type.batch ? `${label} batch` : label;
+ return type.batch ? `${label} ${translate?.('nodes.batch') ?? 'batch'}` : label;
};