fix(ui): do not run HRO if using an initial image

This commit is contained in:
psychedelicious 2024-05-04 09:02:27 +10:00 committed by Kent Keirsey
parent 68d1458c83
commit 4beccea6e7
2 changed files with 9 additions and 4 deletions

View File

@ -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;
};

View File

@ -232,7 +232,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
LATENTS_TO_IMAGE
);
addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
const didAddInitialImage = addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
// Add Seamless To Graph
if (seamlessXAxis || seamlessYAxis) {
@ -249,7 +249,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
await addControlLayersToGraph(state, graph, DENOISE_LATENTS);
// High resolution fix.
if (state.hrf.hrfEnabled) {
if (state.hrf.hrfEnabled && !didAddInitialImage) {
addHrfToGraph(state, graph);
}