Strip tags from top-level nodes when inserting templates
This commit is contained in:
Submodule litegraph updated: ffc140dd03...9b8d28d3e2
@@ -285,6 +285,19 @@ function relocateNodes(nodes: SerializedLGraphNode[]): SerializedLGraphNode[] {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Strips tags from top-level nodes
|
||||
*/
|
||||
function stripTags(nodes: SerializedLGraphNode[]): SerializedLGraphNode[] {
|
||||
for (const node of nodes) {
|
||||
if (Array.isArray(node.properties.tags)) {
|
||||
node.properties.tags = []
|
||||
}
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
function pruneDetachedLinks(nodes: SerializedLGraphNode[], links: SerializedTemplateLink[]): [SerializedLGraphNode[], SerializedTemplateLink[]] {
|
||||
const nodeIds = new Set(nodes.map(n => n.id));
|
||||
|
||||
@@ -338,6 +351,7 @@ export function serializeTemplate(canvas: ComfyGraphCanvas, template: ComfyBoxTe
|
||||
uiState.update(s => { s.forceSaveUserState = null; return s; });
|
||||
|
||||
nodes = relocateNodes(nodes);
|
||||
nodes = stripTags(nodes);
|
||||
[nodes, links] = pruneDetachedLinks(nodes, links);
|
||||
|
||||
const svg = renderSvg(canvas, graph, TEMPLATE_SVG_PADDING);
|
||||
|
||||
@@ -249,6 +249,11 @@ export default class ComfyGraph extends LGraph {
|
||||
node_data.id = uuidv4();
|
||||
templateNodeIDToNewNode[prevNodeId] = node
|
||||
|
||||
// Strip tags from top-level nodes
|
||||
if (Array.isArray(node_data.properties.tags)) {
|
||||
node_data.properties.tags = []
|
||||
}
|
||||
|
||||
node.configure(node_data);
|
||||
|
||||
if (mapping) {
|
||||
|
||||
@@ -144,8 +144,9 @@
|
||||
if (entry.extraData?.workflowTitle != null) {
|
||||
message = `${entry.extraData.workflowTitle}`
|
||||
}
|
||||
if (subgraphs?.length > 0)
|
||||
message += ` (${subgraphs.join(', ')})`
|
||||
const subgraphsString = subgraphs.join(', ')
|
||||
if (subgraphsString.length > 0)
|
||||
message += ` (${subgraphsString})`
|
||||
|
||||
let submessage = `Nodes: ${Object.keys(entry.prompt).length}`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user