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,13 +118,11 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the collector // Connect the conditioning to the collector
g.addEdge(regionalPosCond, 'conditioning', posCondCollect, 'item'); g.addEdge(regionalPosCond, 'conditioning', posCondCollect, 'item');
// Copy the connections to the "global" positive conditioning node to the regional cond // Copy the connections to the "global" positive conditioning node to the regional cond
for (const edge of g.getEdgesTo(posCond)) { for (const edge of g.getEdgesTo(posCond, ['clip', 'mask'])) {
if (edge.destination.field !== 'prompt') { // Clone the edge, but change the destination node to the regional conditioning node
// Clone the edge, but change the destination node to the regional conditioning node const clone = deepClone(edge);
const clone = deepClone(edge); clone.destination.node_id = regionalPosCond.id;
clone.destination.node_id = regionalPosCond.id; g.addEdgeFromObj(clone);
g.addEdgeFromObj(clone);
}
} }
} }
@ -149,13 +147,11 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the collector // Connect the conditioning to the collector
g.addEdge(regionalNegCond, 'conditioning', negCondCollect, 'item'); g.addEdge(regionalNegCond, 'conditioning', negCondCollect, 'item');
// Copy the connections to the "global" negative conditioning node to the regional cond // Copy the connections to the "global" negative conditioning node to the regional cond
for (const edge of g.getEdgesTo(negCond)) { for (const edge of g.getEdgesTo(negCond, ['clip', 'mask'])) {
if (edge.destination.field !== 'prompt') { // Clone the edge, but change the destination node to the regional conditioning node
// Clone the edge, but change the destination node to the regional conditioning node const clone = deepClone(edge);
const clone = deepClone(edge); clone.destination.node_id = regionalNegCond.id;
clone.destination.node_id = regionalNegCond.id; g.addEdgeFromObj(clone);
g.addEdgeFromObj(clone);
}
} }
} }
@ -188,13 +184,11 @@ export const addGenerationTabControlLayers = async (
// Connect the conditioning to the negative collector // Connect the conditioning to the negative collector
g.addEdge(regionalPosCondInverted, 'conditioning', negCondCollect, 'item'); g.addEdge(regionalPosCondInverted, 'conditioning', negCondCollect, 'item');
// Copy the connections to the "global" positive conditioning node to our regional node // Copy the connections to the "global" positive conditioning node to our regional node
for (const edge of g.getEdgesTo(posCond)) { for (const edge of g.getEdgesTo(posCond, ['clip', 'mask'])) {
if (edge.destination.field !== 'prompt') { // Clone the edge, but change the destination node to the regional conditioning node
// Clone the edge, but change the destination node to the regional conditioning node const clone = deepClone(edge);
const clone = deepClone(edge); clone.destination.node_id = regionalPosCondInverted.id;
clone.destination.node_id = regionalPosCondInverted.id; g.addEdgeFromObj(clone);
g.addEdgeFromObj(clone);
}
} }
} }

View File

@ -42,9 +42,9 @@ export const addGenerationTabLoRAs = (
g.addEdge(seamless ?? modelLoader, 'unet', loraCollectionLoader, 'unet'); g.addEdge(seamless ?? modelLoader, 'unet', loraCollectionLoader, 'unet');
g.addEdge(clipSkip, 'clip', loraCollectionLoader, 'clip'); g.addEdge(clipSkip, 'clip', loraCollectionLoader, 'clip');
// Reroute UNet & CLIP connections through the LoRA collection loader // Reroute UNet & CLIP connections through the LoRA collection loader
g.deleteEdgesTo(denoise, 'unet'); g.deleteEdgesTo(denoise, ['unet']);
g.deleteEdgesTo(posCond, 'clip'); g.deleteEdgesTo(posCond, ['clip']);
g.deleteEdgesTo(negCond, 'clip'); g.deleteEdgesTo(negCond, ['clip']);
g.addEdge(loraCollectionLoader, 'unet', denoise, 'unet'); g.addEdge(loraCollectionLoader, 'unet', denoise, 'unet');
g.addEdge(loraCollectionLoader, 'clip', posCond, 'clip'); g.addEdge(loraCollectionLoader, 'clip', posCond, 'clip');
g.addEdge(loraCollectionLoader, 'clip', negCond, '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 // Seamless slots into the graph between the model loader and the denoise node
g.deleteEdgesFrom(modelLoader, 'unet'); g.deleteEdgesFrom(modelLoader, ['unet']);
g.deleteEdgesFrom(modelLoader, 'vae'); g.deleteEdgesFrom(modelLoader, ['vae']);
g.addEdge(modelLoader, 'unet', seamless, 'unet'); g.addEdge(modelLoader, 'unet', seamless, 'unet');
g.addEdge(vaeLoader ?? modelLoader, 'vae', seamless, 'vae'); g.addEdge(vaeLoader ?? modelLoader, 'vae', seamless, 'vae');