fix(ui): fix multiple control adapters on canvas

We were making an edges for each adapter where we should isntead have one from the adapter's collect node into the denoising node
This commit is contained in:
psychedelicious 2023-10-18 22:36:25 +11:00
parent 5e6df975fd
commit 0a01d86ab1
3 changed files with 32 additions and 32 deletions

View File

@ -43,6 +43,16 @@ export const addControlNetToLinearGraph = (
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: CONTROL_NET_COLLECT, field: 'collection' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 'control',
},
});
}
validControlNets.forEach((controlNet) => {
if (!controlNet.model) {
return;
@ -106,16 +116,6 @@ export const addControlNetToLinearGraph = (
field: 'item',
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: controlNetNode.id, field: 'control' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 'control',
},
});
}
});
}
};

View File

@ -32,15 +32,25 @@ export const addIPAdapterToLinearGraph = (
type: 'collect',
is_intermediate: true,
};
graph.nodes[ipAdapterCollectNode.id] = ipAdapterCollectNode;
graph.nodes[IP_ADAPTER_COLLECT] = ipAdapterCollectNode;
graph.edges.push({
source: { node_id: ipAdapterCollectNode.id, field: 'collection' },
source: { node_id: IP_ADAPTER_COLLECT, field: 'collection' },
destination: {
node_id: baseNodeId,
field: 'ip_adapter',
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: IP_ADAPTER_COLLECT, field: 'collection' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 'ip_adapter',
},
});
}
validIPAdapters.forEach((ipAdapter) => {
if (!ipAdapter.model) {
return;
@ -87,16 +97,6 @@ export const addIPAdapterToLinearGraph = (
field: 'item',
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: ipAdapterNode.id, field: 'ip_adapter' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 'ip_adapter',
},
});
}
});
}
};

View File

@ -42,6 +42,16 @@ export const addT2IAdaptersToLinearGraph = (
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: T2I_ADAPTER_COLLECT, field: 'collection' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 't2i_adapter',
},
});
}
validT2IAdapters.forEach((t2iAdapter) => {
if (!t2iAdapter.model) {
return;
@ -103,16 +113,6 @@ export const addT2IAdaptersToLinearGraph = (
field: 'item',
},
});
if (CANVAS_COHERENCE_DENOISE_LATENTS in graph.nodes) {
graph.edges.push({
source: { node_id: t2iAdapterNode.id, field: 't2i_adapter' },
destination: {
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
field: 't2i_adapter',
},
});
}
});
}
};