mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): check for valid controlnets before adding to graph
This commit is contained in:
parent
af42d7d347
commit
36f72b5a49
@ -1,5 +1,5 @@
|
||||
import { RootState } from 'app/store/store';
|
||||
import { forEach, size } from 'lodash-es';
|
||||
import { filter, forEach, size } from 'lodash-es';
|
||||
import { CollectInvocation, ControlNetInvocation } from 'services/api';
|
||||
import { NonNullableGraph } from '../types/types';
|
||||
|
||||
@ -12,10 +12,13 @@ export const addControlNetToLinearGraph = (
|
||||
): void => {
|
||||
const { isEnabled: isControlNetEnabled, controlNets } = state.controlNet;
|
||||
|
||||
const controlNetCount = size(controlNets);
|
||||
const validControlNets = filter(
|
||||
controlNets,
|
||||
(c) => c.isEnabled && Boolean(c.processedControlImage)
|
||||
);
|
||||
|
||||
// Add ControlNet
|
||||
if (isControlNetEnabled && controlNetCount > 0) {
|
||||
if (isControlNetEnabled && validControlNets.length > 0) {
|
||||
if (size(controlNets) > 1) {
|
||||
const controlNetIterateNode: CollectInvocation = {
|
||||
id: CONTROL_NET_COLLECT,
|
||||
|
Loading…
Reference in New Issue
Block a user