fix(ui): use arrays for edge methods

This commit is contained in:
psychedelicious 2024-05-13 17:06:30 +10:00
parent c538ffea26
commit 5743254a41
3 changed files with 20 additions and 26 deletions

View File

@ -118,15 +118,13 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the collector
g.addEdge(regionalPosCond, 'conditioning', posCondCollect, 'item');
// Copy the connections to the "global" positive conditioning node to the regional cond
for (const edge of g.getEdgesTo(posCond)) {
if (edge.destination.field !== 'prompt') {
for (const edge of g.getEdgesTo(posCond, ['clip', 'mask'])) {
// Clone the edge, but change the destination node to the regional conditioning node
const clone = deepClone(edge);
clone.destination.node_id = regionalPosCond.id;
g.addEdgeFromObj(clone);
}
}
}
if (layer.negativePrompt) {
// The main negative conditioning node
@ -149,15 +147,13 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the collector
g.addEdge(regionalNegCond, 'conditioning', negCondCollect, 'item');
// Copy the connections to the "global" negative conditioning node to the regional cond
for (const edge of g.getEdgesTo(negCond)) {
if (edge.destination.field !== 'prompt') {
for (const edge of g.getEdgesTo(negCond, ['clip', 'mask'])) {
// Clone the edge, but change the destination node to the regional conditioning node
const clone = deepClone(edge);
clone.destination.node_id = regionalNegCond.id;
g.addEdgeFromObj(clone);
}
}
}
// If we are using the "invert" auto-negative setting, we need to add an additional negative conditioning node
if (layer.autoNegative === 'invert' && layer.positivePrompt) {
@ -188,15 +184,13 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the negative collector
g.addEdge(regionalPosCondInverted, 'conditioning', negCondCollect, 'item');
// Copy the connections to the "global" positive conditioning node to our regional node
for (const edge of g.getEdgesTo(posCond)) {
if (edge.destination.field !== 'prompt') {
for (const edge of g.getEdgesTo(posCond, ['clip', 'mask'])) {
// Clone the edge, but change the destination node to the regional conditioning node
const clone = deepClone(edge);
clone.destination.node_id = regionalPosCondInverted.id;
g.addEdgeFromObj(clone);
}
}
}
const validRegionalIPAdapters: IPAdapterConfigV2[] = layer.ipAdapters.filter((ipa) =>
isValidIPAdapter(ipa, mainModel.base)

View File

@ -42,9 +42,9 @@ export const addGenerationTabLoRAs = (
g.addEdge(seamless ?? modelLoader, 'unet', loraCollectionLoader, 'unet');
g.addEdge(clipSkip, 'clip', loraCollectionLoader, 'clip');
// Reroute UNet & CLIP connections through the LoRA collection loader
g.deleteEdgesTo(denoise, 'unet');
g.deleteEdgesTo(posCond, 'clip');
g.deleteEdgesTo(negCond, 'clip');
g.deleteEdgesTo(denoise, ['unet']);
g.deleteEdgesTo(posCond, ['clip']);
g.deleteEdgesTo(negCond, ['clip']);
g.addEdge(loraCollectionLoader, 'unet', denoise, 'unet');
g.addEdge(loraCollectionLoader, 'clip', posCond, 'clip');
g.addEdge(loraCollectionLoader, 'clip', negCond, 'clip');

View File

@ -41,8 +41,8 @@ export const addGenerationTabSeamless = (
});
// Seamless slots into the graph between the model loader and the denoise node
g.deleteEdgesFrom(modelLoader, 'unet');
g.deleteEdgesFrom(modelLoader, 'vae');
g.deleteEdgesFrom(modelLoader, ['unet']);
g.deleteEdgesFrom(modelLoader, ['vae']);
g.addEdge(modelLoader, 'unet', seamless, 'unet');
g.addEdge(vaeLoader ?? modelLoader, 'vae', seamless, 'vae');