From c65d497cbc3bf1e573d1ea6c6eea14f7d901fb91 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:12:07 +1100 Subject: [PATCH] fix(ui): filter disabled LoRAs on sdxl --- .../src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts index 76927ad0f0..9553568922 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts @@ -1,7 +1,7 @@ import type { RootState } from 'app/store/store'; import type { LoRAMetadataItem } from 'features/nodes/types/metadata'; import { zLoRAMetadataItem } from 'features/nodes/types/metadata'; -import { forEach, size } from 'lodash-es'; +import { filter, size } from 'lodash-es'; import type { NonNullableGraph, SDXLLoraLoaderInvocation } from 'services/api/types'; import { @@ -31,8 +31,8 @@ export const addSDXLLoRAsToGraph = ( * So we need to inject a LoRA chain into the graph. */ - const { loras } = state.lora; - const loraCount = size(loras); + const enabledLoRAs = filter(state.lora.loras, (l) => l.isEnabled ?? false); + const loraCount = size(enabledLoRAs); if (loraCount === 0) { return; @@ -59,7 +59,7 @@ export const addSDXLLoRAsToGraph = ( let lastLoraNodeId = ''; let currentLoraIndex = 0; - forEach(loras, (lora) => { + enabledLoRAs.forEach((lora) => { const { model_name, base_model, weight } = lora; const currentLoraNodeId = `${LORA_LOADER}_${model_name.replace('.', '_')}`;