Skip to content

Commit 2d0b607

Browse files
committedMay 30, 2024
NodeData.js
1 parent f0b936d commit 2d0b607

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// nodeData.js
2+
class NodeData {
3+
constructor(
4+
uniq_id,
5+
type = "",
6+
pos_x = 0.0,
7+
pos_y = 0.0,
8+
width = 200.0,
9+
height = 200.0,
10+
name = "",
11+
role = "",
12+
goal = "",
13+
backstory = "",
14+
agent = "",
15+
description = "",
16+
expected_output = "",
17+
tool = "",
18+
arg = "",
19+
output_var = "",
20+
nexts = [],
21+
prevs = []
22+
) {
23+
this.uniq_id = uniq_id;
24+
this.type = type;
25+
this.pos_x = pos_x;
26+
this.pos_y = pos_y;
27+
this.width = width;
28+
this.height = height;
29+
this.name = name;
30+
this.role = role;
31+
this.goal = goal;
32+
this.backstory = backstory;
33+
this.agent = agent;
34+
this.description = description;
35+
this.expected_output = expected_output;
36+
this.tool = tool;
37+
this.arg = arg;
38+
this.output_var = output_var;
39+
this.nexts = nexts;
40+
this.prevs = prevs;
41+
}
42+
43+
toDict() {
44+
return { ...this };
45+
}
46+
47+
static fromDict(data) {
48+
return new NodeData(
49+
data.uniq_id,
50+
data.type,
51+
data.pos_x,
52+
data.pos_y,
53+
data.width,
54+
data.height,
55+
data.name,
56+
data.role,
57+
data.goal,
58+
data.backstory,
59+
data.agent,
60+
data.description,
61+
data.expected_output,
62+
data.tool,
63+
data.arg,
64+
data.output_var,
65+
data.nexts,
66+
data.prevs
67+
);
68+
}
69+
}
70+
71+
export default NodeData;
72+

0 commit comments

Comments
 (0)
Failed to load comments.