vectorvein 0.1.80__py3-none-any.whl → 0.1.81__py3-none-any.whl

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.
@@ -0,0 +1,357 @@
1
+ from typing import Optional
2
+
3
+ from ..graph.node import Node
4
+ from ..graph.port import PortType, InputPort, OutputPort
5
+
6
+
7
+ class Audio(Node):
8
+ def __init__(self, id: Optional[str] = None):
9
+ super().__init__(
10
+ node_type="Audio",
11
+ category="outputs",
12
+ task_name="output.audio",
13
+ node_id=id,
14
+ ports={
15
+ "audio_type": InputPort(
16
+ name="audio_type",
17
+ port_type=PortType.SELECT,
18
+ value="play_audio",
19
+ options=[
20
+ {"value": "text_to_speech", "label": "text_to_speech"},
21
+ {"value": "play_audio", "label": "play_audio"},
22
+ ],
23
+ ),
24
+ "file_link": InputPort(
25
+ name="file_link",
26
+ port_type=PortType.TEXTAREA,
27
+ value="",
28
+ condition="return fieldsData.audio_type.value == 'play_audio'",
29
+ ),
30
+ "is_midi": InputPort(
31
+ name="is_midi",
32
+ port_type=PortType.CHECKBOX,
33
+ value=False,
34
+ condition="return fieldsData.audio_type.value == 'play_audio'",
35
+ ),
36
+ "content": InputPort(
37
+ name="content",
38
+ port_type=PortType.TEXTAREA,
39
+ value="",
40
+ condition="return fieldsData.audio_type.value == 'text_to_speech'",
41
+ ),
42
+ "show_player": InputPort(
43
+ name="show_player",
44
+ port_type=PortType.CHECKBOX,
45
+ value=True,
46
+ ),
47
+ "output_type": InputPort(
48
+ name="output_type",
49
+ port_type=PortType.SELECT,
50
+ value="markdown",
51
+ options=[
52
+ {"value": "only_link", "label": "only_link"},
53
+ {"value": "markdown", "label": "markdown"},
54
+ {"value": "html", "label": "html"},
55
+ ],
56
+ ),
57
+ "output": OutputPort(),
58
+ },
59
+ )
60
+
61
+
62
+ class Text(Node):
63
+ def __init__(self, id: Optional[str] = None):
64
+ super().__init__(
65
+ node_type="Text",
66
+ category="outputs",
67
+ task_name="output.text",
68
+ node_id=id,
69
+ ports={
70
+ "text": InputPort(
71
+ name="text",
72
+ port_type=PortType.TEXTAREA,
73
+ value="",
74
+ show=True,
75
+ ),
76
+ "output_title": InputPort(
77
+ name="output_title",
78
+ port_type=PortType.INPUT,
79
+ value="",
80
+ has_tooltip=True,
81
+ ),
82
+ "render_markdown": InputPort(
83
+ name="render_markdown",
84
+ port_type=PortType.CHECKBOX,
85
+ value=True,
86
+ ),
87
+ "output": OutputPort(),
88
+ },
89
+ )
90
+
91
+
92
+ class Table(Node):
93
+ def __init__(self, id: Optional[str] = None):
94
+ super().__init__(
95
+ node_type="Table",
96
+ category="outputs",
97
+ task_name="output.table",
98
+ node_id=id,
99
+ ports={
100
+ "content_type": InputPort(
101
+ name="content_type",
102
+ port_type=PortType.SELECT,
103
+ value="csv",
104
+ options=[
105
+ {"value": "file_link", "label": "file_link"},
106
+ {"value": "csv", "label": "csv"},
107
+ {"value": "json", "label": "json"},
108
+ ],
109
+ ),
110
+ "content": InputPort(
111
+ name="content",
112
+ port_type=PortType.TEXTAREA,
113
+ value="",
114
+ ),
115
+ "bordered": InputPort(
116
+ name="bordered",
117
+ port_type=PortType.CHECKBOX,
118
+ value=False,
119
+ ),
120
+ "show_table": InputPort(
121
+ name="show_table",
122
+ port_type=PortType.CHECKBOX,
123
+ value=True,
124
+ ),
125
+ "output": OutputPort(),
126
+ },
127
+ )
128
+
129
+
130
+ class Document(Node):
131
+ def __init__(self, id: Optional[str] = None):
132
+ super().__init__(
133
+ node_type="Document",
134
+ category="outputs",
135
+ task_name="output.document",
136
+ node_id=id,
137
+ ports={
138
+ "file_name": InputPort(
139
+ name="file_name",
140
+ port_type=PortType.INPUT,
141
+ value="",
142
+ ),
143
+ "export_type": InputPort(
144
+ name="export_type",
145
+ port_type=PortType.SELECT,
146
+ value=".docx",
147
+ options=[
148
+ {"value": ".docx", "label": ".docx"},
149
+ {"value": ".xlsx", "label": ".xlsx"},
150
+ {"value": ".txt", "label": ".txt"},
151
+ {"value": ".md", "label": ".md"},
152
+ {"value": ".json", "label": ".json"},
153
+ {"value": ".csv", "label": ".csv"},
154
+ {"value": ".html", "label": ".html"},
155
+ {"value": ".srt", "label": ".srt"},
156
+ {"value": ".pdf", "label": ".pdf"},
157
+ ],
158
+ ),
159
+ "content": InputPort(
160
+ name="content",
161
+ port_type=PortType.TEXTAREA,
162
+ value="",
163
+ has_tooltip=True,
164
+ ),
165
+ "show_download": InputPort(
166
+ name="show_download",
167
+ port_type=PortType.CHECKBOX,
168
+ value=True,
169
+ ),
170
+ "output_type": InputPort(
171
+ name="output_type",
172
+ port_type=PortType.SELECT,
173
+ value="markdown",
174
+ options=[
175
+ {"value": "only_link", "label": "only_link"},
176
+ {"value": "markdown", "label": "markdown"},
177
+ {"value": "html", "label": "html"},
178
+ ],
179
+ ),
180
+ "output": OutputPort(),
181
+ },
182
+ )
183
+
184
+
185
+ class Echarts(Node):
186
+ def __init__(self, id: Optional[str] = None):
187
+ super().__init__(
188
+ node_type="Echarts",
189
+ category="outputs",
190
+ task_name="output.echarts",
191
+ node_id=id,
192
+ ports={
193
+ "option": InputPort(
194
+ name="option",
195
+ port_type=PortType.TEXTAREA,
196
+ value="",
197
+ ),
198
+ "show_echarts": InputPort(
199
+ name="show_echarts",
200
+ port_type=PortType.CHECKBOX,
201
+ value=True,
202
+ ),
203
+ },
204
+ )
205
+
206
+
207
+ class Email(Node):
208
+ def __init__(self, id: Optional[str] = None):
209
+ super().__init__(
210
+ node_type="Email",
211
+ category="outputs",
212
+ task_name="output.email",
213
+ node_id=id,
214
+ ports={
215
+ "to_email": InputPort(
216
+ name="to_email",
217
+ port_type=PortType.INPUT,
218
+ value="",
219
+ ),
220
+ "subject": InputPort(
221
+ name="subject",
222
+ port_type=PortType.INPUT,
223
+ value="",
224
+ ),
225
+ "content_html": InputPort(
226
+ name="content_html",
227
+ port_type=PortType.INPUT,
228
+ value="",
229
+ ),
230
+ "attachments": InputPort(
231
+ name="attachments",
232
+ port_type=PortType.INPUT,
233
+ value="",
234
+ ),
235
+ },
236
+ )
237
+
238
+
239
+ class Html(Node):
240
+ def __init__(self, id: Optional[str] = None):
241
+ super().__init__(
242
+ node_type="Html",
243
+ category="outputs",
244
+ task_name="output.html",
245
+ node_id=id,
246
+ ports={
247
+ "html_code": InputPort(
248
+ name="html_code",
249
+ port_type=PortType.TEXTAREA,
250
+ value="",
251
+ ),
252
+ "output": OutputPort(),
253
+ },
254
+ )
255
+
256
+
257
+ class Mermaid(Node):
258
+ def __init__(self, id: Optional[str] = None):
259
+ super().__init__(
260
+ node_type="Mermaid",
261
+ category="outputs",
262
+ task_name="output.mermaid",
263
+ node_id=id,
264
+ ports={
265
+ "content": InputPort(
266
+ name="content",
267
+ port_type=PortType.TEXTAREA,
268
+ value="",
269
+ ),
270
+ "show_mermaid": InputPort(
271
+ name="show_mermaid",
272
+ port_type=PortType.CHECKBOX,
273
+ value=True,
274
+ ),
275
+ },
276
+ )
277
+
278
+
279
+ class Mindmap(Node):
280
+ def __init__(self, id: Optional[str] = None):
281
+ super().__init__(
282
+ node_type="Mindmap",
283
+ category="outputs",
284
+ task_name="output.mindmap",
285
+ node_id=id,
286
+ ports={
287
+ "content": InputPort(
288
+ name="content",
289
+ port_type=PortType.TEXTAREA,
290
+ value="",
291
+ ),
292
+ "show_mind_map": InputPort(
293
+ name="show_mind_map",
294
+ port_type=PortType.CHECKBOX,
295
+ value=True,
296
+ ),
297
+ },
298
+ )
299
+
300
+
301
+ class PictureRender(Node):
302
+ def __init__(self, id: Optional[str] = None):
303
+ super().__init__(
304
+ node_type="PictureRender",
305
+ category="outputs",
306
+ task_name="output.picture_render",
307
+ node_id=id,
308
+ ports={
309
+ "render_type": InputPort(
310
+ name="render_type",
311
+ port_type=PortType.SELECT,
312
+ value="markdown",
313
+ options=[
314
+ {"value": "markdown", "label": "markdown"},
315
+ {"value": "mindmap", "label": "mindmap"},
316
+ {"value": "mermaid", "label": "mermaid"},
317
+ {"value": "pdf", "label": "PDF"},
318
+ {"value": "url", "label": "url"},
319
+ {"value": "html_code", "label": "html_code"},
320
+ ],
321
+ ),
322
+ "content": InputPort(
323
+ name="content",
324
+ port_type=PortType.TEXTAREA,
325
+ value="",
326
+ ),
327
+ "width": InputPort(
328
+ name="width",
329
+ port_type=PortType.NUMBER,
330
+ value=1200,
331
+ condition="return ['url', 'html_code', 'markdown', 'mindmap', 'mermaid'].includes(fieldsData.render_type.value)",
332
+ ),
333
+ "height": InputPort(
334
+ name="height",
335
+ port_type=PortType.NUMBER,
336
+ value=800,
337
+ condition="return ['url', 'html_code', 'markdown', 'mindmap', 'mermaid'].includes(fieldsData.render_type.value)",
338
+ ),
339
+ "base64_encode": InputPort(
340
+ name="base64_encode",
341
+ port_type=PortType.CHECKBOX,
342
+ value=False,
343
+ has_tooltip=True,
344
+ ),
345
+ "output_type": InputPort(
346
+ name="output_type",
347
+ port_type=PortType.SELECT,
348
+ value="markdown",
349
+ options=[
350
+ {"value": "only_link", "label": "only_link"},
351
+ {"value": "markdown", "label": "markdown"},
352
+ {"value": "html", "label": "html"},
353
+ ],
354
+ ),
355
+ "output": OutputPort(),
356
+ },
357
+ )
@@ -0,0 +1,153 @@
1
+ from typing import Optional
2
+
3
+ from ..graph.node import Node
4
+ from ..graph.port import PortType, InputPort, OutputPort
5
+
6
+
7
+ class GetTableInfo(Node):
8
+ def __init__(self, id: Optional[str] = None):
9
+ super().__init__(
10
+ node_type="GetTableInfo",
11
+ category="relational_db",
12
+ task_name="relational_db.get_table_info",
13
+ node_id=id,
14
+ ports={
15
+ "database": InputPort(
16
+ name="database",
17
+ port_type=PortType.SELECT,
18
+ value="",
19
+ options=[],
20
+ ),
21
+ "tables": InputPort(
22
+ name="tables",
23
+ port_type=PortType.SELECT,
24
+ value=[],
25
+ options=[],
26
+ ),
27
+ "output_sql": OutputPort(
28
+ name="output_sql",
29
+ port_type=PortType.TEXT,
30
+ list=True,
31
+ ),
32
+ "output_json": OutputPort(
33
+ name="output_json",
34
+ port_type=PortType.TEXT,
35
+ list=True,
36
+ ),
37
+ },
38
+ )
39
+
40
+
41
+ class RunSql(Node):
42
+ def __init__(self, id: Optional[str] = None):
43
+ super().__init__(
44
+ node_type="RunSql",
45
+ category="relational_db",
46
+ task_name="relational_db.run_sql",
47
+ node_id=id,
48
+ ports={
49
+ "database": InputPort(
50
+ name="database",
51
+ port_type=PortType.SELECT,
52
+ value="",
53
+ options=[],
54
+ ),
55
+ "sql": InputPort(
56
+ name="sql",
57
+ port_type=PortType.TEXTAREA,
58
+ value="",
59
+ ),
60
+ "read_only": InputPort(
61
+ name="read_only",
62
+ port_type=PortType.CHECKBOX,
63
+ value=False,
64
+ ),
65
+ "include_column_names": InputPort(
66
+ name="include_column_names",
67
+ port_type=PortType.CHECKBOX,
68
+ value=True,
69
+ condition="return fieldsData.output_type.value == 'list'",
70
+ ),
71
+ "max_count": InputPort(
72
+ name="max_count",
73
+ port_type=PortType.NUMBER,
74
+ value=100,
75
+ ),
76
+ "output_type": InputPort(
77
+ name="output_type",
78
+ port_type=PortType.SELECT,
79
+ value="csv",
80
+ options=[
81
+ {"value": "list", "label": "list"},
82
+ {"value": "markdown", "label": "markdown"},
83
+ {"value": "csv", "label": "csv"},
84
+ ],
85
+ ),
86
+ "output": OutputPort(),
87
+ },
88
+ )
89
+
90
+
91
+ class SmartQuery(Node):
92
+ def __init__(self, id: Optional[str] = None):
93
+ super().__init__(
94
+ node_type="SmartQuery",
95
+ category="relational_db",
96
+ task_name="relational_db.smart_query",
97
+ node_id=id,
98
+ ports={
99
+ "query": InputPort(
100
+ name="query",
101
+ port_type=PortType.TEXTAREA,
102
+ value="",
103
+ ),
104
+ "model": InputPort(
105
+ name="model",
106
+ port_type=PortType.SELECT,
107
+ value="OpenAI/gpt-4o-mini",
108
+ options=[], # 这里的选项会从前端的 flattenedChatModelOptions 传入
109
+ ),
110
+ "database": InputPort(
111
+ name="database",
112
+ port_type=PortType.SELECT,
113
+ value="",
114
+ options=[],
115
+ ),
116
+ "tables": InputPort(
117
+ name="tables",
118
+ port_type=PortType.SELECT,
119
+ value=[],
120
+ options=[],
121
+ ),
122
+ "use_sample_data": InputPort(
123
+ name="use_sample_data",
124
+ port_type=PortType.CHECKBOX,
125
+ value=True,
126
+ ),
127
+ "include_column_names": InputPort(
128
+ name="include_column_names",
129
+ port_type=PortType.CHECKBOX,
130
+ value=True,
131
+ ),
132
+ "max_count": InputPort(
133
+ name="max_count",
134
+ port_type=PortType.NUMBER,
135
+ value=100,
136
+ ),
137
+ "output_type": InputPort(
138
+ name="output_type",
139
+ port_type=PortType.SELECT,
140
+ value="csv",
141
+ options=[
142
+ {"value": "list", "label": "list"},
143
+ {"value": "markdown", "label": "markdown"},
144
+ {"value": "csv", "label": "csv"},
145
+ ],
146
+ ),
147
+ "output": OutputPort(),
148
+ "output_query_sql": OutputPort(
149
+ name="output_query_sql",
150
+ port_type=PortType.TEXT,
151
+ ),
152
+ },
153
+ )