graphai 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.cjs.js +1 -1
- package/lib/bundle.cjs.js.map +1 -1
- package/lib/bundle.esm.js +14 -1
- package/lib/bundle.esm.js.map +1 -1
- package/lib/bundle.umd.js +1 -1
- package/lib/bundle.umd.js.map +1 -1
- package/lib/node.d.ts +1 -0
- package/lib/node.js +14 -1
- package/package.json +1 -1
package/lib/node.js
CHANGED
|
@@ -74,7 +74,7 @@ class ComputedNode extends Node {
|
|
|
74
74
|
const agent = data.agent;
|
|
75
75
|
this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);
|
|
76
76
|
}
|
|
77
|
-
this.config = this.
|
|
77
|
+
this.config = this.getConfig(!!data.graph);
|
|
78
78
|
this.anyInput = data.anyInput ?? false;
|
|
79
79
|
this.inputs = data.inputs;
|
|
80
80
|
this.output = data.output;
|
|
@@ -108,6 +108,19 @@ class ComputedNode extends Node {
|
|
|
108
108
|
getAgentId() {
|
|
109
109
|
return this.agentId ?? "__custom__function"; // only for display purpose in the log.
|
|
110
110
|
}
|
|
111
|
+
getConfig(hasGraphData) {
|
|
112
|
+
if (this.agentId) {
|
|
113
|
+
if (hasGraphData) {
|
|
114
|
+
return this.graph.config;
|
|
115
|
+
}
|
|
116
|
+
const config = this.graph.config ?? {};
|
|
117
|
+
return {
|
|
118
|
+
...(config["global"] ?? {}),
|
|
119
|
+
...(config[this.agentId] ?? {}),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
111
124
|
addPendingNode(nodeId) {
|
|
112
125
|
const source = (0, utils_2.parseNodeName)(nodeId);
|
|
113
126
|
(0, utils_2.assert)(!!source.nodeId, `Invalid data source ${nodeId}`);
|