feat: some stuff

This commit is contained in:
2024-04-05 19:38:10 +02:00
parent b3780fdf96
commit 0ecf9798c4
22 changed files with 157 additions and 66 deletions

View File

@@ -101,7 +101,6 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
// we execute the nodes from the bottom up
const sortedNodes = nodes.sort((a, b) => (b.tmp?.depth || 0) - (a.tmp?.depth || 0));
// here we store the intermediate results of the nodes
const results: Record<string, string | boolean | number> = {};
@@ -110,6 +109,11 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
const inputs: Record<string, string | number | boolean> = {};
for (const [key, input] of Object.entries(node.tmp.type.inputs || {})) {
if (input.type === "seed") {
inputs[key] = Math.floor(Math.random() * 100000000);
continue;
}
// check if the input is connected to another node
const inputNode = node.tmp.inputNodes?.[key];
if (inputNode) {
@@ -122,6 +126,7 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
// if the input is not connected to another node, we use the value from the node itself
inputs[key] = node.props?.[key] ?? input?.value;
}
// execute the node and store the result