Prompt serializer and test fixes

This commit is contained in:
space-nuko
2023-05-20 21:42:38 -05:00
parent 8d031120f7
commit 09e806bd3e
17 changed files with 196 additions and 106 deletions

View File

@@ -35,7 +35,15 @@ export function isActiveBackendNode(node: LGraphNode, tag: string | null = null)
if (!(node as any).isBackendNode)
return false;
return isActiveNode(node, tag);
if (!isActiveNode(node, tag))
return false;
// Make sure this node is not contained in an inactive subgraph, even if the
// node itself is active
if (node.is(Subgraph) && !Array.from(node.iterateParentNodes()).every(n => isActiveNode(n, tag)))
return false;
return true;
}
export class UpstreamNodeLocator {
@@ -166,7 +174,7 @@ export default class ComfyPromptSerializer {
// We don't check tags for non-backend nodes.
// Just check for node inactivity (so you can toggle groups of
// tagged frontend nodes on/off)
if (inputNode && inputNode.mode === NodeMode.NEVER) {
if (inputNode && inputNode.mode !== NodeMode.ALWAYS) {
console.debug("Skipping inactive node", inputNode)
continue;
}
@@ -248,6 +256,8 @@ export default class ComfyPromptSerializer {
const inputs = this.serializeInputValues(node);
const links = this.serializeBackendLinks(node, tag);
console.warn("OUTPUT", node.id, node.comfyClass, node.mode)
output[String(node.id)] = {
inputs: { ...inputs, ...links },
class_type: node.comfyClass,