Skip to content

Commit 6c3281c

Browse files
feat(ui): prevent invoking when >1 control lora enabled
1 parent 56c886d commit 6c3281c

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@
10331033
"fluxModelIncompatibleBboxHeight": "$t(parameters.invoke.fluxRequiresDimensionsToBeMultipleOf16), bbox height is {{height}}",
10341034
"fluxModelIncompatibleScaledBboxWidth": "$t(parameters.invoke.fluxRequiresDimensionsToBeMultipleOf16), scaled bbox width is {{width}}",
10351035
"fluxModelIncompatibleScaledBboxHeight": "$t(parameters.invoke.fluxRequiresDimensionsToBeMultipleOf16), scaled bbox height is {{height}}",
1036+
"fluxModelMultipleControlLoRAs": "Can only use 1 Control LoRA at a time",
10361037
"canvasIsFiltering": "Canvas is busy (filtering)",
10371038
"canvasIsTransforming": "Canvas is busy (transforming)",
10381039
"canvasIsRasterizing": "Canvas is busy (rasterizing)",

invokeai/frontend/web/src/features/queue/store/readiness.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,29 @@ const getReasonsWhyCannotEnqueueCanvasTab = (arg: {
278278
}
279279
}
280280

281-
canvas.controlLayers.entities
282-
.filter((controlLayer) => controlLayer.isEnabled)
283-
.forEach((controlLayer, i) => {
284-
const layerLiteral = i18n.t('controlLayers.layer_one');
285-
const layerNumber = i + 1;
286-
const layerType = i18n.t(LAYER_TYPE_TO_TKEY['control_layer']);
287-
const prefix = `${layerLiteral} #${layerNumber} (${layerType})`;
288-
const problems = getControlLayerWarnings(controlLayer, model);
281+
const enabledControlLayers = canvas.controlLayers.entities.filter((controlLayer) => controlLayer.isEnabled);
289282

290-
if (problems.length) {
291-
const content = upperFirst(problems.map((p) => i18n.t(p)).join(', '));
292-
reasons.push({ prefix, content });
293-
}
294-
});
283+
// FLUX only supports 1x Control LoRA at a time.
284+
const controlLoRACount = enabledControlLayers.filter(
285+
(controlLayer) => controlLayer.controlAdapter?.model?.type === 'control_lora'
286+
).length;
287+
288+
if (model?.base === 'flux' && controlLoRACount > 1) {
289+
reasons.push({ content: i18n.t('parameters.invoke.fluxModelMultipleControlLoRAs') });
290+
}
291+
292+
enabledControlLayers.forEach((controlLayer, i) => {
293+
const layerLiteral = i18n.t('controlLayers.layer_one');
294+
const layerNumber = i + 1;
295+
const layerType = i18n.t(LAYER_TYPE_TO_TKEY['control_layer']);
296+
const prefix = `${layerLiteral} #${layerNumber} (${layerType})`;
297+
const problems = getControlLayerWarnings(controlLayer, model);
298+
299+
if (problems.length) {
300+
const content = upperFirst(problems.map((p) => i18n.t(p)).join(', '));
301+
reasons.push({ prefix, content });
302+
}
303+
});
295304

296305
canvas.referenceImages.entities
297306
.filter((entity) => entity.isEnabled)

0 commit comments

Comments
 (0)