From 4beccea6e7008cb55810229d0d47affbf12525c9 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat, 4 May 2024 09:02:27 +1000 Subject: [PATCH] fix(ui): do not run HRO if using an initial image --- .../nodes/util/graph/addInitialImageToLinearGraph.ts | 9 +++++++-- .../features/nodes/util/graph/buildGenerationTabGraph.ts | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addInitialImageToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addInitialImageToLinearGraph.ts index 603708f15b..eae45acc5b 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addInitialImageToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addInitialImageToLinearGraph.ts @@ -6,11 +6,14 @@ import { assert } from 'tsafe'; import { IMAGE_TO_LATENTS, NOISE, RESIZE } from './constants'; +/** + * Returns true if an initial image was added, false if not. + */ export const addInitialImageToLinearGraph = ( state: RootState, graph: NonNullableGraph, denoiseNodeId: string -): void => { +): boolean => { // Remove Existing UNet Connections const { img2imgStrength, vaePrecision, model } = state.generation; const { refinerModel, refinerStart } = state.sdxl; @@ -19,7 +22,7 @@ export const addInitialImageToLinearGraph = ( const initialImage = initialImageLayer?.isEnabled ? initialImageLayer?.image : null; if (!initialImage) { - return; + return false; } const isSDXL = model?.base === 'sdxl'; @@ -122,4 +125,6 @@ export const addInitialImageToLinearGraph = ( strength: img2imgStrength, init_image: initialImage.imageName, }); + + return true; }; diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/buildGenerationTabGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildGenerationTabGraph.ts index 6c04b25770..41f9f4f748 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/buildGenerationTabGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildGenerationTabGraph.ts @@ -232,7 +232,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise