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.

feat(webv2): find workflow images in the gallery

Josh Corbett3d9cbb41ef29
diff --git a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
index 35491e258b..bfce0bd691 100644
--- a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
+++ b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
@@ -21,6 +21,7 @@ import { shallowEqual } from '@platform/state/selectors';
import { focusOpenedWidget } from '@workbench/focusRegions';
import { resolveAndSubmitGraphPreviewInvocation } from '@workbench/graphPreviewInvocation';
import { registerHotkeyModalLayer } from '@workbench/hotkeys';
+import { useFindGalleryItem } from '@workbench/image-actions/useFindGalleryItem';
import {
createInvocationRouteInputSelector,
formatRoute,
@@ -246,6 +247,7 @@ export const WorkflowUiAdapterProvider = ({ children }: { children: ReactNode })
[]
);
+ const findInGallery = useFindGalleryItem();
const adapter = useMemo<WorkflowUiAdapter>(
() => ({
capabilities,
@@ -264,6 +266,7 @@ export const WorkflowUiAdapterProvider = ({ children }: { children: ReactNode })
commands.workflows.setSource(target.projectId, target.workflowId, source),
undo: commands.workflows.undo,
},
+ findInGallery,
getProjectGraph: () => getActiveProjectWorkflow(queries.getSnapshot().activeProject).document,
nodeExecution: {
get: nodeExecutionStore.get,
@@ -297,7 +300,18 @@ export const WorkflowUiAdapterProvider = ({ children }: { children: ReactNode })
patchValues: (widgetId, values) => commands.widgets.patchValues(widgetId, values),
},
}),
- [capabilities, commands, notify.error, notify.info, notify.success, persistence, preferences, project, queries]
+ [
+ capabilities,
+ commands,
+ findInGallery,
+ notify.error,
+ notify.info,
+ notify.success,
+ persistence,
+ preferences,
+ project,
+ queries,
+ ]
);
return (
diff --git a/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.test.ts b/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.test.ts
index 932876974f..69ef775a6d 100644
--- a/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.test.ts
+++ b/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.test.ts
@@ -1,13 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-vi.mock('./transport', () => ({
- browserNodesDataPort: {
- buildUrl: (path: string) => `https://api.test${path}`,
- request: vi.fn(),
- requestJson: vi.fn(),
- },
-}));
-
import { nodeExecutionStore } from './nodeExecutionStore';
beforeEach(() => {
@@ -21,7 +13,7 @@ describe('node execution lifecycle', () => {
expect(nodeExecutionStore.get('node-1')).toMatchObject({
latestOutput: { type: 'integer_output', value: 1 },
- outputImageUrl: null,
+ outputImageName: null,
status: 'completed',
});
});
@@ -35,7 +27,7 @@ describe('node execution lifecycle', () => {
expect(nodeExecutionStore.get('node-1')).toEqual({
error: 'Out of memory',
- outputImageUrl: 'https://api.test/api/v1/images/i/result%20image.png/thumbnail',
+ outputImageName: 'result image.png',
latestOutput: { image: { image_name: 'result image.png' } },
progress: null,
progressMessage: null,
@@ -61,9 +53,7 @@ describe('node execution lifecycle', () => {
},
});
- expect(nodeExecutionStore.get('call-node')?.outputImageUrl).toBe(
- 'https://api.test/api/v1/images/i/returned%20image.png/thumbnail'
- );
+ expect(nodeExecutionStore.get('call-node')?.outputImageName).toBe('returned image.png');
});
it('settles the named running nodes to the run outcome without disturbing terminal or other nodes', () => {
diff --git a/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.ts b/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.ts
index 38e1b9483c..fdcb556d71 100644
--- a/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.ts
+++ b/invokeai/frontend/webv2/src/features/nodes/data/nodeExecutionStore.ts
@@ -8,8 +8,6 @@ import { getFirstOutputImageName } from '@platform/core/outputImages';
import { registerAccountOwnedResource } from '@platform/state/accountLifecycle';
import { createExternalStore, createKeyedTransientStore } from '@platform/state/externalStore';
-import { browserNodesDataPort } from './transport';
-
/**
* Keep transient execution state outside the workbench reducer; subscribe per source node ID to isolate frequent
* renders.
@@ -25,8 +23,8 @@ export interface NodeExecutionState {
/** 0..1, or null while indeterminate. Only meaningful while running. */
progress: number | null;
progressMessage: string | null;
- /** Thumbnail of the node's most recent image output, when it produced one. */
- outputImageUrl: string | null;
+ /** The node's most recent image output, when it produced one. */
+ outputImageName: string | null;
/** The node's most recent invocation result in the current run (a loop body runs many times). */
latestOutput: unknown;
error: string | null;
@@ -71,9 +69,7 @@ export const nodeExecutionStore = {
stateByNodeId.set(event.invocation_source_id, {
error: null,
- outputImageUrl: imageName
- ? browserNodesDataPort.buildUrl(`/api/v1/images/i/${encodeURIComponent(imageName)}/thumbnail`)
- : null,
+ outputImageName: imageName ?? null,
latestOutput: event.result,
progress: null,
progressMessage: null,
@@ -85,7 +81,7 @@ export const nodeExecutionStore = {
stateByNodeId.set(event.invocation_source_id, {
error: event.error_message,
- outputImageUrl: previous?.outputImageUrl ?? null,
+ outputImageName: previous?.outputImageName ?? null,
latestOutput: previous?.latestOutput ?? null,
progress: null,
progressMessage: null,
@@ -97,7 +93,7 @@ export const nodeExecutionStore = {
stateByNodeId.set(nodeId, {
error: null,
- outputImageUrl: previous?.outputImageUrl ?? null,
+ outputImageName: previous?.outputImageName ?? null,
latestOutput: previous?.latestOutput ?? null,
progress: percentage,
progressMessage: message,
@@ -136,7 +132,7 @@ export const nodeExecutionStore = {
stateByNodeId.set(event.invocation_source_id, {
error: null,
- outputImageUrl: previous?.outputImageUrl ?? null,
+ outputImageName: previous?.outputImageName ?? null,
latestOutput: previous?.latestOutput ?? null,
progress: null,
progressMessage: null,
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx
index 1648009f55..3e51aeac53 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx
@@ -57,7 +57,7 @@ const projectState = (id = 'project-1', projectGraph: ProjectGraphState = create
const NODE_STATE = {
error: null,
latestOutput: null,
- outputImageUrl: null,
+ outputImageName: null,
progress: 0.5,
progressMessage: null,
status: 'running' as const,
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx
index 5b13b74ddf..8b7c629852 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx
@@ -1,3 +1,4 @@
+import type { GalleryItemRef } from '@features/gallery/contracts';
import type { ForLoopValidationReason } from '@features/workflow/core/forLoops';
import type { ProjectGraphState, ProjectWorkflowEntry, ProjectWorkflowSource } from '@features/workflow/core/types';
import type { WorkbenchThemeId } from '@theme/themes';
@@ -87,6 +88,8 @@ export interface WorkflowUiAdapter {
measure(name: string, start: string, source: WorkflowPerfSource, end?: string): void;
time<T>(name: string, source: WorkflowPerfSource, callback: () => T): T;
};
+ /** Raises the gallery and selects the item, as the other media fields' find buttons do. */
+ findInGallery(ref: GalleryItemRef): void;
/** Leaves the editor for the model manager's Add Models section, searching for `query`. */
openAddModels(query: string): void;
registerModalHotkeyLayer(id: string): () => void;
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts b/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts
index 73f394762e..17807005ae 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts
@@ -73,7 +73,8 @@ export interface WorkflowNodeExecutionState {
status: 'running' | 'completed' | 'failed';
progress: number | null;
progressMessage: string | null;
- outputImageUrl: string | null;
+ /** The node's most recent image output, when it produced one. */
+ outputImageName: string | null;
/** The most recent invocation result of the current run. */
latestOutput: unknown;
error: string | null;
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 5665166214..7ceb69e679 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
@@ -188,10 +188,10 @@ const outputImage = (width: number, height: number): string => {
return canvas.toDataURL();
};
-const completed = (outputImageUrl: string): WorkflowNodeExecutionState => ({
+const completed = (outputImageName: string): WorkflowNodeExecutionState => ({
error: null,
latestOutput: null,
- outputImageUrl,
+ outputImageName,
progress: null,
progressMessage: null,
status: 'completed',
@@ -546,7 +546,7 @@ describe('InvocationFlowNode chrome and export', () => {
execution.set({
error: null,
latestOutput: { value: longOutput },
- outputImageUrl: 'data:image/png;base64,cHJldmlldw==',
+ outputImageName: 'data:image/png;base64,cHJldmlldw==',
progress: null,
progressMessage: null,
status: 'completed',
@@ -931,7 +931,7 @@ describe('InvocationFlowNode chrome and export', () => {
execution.set({
error: null,
latestOutput: null,
- outputImageUrl: null,
+ outputImageName: null,
progress: 0.5,
progressMessage: null,
status: 'running',
@@ -1304,7 +1304,7 @@ describe('InvocationFlowNode chrome and export', () => {
execution.set({
error: 'Child node failed',
latestOutput: null,
- outputImageUrl: null,
+ outputImageName: null,
progress: null,
progressMessage: null,
status: 'failed',
@@ -1493,7 +1493,7 @@ describe('InvocationFlowNode chrome and export', () => {
const completed = {
error: null,
latestOutput: { value: 'previous result' },
- outputImageUrl: 'data:image/png;base64,cHJldmlvdXM=',
+ outputImageName: 'data:image/png;base64,cHJldmlvdXM=',
progress: null,
progressMessage: null,
status: 'completed' as const,
@@ -1631,7 +1631,7 @@ describe('InvocationFlowNode failure outcome', () => {
execution.set({
error: 'Child node failed',
latestOutput: null,
- outputImageUrl: null,
+ outputImageName: null,
progress: null,
progressMessage: null,
status: 'failed',
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx
index 247b5a329a..e9cccc4cfd 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx
@@ -28,6 +28,7 @@ const resolveItemMock = vi.fn();
const pickerState = vi.hoisted(() => ({ accept: null as readonly string[] | null }));
const workflowApiMock = vi.hoisted(() => ({ apiFetch: vi.fn(), apiFetchJson: vi.fn() }));
const workflowCommandsMock = vi.hoisted(() => ({ editGraph: vi.fn() }));
+const findInGalleryMock = vi.hoisted(() => vi.fn());
vi.mock('@platform/transport/http', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
@@ -118,7 +119,11 @@ const projectSnapshot = {
vi.mock('@features/workflow/ui/WorkflowUiContext', () => ({
useWorkflowProjectSelector: (selector: (project: typeof projectSnapshot) => unknown) => selector(projectSnapshot),
- useWorkflowUi: () => ({ commands: workflowCommandsMock, project: { getSnapshot: () => projectSnapshot } }),
+ useWorkflowUi: () => ({
+ commands: workflowCommandsMock,
+ findInGallery: findInGalleryMock,
+ project: { getSnapshot: () => projectSnapshot },
+ }),
}));
const TEXTAREA_TEMPLATE = {
@@ -593,6 +598,12 @@ describe('WorkflowFieldInput media inputs', () => {
{ image_name: SELECTED_GALLERY_VIDEO.name },
]);
+ // Each tile reveals its own image in the gallery.
+ const findButtons = [...host.querySelectorAll<HTMLButtonElement>('button[aria-label*="InGallery"]')];
+ expect(findButtons).toHaveLength(2);
+ await act(() => findButtons[1]!.click());
+ expect(findInGalleryMock).toHaveBeenLastCalledWith({ kind: 'image', name: 'b.png' });
+
await act(() => host.querySelector<HTMLButtonElement>('button[aria-label="Remove a.png"]')!.click());
expect(onChange).toHaveBeenLastCalledWith([{ image_name: 'b.png' }]);
@@ -808,6 +819,19 @@ describe('WorkflowFieldInput media inputs', () => {
expect(resolveItemMock).not.toHaveBeenCalled();
});
+ it('reveals the chosen image in the gallery from the field', async () => {
+ const imageTemplate = {
+ name: 'image',
+ title: 'Image',
+ type: { name: 'ImageField' },
+ } as unknown as FieldInputTemplate;
+
+ await renderField(imageTemplate, { image_name: 'chosen.png' }, vi.fn());
+ await act(() => host.querySelector<HTMLButtonElement>('button[aria-label*="InGallery"]')!.click());
+
+ expect(findInGalleryMock).toHaveBeenLastCalledWith({ kind: 'image', name: 'chosen.png' });
+ });
+
it('keeps the image field on the image upload path', async () => {
uploadImageMock.mockResolvedValue({ imageName: 'uploaded.png' });
const onChange = vi.fn();
@@ -820,6 +844,8 @@ describe('WorkflowFieldInput media inputs', () => {
await renderField(imageTemplate, undefined, onChange);
expect(host.querySelector<HTMLInputElement>('input[type="file"]')?.accept).toBe('image/*');
+ // Nothing to reveal until the field holds an image.
+ expect(host.querySelector('button[aria-label*="InGallery"]')).toBeNull();
await act(() => findButton('Upload').click());
const fileInput = host.querySelector<HTMLInputElement>('input[type="file"]')!;
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
index 9fe1c20682..0ff66e404d 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
@@ -30,6 +30,7 @@ import {
type GalleryItem,
} from '@features/gallery';
import { getSelectedGalleryImageFromValues, toGalleryItemKey } from '@features/gallery/contracts';
+import { FindInGalleryThumbnailButton } from '@features/gallery/mediaSlot';
import { GalleryPickerPopover, type GalleryPickerSelection } from '@features/gallery/picker';
import { invalidateGallery } from '@features/gallery/queries';
import { galleryImageUrls, galleryVideoUrls } from '@features/gallery/utility';
@@ -691,7 +692,9 @@ const ImageCollectionTile = ({
name: string;
onRemove: (index: number) => void;
}) => {
+ const { findInGallery } = useWorkflowUi();
const onRemoveClick = useCallback(() => onRemove(index), [index, onRemove]);
+ const onFind = useCallback(() => findInGallery({ kind: 'image', name }), [findInGallery, name]);
return (
<Box aspectRatio="1" bg="bg.subtle" className="group" position="relative" rounded="xs">
@@ -720,6 +723,7 @@ const ImageCollectionTile = ({
>
<Icon as={XIcon} boxSize="3" />
</IconButton>
+ <FindInGalleryThumbnailButton bottom="0.5" insetInlineEnd="0.5" name={name} onFind={onFind} />
</Box>
);
};
@@ -926,6 +930,7 @@ const ImageCollectionInput = ({
const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputProps & { kind: WorkflowMediaKind }) => {
const { t } = useTranslation();
+ const { findInGallery } = useWorkflowUi();
const config = MEDIA_FIELD_CONFIG[kind];
const mediaName =
typeof (value as Record<string, unknown> | null | undefined)?.[config.nameKey] === 'string'
@@ -950,6 +955,11 @@ const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputPr
[config.nameKey, onChange]
);
const onClearClick = useCallback(() => onChange(undefined), [onChange]);
+ const onFind = useCallback(() => {
+ if (mediaName) {
+ findInGallery({ kind, name: mediaName });
+ }
+ }, [findInGallery, kind, mediaName]);
// Replace failed stale thumbnails with media icons; retry when the value changes.
const [failedThumbnail, setFailedThumbnail] = useState<string | null>(null);
@@ -982,7 +992,7 @@ const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputPr
<Box position="relative" w="full" {...invalidAriaProps}>
<MediaDropMonitor dropId={dropId} kind={kind} onDrop={onMediaDrop} />
{/* The whole preview area is the drop target, like the legacy editor's widget. */}
- <Box ref={setNodeRef} className="nodrag" h="32" position="relative" rounded="sm" w="full">
+ <Box ref={setNodeRef} className="nodrag group" h="32" position="relative" rounded="sm" w="full">
<GalleryPickerPopover accept={pickerAccept} label={pickerLabel} onPick={onPick}>
<chakra.button
aria-label={pickerLabel}
@@ -1058,6 +1068,10 @@ const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputPr
{badge}
</Badge>
) : null}
+ {mediaName ? (
+ // Top corner: the size badge holds the bottom one.
+ <FindInGalleryThumbnailButton bottom="auto" name={mediaName} top="1" onFind={onFind} />
+ ) : null}
<DropTargetOverlay isActive={acceptsActiveDrag} isOver={isOver} label={`Drop ${config.noun}`} />
</Box>
<HStack gap="1.5" mt="1" w="full">
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.browser.test.tsx
index e2e3416186..e8b29f08ab 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.browser.test.tsx
@@ -120,6 +120,8 @@ const createExecutionPort = () => {
};
};
+const findInGalleryMock = vi.fn();
+
const createAdapter = (nodeExecution: WorkflowUiAdapter['nodeExecution']): WorkflowUiAdapter =>
({
capabilities: { getSnapshot: () => ({ canUseCache: true }), subscribe: () => () => {} },
@@ -135,6 +137,7 @@ const createAdapter = (nodeExecution: WorkflowUiAdapter['nodeExecution']): Workf
setWorkflowSource: vi.fn(),
undo: vi.fn(),
},
+ findInGallery: findInGalleryMock,
getProjectGraph: () => projectGraph,
nodeExecution,
notifications: { error: vi.fn(), info: vi.fn(), success: vi.fn() },
@@ -186,7 +189,7 @@ describe('NodeInspector outputs tab', () => {
execution.set({
error: null,
latestOutput: { height: 768, type: 'image_output', width: 1024 },
- outputImageUrl: 'data:image/png;base64,',
+ outputImageName: 'result.png',
progress: null,
progressMessage: null,
status: 'completed',
@@ -197,7 +200,9 @@ describe('NodeInspector outputs tab', () => {
expect(host.textContent).toContain('Completed');
expect(host.textContent).toContain('1024');
expect(host.textContent).toContain('768');
- expect(host.querySelector('img')?.getAttribute('src')).toBe('data:image/png;base64,');
+ expect(host.querySelector('img')?.getAttribute('src')).toContain('/images/i/result.png/thumbnail');
+ await act(() => host.querySelector<HTMLButtonElement>('button[aria-label*="InGallery"]')!.click());
+ expect(findInGalleryMock).toHaveBeenLastCalledWith({ kind: 'image', name: 'result.png' });
expect(host.querySelector('[aria-label="Latest output"]')?.textContent).toContain('"type": "image_output"');
// The store carries the previous run's result through a failure; the tab must not pass it off as this run's.
@@ -205,7 +210,7 @@ describe('NodeInspector outputs tab', () => {
execution.set({
error: 'Out of memory',
latestOutput: { height: 768, type: 'image_output', width: 1024 },
- outputImageUrl: 'data:image/png;base64,',
+ outputImageName: 'result.png',
progress: null,
progressMessage: null,
status: 'failed',
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.tsx
index bb058d57d7..ae69300d8c 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeInspector.tsx
@@ -7,6 +7,8 @@ import type {
import type { ChangeEvent } from 'react';
import { Box, Flex, HStack, Image, Stack, Text, Textarea } from '@chakra-ui/react';
+import { FindInGalleryThumbnailButton } from '@features/gallery/mediaSlot';
+import { galleryImageUrls } from '@features/gallery/utility';
import { useInvocationTemplatesSelector } from '@features/workflow/react';
import { workflowSelectionStore } from '@features/workflow/ui/editor/selectionStore';
import { useProjectGraphCommands } from '@features/workflow/ui/useProjectGraphCommands';
@@ -14,6 +16,7 @@ import {
useWorkflowHostCommands,
useWorkflowNodeExecutionState,
useWorkflowProjectSelector,
+ useWorkflowUi,
} from '@features/workflow/ui/WorkflowUiContext';
import {
formatOutputFieldValue,
@@ -138,6 +141,27 @@ const DetailsTab = ({ node, template }: { node: WorkflowInvocationNode; template
);
};
+const OutputImage = ({ imageName }: { imageName: string }) => {
+ const { t } = useTranslation();
+ const { findInGallery } = useWorkflowUi();
+ const onFind = useCallback(() => findInGallery({ kind: 'image', name: imageName }), [findInGallery, imageName]);
+
+ return (
+ <Box className="group" position="relative">
+ <Image
+ alt={t('widgets.workflow.outputImage')}
+ bg="bg.muted"
+ h="10rem"
+ objectFit="contain"
+ rounded="sm"
+ src={galleryImageUrls.thumbnail(imageName)}
+ w="full"
+ />
+ <FindInGalleryThumbnailButton name={imageName} onFind={onFind} />
+ </Box>
+ );
+};
+
const OutputsTab = ({ nodeId, template }: { nodeId: string; template: InvocationTemplate | undefined }) => {
const { t } = useTranslation();
const execution = useWorkflowNodeExecutionState(nodeId);
@@ -178,16 +202,8 @@ const OutputsTab = ({ nodeId, template }: { nodeId: string; template: Invocation
: t(`widgets.workflow.runStatus.${execution.status}`)
}
/>
- {execution.status === 'completed' && execution.outputImageUrl ? (
- <Image
- alt={t('widgets.workflow.outputImage')}
- bg="bg.muted"
- h="10rem"
- objectFit="contain"
- rounded="sm"
- src={execution.outputImageUrl}
- w="full"
- />
+ {execution.status === 'completed' && execution.outputImageName ? (
+ <OutputImage imageName={execution.outputImageName} />
) : null}
{hasResult ? (
<>