mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): exclude disabled control adapters on control layers
This commit is contained in:
parent
9d67ec9efe
commit
fe459295ea
@ -33,16 +33,20 @@ const getControlNets = (state: RootState) => {
|
|||||||
// accordion. We need to filter the list of valid T2I adapters according to the tab.
|
// accordion. We need to filter the list of valid T2I adapters according to the tab.
|
||||||
const activeTabName = activeTabNameSelector(state);
|
const activeTabName = activeTabNameSelector(state);
|
||||||
|
|
||||||
// Collect all ControlNet ids for ControlNet layers
|
|
||||||
const layerControlNetIds = state.regionalPrompts.present.layers
|
|
||||||
.filter(isControlAdapterLayer)
|
|
||||||
.map((l) => l.controlNetId);
|
|
||||||
|
|
||||||
if (activeTabName === 'txt2img') {
|
if (activeTabName === 'txt2img') {
|
||||||
// Add only the cnets that are used in control layers
|
// Add only the cnets that are used in control layers
|
||||||
|
// Collect all ControlNet ids for enabled ControlNet layers
|
||||||
|
const layerControlNetIds = state.regionalPrompts.present.layers
|
||||||
|
.filter(isControlAdapterLayer)
|
||||||
|
.filter((l) => l.isEnabled)
|
||||||
|
.map((l) => l.controlNetId);
|
||||||
return intersectionWith(validControlNets, layerControlNetIds, (a, b) => a.id === b);
|
return intersectionWith(validControlNets, layerControlNetIds, (a, b) => a.id === b);
|
||||||
} else {
|
} else {
|
||||||
// Else, we want to exclude the cnets that are used in control layers
|
// Else, we want to exclude the cnets that are used in control layers
|
||||||
|
// Collect all ControlNet ids for all ControlNet layers
|
||||||
|
const layerControlNetIds = state.regionalPrompts.present.layers
|
||||||
|
.filter(isControlAdapterLayer)
|
||||||
|
.map((l) => l.controlNetId);
|
||||||
return differenceWith(validControlNets, layerControlNetIds, (a, b) => a.id === b);
|
return differenceWith(validControlNets, layerControlNetIds, (a, b) => a.id === b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,14 +37,18 @@ const getIPAdapters = (state: RootState) => {
|
|||||||
// accordion. We need to filter the list of valid IP adapters according to the tab.
|
// accordion. We need to filter the list of valid IP adapters according to the tab.
|
||||||
const activeTabName = activeTabNameSelector(state);
|
const activeTabName = activeTabNameSelector(state);
|
||||||
|
|
||||||
// Collect all IP Adapter ids for IP adapter layers
|
|
||||||
const layerIPAdapterIds = state.regionalPrompts.present.layers.filter(isIPAdapterLayer).map((l) => l.ipAdapterId);
|
|
||||||
|
|
||||||
if (activeTabName === 'txt2img') {
|
if (activeTabName === 'txt2img') {
|
||||||
// If we are on the t2i tab, we only want to add the IP adapters that are used in unmasked IP Adapter layers
|
// If we are on the t2i tab, we only want to add the IP adapters that are used in unmasked IP Adapter layers
|
||||||
|
// Collect all IP Adapter ids for enabled IP adapter layers
|
||||||
|
const layerIPAdapterIds = state.regionalPrompts.present.layers
|
||||||
|
.filter(isIPAdapterLayer)
|
||||||
|
.filter((l) => l.isEnabled)
|
||||||
|
.map((l) => l.ipAdapterId);
|
||||||
return intersectionWith(nonMaskedIPAdapters, layerIPAdapterIds, (a, b) => a.id === b);
|
return intersectionWith(nonMaskedIPAdapters, layerIPAdapterIds, (a, b) => a.id === b);
|
||||||
} else {
|
} else {
|
||||||
// Else, we want to exclude the IP adapters that are used in IP Adapter layers
|
// Else, we want to exclude the IP adapters that are used in IP Adapter layers
|
||||||
|
// Collect all IP Adapter ids for enabled IP adapter layers
|
||||||
|
const layerIPAdapterIds = state.regionalPrompts.present.layers.filter(isIPAdapterLayer).map((l) => l.ipAdapterId);
|
||||||
return differenceWith(nonMaskedIPAdapters, layerIPAdapterIds, (a, b) => a.id === b);
|
return differenceWith(nonMaskedIPAdapters, layerIPAdapterIds, (a, b) => a.id === b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -33,16 +33,19 @@ const getT2IAdapters = (state: RootState) => {
|
|||||||
// accordion. We need to filter the list of valid T2I adapters according to the tab.
|
// accordion. We need to filter the list of valid T2I adapters according to the tab.
|
||||||
const activeTabName = activeTabNameSelector(state);
|
const activeTabName = activeTabNameSelector(state);
|
||||||
|
|
||||||
// Collect all ids for control adapter layers
|
|
||||||
const layerControlAdapterIds = state.regionalPrompts.present.layers
|
|
||||||
.filter(isControlAdapterLayer)
|
|
||||||
.map((l) => l.controlNetId);
|
|
||||||
|
|
||||||
if (activeTabName === 'txt2img') {
|
if (activeTabName === 'txt2img') {
|
||||||
// Add only the T2Is that are used in control layers
|
// Add only the T2Is that are used in control layers
|
||||||
|
// Collect all ids for enabled control adapter layers
|
||||||
|
const layerControlAdapterIds = state.regionalPrompts.present.layers
|
||||||
|
.filter(isControlAdapterLayer)
|
||||||
|
.filter((l) => l.isEnabled)
|
||||||
|
.map((l) => l.controlNetId);
|
||||||
return intersectionWith(validT2IAdapters, layerControlAdapterIds, (a, b) => a.id === b);
|
return intersectionWith(validT2IAdapters, layerControlAdapterIds, (a, b) => a.id === b);
|
||||||
} else {
|
} else {
|
||||||
// Else, we want to exclude the T2Is that are used in control layers
|
// Else, we want to exclude the T2Is that are used in control layers
|
||||||
|
const layerControlAdapterIds = state.regionalPrompts.present.layers
|
||||||
|
.filter(isControlAdapterLayer)
|
||||||
|
.map((l) => l.controlNetId);
|
||||||
return differenceWith(validT2IAdapters, layerControlAdapterIds, (a, b) => a.id === b);
|
return differenceWith(validT2IAdapters, layerControlAdapterIds, (a, b) => a.id === b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user