Compare commits
2 Commits
15e08a8163
...
e098be6013
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e098be6013
|
||
|
|
ec13850e1c
|
@@ -125,10 +125,10 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodes = [];
|
const nodes = new Map<number, RuntimeNode>();
|
||||||
|
|
||||||
// loop through all the nodes and assign each nodes its depth
|
// loop through all the nodes and assign each nodes its depth
|
||||||
const stack = [outputNode];
|
const stack = [outputNode, ...graphNodes.filter(n => n.type.endsWith('/debug'))];
|
||||||
while (stack.length) {
|
while (stack.length) {
|
||||||
const node = stack.pop();
|
const node = stack.pop();
|
||||||
if (!node) continue;
|
if (!node) continue;
|
||||||
@@ -137,18 +137,24 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
|
|||||||
parent.state.depth = node.state.depth + 1;
|
parent.state.depth = node.state.depth + 1;
|
||||||
stack.push(parent);
|
stack.push(parent);
|
||||||
}
|
}
|
||||||
nodes.push(node);
|
nodes.set(node.id, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const node of graphNodes) {
|
for (const node of graphNodes) {
|
||||||
if (node.type.endsWith('/debug')) {
|
if (node.type.endsWith('/debug')) {
|
||||||
node.state = node.state || {};
|
node.state = node.state || {};
|
||||||
const parent = node.state.parents[0];
|
const parent = node.state.parents[0];
|
||||||
|
if (parent) {
|
||||||
|
node.state.depth = parent.state.depth - 1;
|
||||||
parent.state.debugNode = true;
|
parent.state.debugNode = true;
|
||||||
}
|
}
|
||||||
|
nodes.set(node.id, node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [outputNode, nodes] as const;
|
const _nodes = [...nodes.values()];
|
||||||
|
|
||||||
|
return [outputNode, _nodes] as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(graph: Graph, settings: Record<string, unknown>) {
|
async execute(graph: Graph, settings: Record<string, unknown>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user