vectorvein 0.1.79__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.
@@ -698,6 +698,14 @@ GEMINI_MODELS: Final[Dict[str, Dict[str, Any]]] = {
698
698
  "response_format_available": True,
699
699
  "native_multimodal": False,
700
700
  },
701
+ "gemini-2.0-flash-thinking-exp-01-21": {
702
+ "id": "gemini-2.0-flash-thinking-exp-01-21",
703
+ "context_length": 1048576,
704
+ "max_output_tokens": 8192,
705
+ "function_call_available": True,
706
+ "response_format_available": True,
707
+ "native_multimodal": False,
708
+ },
701
709
  "gemini-exp-1206": {
702
710
  "id": "gemini-exp-1206",
703
711
  "context_length": 2097152,
@@ -0,0 +1,36 @@
1
+ from typing import Dict, Any, Union
2
+
3
+
4
+ class Edge:
5
+ def __init__(
6
+ self,
7
+ id: str,
8
+ source: str,
9
+ sourceHandle: str,
10
+ target: str,
11
+ targetHandle: str,
12
+ animated: bool = True,
13
+ type: str = "default",
14
+ ) -> None:
15
+ self.id: str = id
16
+ self.source: str = source
17
+ self.sourceHandle: str = sourceHandle
18
+ self.target: str = target
19
+ self.targetHandle: str = targetHandle
20
+ self.animated: bool = animated
21
+ self.type: str = type
22
+ self.style: Dict[str, Union[str, int]] = {"stroke": "#28c5e5", "strokeWidth": 3}
23
+
24
+ def to_dict(self) -> Dict[str, Any]:
25
+ return {
26
+ "id": self.id,
27
+ "source": self.source,
28
+ "sourceHandle": self.sourceHandle,
29
+ "target": self.target,
30
+ "targetHandle": self.targetHandle,
31
+ "animated": self.animated,
32
+ "type": self.type,
33
+ "style": self.style,
34
+ "data": {},
35
+ "label": "",
36
+ }
@@ -0,0 +1,82 @@
1
+ import uuid
2
+ from typing import Dict, Any, Optional, List, Union
3
+
4
+ from .port import PortType, Port, InputPort, OutputPort
5
+
6
+
7
+ class Node:
8
+ def __init__(
9
+ self,
10
+ node_type: str,
11
+ category: str,
12
+ task_name: str,
13
+ description: str = "",
14
+ ports: Optional[Dict[str, Any]] = None,
15
+ node_id: Optional[str] = None,
16
+ position: Optional[Dict[str, float]] = None,
17
+ seleted_workflow_title: str = "",
18
+ is_template: bool = False,
19
+ initialized: bool = False,
20
+ ) -> None:
21
+ self.id: str = node_id or str(uuid.uuid4())
22
+ self.type: str = node_type
23
+ self.category: str = category
24
+ self.task_name: str = task_name
25
+ self.description: str = description
26
+ self.ports: Dict[str, Port] = ports or {}
27
+ self.position: Dict[str, float] = position or {"x": 0, "y": 0}
28
+ self.seleted_workflow_title: str = seleted_workflow_title
29
+ self.is_template: bool = is_template
30
+ self.initialized: bool = initialized
31
+ self.ignored: bool = False
32
+ self.lock: bool = False
33
+ self.shadow: bool = False
34
+
35
+ def add_port(
36
+ self,
37
+ name: str,
38
+ port_type: Union[PortType, str],
39
+ show: bool = False,
40
+ value: Any = None,
41
+ options: Optional[List[Any]] = None,
42
+ is_output: bool = False,
43
+ **kwargs,
44
+ ):
45
+ if is_output:
46
+ self.ports[name] = OutputPort(
47
+ name=name, port_type=port_type, show=show, value=value, options=options, **kwargs
48
+ )
49
+ else:
50
+ self.ports[name] = InputPort(
51
+ name=name, port_type=port_type, show=show, value=value, options=options, **kwargs
52
+ )
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ return {
56
+ "id": self.id,
57
+ "type": self.type,
58
+ "data": {
59
+ "task_name": self.task_name,
60
+ "has_inputs": self.has_inputs(),
61
+ "description": self.description,
62
+ "seleted_workflow_title": self.seleted_workflow_title,
63
+ "is_template": self.is_template,
64
+ "template": {
65
+ port_name: port.to_dict()
66
+ for port_name, port in self.ports.items()
67
+ if port_name not in ["debug", "seleted_workflow_title", "is_template"]
68
+ },
69
+ },
70
+ "category": self.category,
71
+ "position": self.position,
72
+ "initialized": self.initialized,
73
+ "ignored": self.ignored,
74
+ "lock": self.lock,
75
+ "shadow": self.shadow,
76
+ }
77
+
78
+ def has_inputs(self) -> bool:
79
+ for port in self.ports.values():
80
+ if isinstance(port, InputPort):
81
+ return True
82
+ return False
@@ -0,0 +1,173 @@
1
+ from enum import Enum
2
+ from typing import Optional, Any, Dict, List, Union
3
+
4
+
5
+ class PortType(Enum):
6
+ TEXT = "text"
7
+ NUMBER = "number"
8
+ CHECKBOX = "checkbox"
9
+ SELECT = "select"
10
+ RADIO = "radio"
11
+ TEXTAREA = "textarea"
12
+ INPUT = "input"
13
+ FILE = "file"
14
+ LIST = "list"
15
+ COLOR = "color"
16
+ TEMPERATURE = "temperature"
17
+
18
+
19
+ class Port:
20
+ def __init__(
21
+ self,
22
+ name: str,
23
+ port_type: Union[PortType, str],
24
+ required: bool = True,
25
+ show: bool = False,
26
+ value: Any = None,
27
+ options: Optional[List[Any]] = None,
28
+ field_type: Optional[str] = None,
29
+ is_output: bool = False,
30
+ condition: Optional[str] = None,
31
+ max_length: Optional[int] = None,
32
+ support_file_types: Optional[List[str]] = None,
33
+ multiple: Optional[bool] = None,
34
+ group: Optional[str] = None,
35
+ group_collpased: bool = False,
36
+ has_tooltip: bool = False,
37
+ max: Optional[Union[int, float]] = None,
38
+ min: Optional[Union[int, float]] = None,
39
+ max_count: Optional[int] = None,
40
+ list: bool = False,
41
+ ) -> None:
42
+ self.name = name
43
+ self.port_type = port_type
44
+ self.required = required
45
+ self.show = show
46
+ self.value = value
47
+ self.options = options
48
+ self.field_type = field_type
49
+ self.is_output = is_output
50
+ self.condition = condition
51
+ self.max_length = max_length
52
+ self.support_file_types = support_file_types
53
+ self.multiple = multiple
54
+ self.group = group
55
+ self.group_collpased = group_collpased
56
+ self.has_tooltip = has_tooltip
57
+ self.max = max
58
+ self.min = min
59
+ self.max_count = max_count
60
+ self.list = list
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ return {
64
+ "name": self.name,
65
+ "display_name": self.name,
66
+ "field_type": self.port_type.value if isinstance(self.port_type, PortType) else self.port_type,
67
+ "required": self.required,
68
+ "show": self.show,
69
+ "value": self.value,
70
+ "options": self.options,
71
+ "type": self.field_type,
72
+ "is_output": self.is_output,
73
+ # "condition": f"(fieldsData) => {{ {self.condition} }}" if self.condition else "",
74
+ "max_length": self.max_length,
75
+ "support_file_types": ", ".join(self.support_file_types) if self.support_file_types else None,
76
+ "multiple": self.multiple,
77
+ "group": self.group,
78
+ "group_collpased": self.group_collpased,
79
+ "has_tooltip": self.has_tooltip,
80
+ "max": self.max,
81
+ "min": self.min,
82
+ "list": self.list,
83
+ }
84
+
85
+
86
+ class InputPort(Port):
87
+ def __init__(
88
+ self,
89
+ name: str,
90
+ port_type: Union[PortType, str],
91
+ required: bool = True,
92
+ show: bool = False,
93
+ value: Any = None,
94
+ options: Optional[List[Any]] = None,
95
+ field_type: Optional[str] = None,
96
+ condition: Optional[str] = None,
97
+ max_length: Optional[int] = None,
98
+ support_file_types: Optional[List[str]] = None,
99
+ multiple: Optional[bool] = None,
100
+ group: Optional[str] = None,
101
+ group_collpased: bool = False,
102
+ has_tooltip: bool = False,
103
+ max: Optional[Union[int, float]] = None,
104
+ min: Optional[Union[int, float]] = None,
105
+ max_count: Optional[int] = None,
106
+ list: bool = False,
107
+ ) -> None:
108
+ super().__init__(
109
+ name=name,
110
+ port_type=port_type,
111
+ required=required,
112
+ show=show,
113
+ value=value,
114
+ options=options,
115
+ field_type=field_type,
116
+ is_output=False,
117
+ condition=condition,
118
+ max_length=max_length,
119
+ support_file_types=support_file_types,
120
+ multiple=multiple,
121
+ group=group,
122
+ group_collpased=group_collpased,
123
+ has_tooltip=has_tooltip,
124
+ max=max,
125
+ min=min,
126
+ max_count=max_count,
127
+ list=list,
128
+ )
129
+
130
+
131
+ class OutputPort(Port):
132
+ def __init__(
133
+ self,
134
+ name: str = "output",
135
+ port_type: Union[PortType, str] = PortType.TEXT,
136
+ required: bool = True,
137
+ show: bool = False,
138
+ value: Any = None,
139
+ options: Optional[List[Any]] = None,
140
+ field_type: Optional[str] = None,
141
+ condition: Optional[str] = None,
142
+ max_length: Optional[int] = None,
143
+ support_file_types: Optional[List[str]] = None,
144
+ multiple: Optional[bool] = None,
145
+ group: Optional[str] = None,
146
+ group_collpased: bool = False,
147
+ has_tooltip: bool = False,
148
+ max: Optional[Union[int, float]] = None,
149
+ min: Optional[Union[int, float]] = None,
150
+ max_count: Optional[int] = None,
151
+ list: bool = False,
152
+ ) -> None:
153
+ super().__init__(
154
+ name=name,
155
+ port_type=port_type,
156
+ required=required,
157
+ show=show,
158
+ value=value,
159
+ options=options,
160
+ field_type=field_type,
161
+ is_output=True,
162
+ condition=condition,
163
+ max_length=max_length,
164
+ support_file_types=support_file_types,
165
+ multiple=multiple,
166
+ group=group,
167
+ group_collpased=group_collpased,
168
+ has_tooltip=has_tooltip,
169
+ max=max,
170
+ min=min,
171
+ max_count=max_count,
172
+ list=list,
173
+ )
@@ -0,0 +1,87 @@
1
+ import json
2
+ from typing import List, Union
3
+
4
+ from .node import Node
5
+ from .edge import Edge
6
+
7
+
8
+ class Workflow:
9
+ def __init__(self) -> None:
10
+ self.nodes: List[Node] = []
11
+ self.edges: List[Edge] = []
12
+
13
+ def add_node(self, node: Node):
14
+ self.nodes.append(node)
15
+
16
+ def add_nodes(self, nodes: List[Node]):
17
+ self.nodes.extend(nodes)
18
+
19
+ def add_edge(self, edge: Edge):
20
+ self.edges.append(edge)
21
+
22
+ def connect(
23
+ self,
24
+ source_node: Union[str, Node],
25
+ source_port: str,
26
+ target_node: Union[str, Node],
27
+ target_port: str,
28
+ ):
29
+ if isinstance(source_node, Node):
30
+ source_node_id = source_node.id
31
+ else:
32
+ source_node_id = source_node
33
+ if isinstance(target_node, Node):
34
+ target_node_id = target_node.id
35
+ else:
36
+ target_node_id = target_node
37
+
38
+ edge_id = f"vueflow__edge-{source_node_id}{source_port}-{target_node_id}{target_port}"
39
+ edge = Edge(edge_id, source_node_id, source_port, target_node_id, target_port)
40
+ self.add_edge(edge)
41
+
42
+ def to_dict(self):
43
+ return {
44
+ "nodes": [node.to_dict() for node in self.nodes],
45
+ "edges": [edge.to_dict() for edge in self.edges],
46
+ "viewport": {"x": 0, "y": 0, "zoom": 1},
47
+ }
48
+
49
+ def to_json(self, ensure_ascii=False):
50
+ return json.dumps(self.to_dict(), ensure_ascii=ensure_ascii)
51
+
52
+ def to_mermaid(self) -> str:
53
+ """生成 Mermaid 格式的流程图。
54
+
55
+ Returns:
56
+ str: Mermaid 格式的流程图文本
57
+ """
58
+ lines = ["flowchart TD"]
59
+
60
+ # 创建节点类型到序号的映射
61
+ type_counters = {}
62
+ node_id_to_label = {}
63
+
64
+ # 首先为所有节点生成标签
65
+ for node in self.nodes:
66
+ node_type = node.type.lower()
67
+ if node_type not in type_counters:
68
+ type_counters[node_type] = 0
69
+ node_label = f"{node_type}_{type_counters[node_type]}"
70
+ node_id_to_label[node.id] = node_label
71
+ type_counters[node_type] += 1
72
+
73
+ # 添加节点定义
74
+ for node in self.nodes:
75
+ node_label = node_id_to_label[node.id]
76
+ lines.append(f' {node_label}["{node_label} ({node.type})"]')
77
+
78
+ lines.append("") # 添加一个空行分隔节点和边的定义
79
+
80
+ # 添加边的定义
81
+ for edge in self.edges:
82
+ source_label = node_id_to_label[edge.source]
83
+ target_label = node_id_to_label[edge.target]
84
+ label = f"{edge.sourceHandle} → {edge.targetHandle}"
85
+ lines.append(f" {source_label} -->|{label}| {target_label}")
86
+
87
+ return "\n".join(lines)
@@ -0,0 +1,136 @@
1
+ from .audio_generation import MinimaxMusicGeneration, SoundEffects, Tts
2
+ from .control_flows import Conditional, Empty, HumanFeedback, JsonProcess, RandomChoice
3
+ from .file_processing import FileLoader, FileUpload
4
+ from .image_generation import BackgroundGeneration, DallE, Flux1, Inpainting, Kolors, Pulid, Recraft, StableDiffusion
5
+ from .llms import (
6
+ AliyunQwen,
7
+ BaiduWenxin,
8
+ ChatGLM,
9
+ Claude,
10
+ Deepseek,
11
+ Gemini,
12
+ LingYiWanWu,
13
+ MiniMax,
14
+ Moonshot,
15
+ OpenAI,
16
+ XAi,
17
+ )
18
+ from .media_editing import (
19
+ AudioEditing,
20
+ ImageBackgroundRemoval,
21
+ ImageEditing,
22
+ ImageSegmentation,
23
+ ImageWatermark,
24
+ VideoEditing,
25
+ VideoScreenshot,
26
+ )
27
+ from .media_processing import (
28
+ ClaudeVision,
29
+ DeepseekVl,
30
+ GeminiVision,
31
+ GlmVision,
32
+ GptVision,
33
+ InternVision,
34
+ Ocr,
35
+ QwenVision,
36
+ SpeechRecognition,
37
+ )
38
+ from .output import Audio, Text, Table, Document, Echarts, Email, Html, Mermaid, Mindmap, PictureRender
39
+ from .relational_db import GetTableInfo, RunSql, SmartQuery
40
+ from .text_processing import (
41
+ TextInOut,
42
+ TextReplace,
43
+ TextSplitters,
44
+ TextTruncation,
45
+ MarkdownToHtml,
46
+ ListRender,
47
+ TemplateCompose,
48
+ )
49
+ from .tools import CodebaseAnalysis, TextTranslation, TextSearch, ProgrammingFunction, ImageSearch, WorkflowInvoke
50
+ from .vector_db import VectorDbAddData, VectorDbDeleteData, VectorDbSearchData
51
+ from .video_generation import KlingVideo, CogVideoX
52
+ from .web_crawlers import TextCrawler, BilibiliCrawler, DouyinCrawler, YoutubeCrawler
53
+
54
+
55
+ __all__ = [
56
+ "AliyunQwen",
57
+ "Audio",
58
+ "AudioEditing",
59
+ "BackgroundGeneration",
60
+ "BaiduWenxin",
61
+ "BilibiliCrawler",
62
+ "ChatGLM",
63
+ "Claude",
64
+ "ClaudeVision",
65
+ "CodebaseAnalysis",
66
+ "CogVideoX",
67
+ "Conditional",
68
+ "DallE",
69
+ "Deepseek",
70
+ "DeepseekVl",
71
+ "Document",
72
+ "DouyinCrawler",
73
+ "Echarts",
74
+ "Email",
75
+ "Empty",
76
+ "FileLoader",
77
+ "FileUpload",
78
+ "Flux1",
79
+ "Gemini",
80
+ "GeminiVision",
81
+ "GetTableInfo",
82
+ "GlmVision",
83
+ "GptVision",
84
+ "Html",
85
+ "HumanFeedback",
86
+ "ImageBackgroundRemoval",
87
+ "ImageEditing",
88
+ "ImageSearch",
89
+ "ImageSegmentation",
90
+ "ImageWatermark",
91
+ "Inpainting",
92
+ "InternVision",
93
+ "JsonProcess",
94
+ "KlingVideo",
95
+ "Kolors",
96
+ "LingYiWanWu",
97
+ "ListRender",
98
+ "MarkdownToHtml",
99
+ "Mermaid",
100
+ "Mindmap",
101
+ "MiniMax",
102
+ "MinimaxMusicGeneration",
103
+ "Moonshot",
104
+ "Ocr",
105
+ "OpenAI",
106
+ "PictureRender",
107
+ "ProgrammingFunction",
108
+ "Pulid",
109
+ "QwenVision",
110
+ "RandomChoice",
111
+ "Recraft",
112
+ "RunSql",
113
+ "SmartQuery",
114
+ "SoundEffects",
115
+ "SpeechRecognition",
116
+ "StableDiffusion",
117
+ "Table",
118
+ "TemplateCompose",
119
+ "Text",
120
+ "TextCrawler",
121
+ "TextInOut",
122
+ "TextReplace",
123
+ "TextSearch",
124
+ "TextSplitters",
125
+ "TextTranslation",
126
+ "TextTruncation",
127
+ "Tts",
128
+ "VectorDbAddData",
129
+ "VectorDbDeleteData",
130
+ "VectorDbSearchData",
131
+ "VideoEditing",
132
+ "VideoScreenshot",
133
+ "WorkflowInvoke",
134
+ "XAi",
135
+ "YoutubeCrawler",
136
+ ]
@@ -0,0 +1,154 @@
1
+ from typing import Optional
2
+
3
+ from ..graph.node import Node
4
+ from ..graph.port import PortType, InputPort, OutputPort
5
+
6
+
7
+ class MinimaxMusicGeneration(Node):
8
+ def __init__(self, id: Optional[str] = None):
9
+ super().__init__(
10
+ node_type="MinimaxMusicGeneration",
11
+ category="audio_generation",
12
+ task_name="audio_generation.minimax_music_generation",
13
+ node_id=id,
14
+ ports={
15
+ "audio_file": InputPort(
16
+ name="audio_file",
17
+ port_type=PortType.FILE,
18
+ value=list(),
19
+ support_file_types=[".wav", ".mp3"],
20
+ ),
21
+ "purpose": InputPort(
22
+ name="purpose",
23
+ port_type=PortType.SELECT,
24
+ value="song",
25
+ options=[
26
+ {"value": "song", "label": "song"},
27
+ {"value": "voice", "label": "voice"},
28
+ {"value": "instrumental", "label": "instrumental"},
29
+ ],
30
+ ),
31
+ "lyrics": InputPort(
32
+ name="lyrics",
33
+ port_type=PortType.TEXTAREA,
34
+ value="",
35
+ max_length=200,
36
+ ),
37
+ "model": InputPort(
38
+ name="model",
39
+ port_type=PortType.SELECT,
40
+ value="music-01",
41
+ options=[{"value": "music-01", "label": "music-01"}],
42
+ ),
43
+ "sample_rate": InputPort(
44
+ name="sample_rate",
45
+ port_type=PortType.SELECT,
46
+ value=44100,
47
+ options=[
48
+ {"value": 16000, "label": "16000"},
49
+ {"value": 24000, "label": "24000"},
50
+ {"value": 32000, "label": "32000"},
51
+ {"value": 44100, "label": "44100"},
52
+ ],
53
+ ),
54
+ "bitrate": InputPort(
55
+ name="bitrate",
56
+ port_type=PortType.SELECT,
57
+ value=256000,
58
+ options=[
59
+ {"value": 32000, "label": "32000"},
60
+ {"value": 64000, "label": "64000"},
61
+ {"value": 128000, "label": "128000"},
62
+ {"value": 256000, "label": "256000"},
63
+ ],
64
+ ),
65
+ "format": InputPort(
66
+ name="format",
67
+ port_type=PortType.SELECT,
68
+ value="mp3",
69
+ options=[
70
+ {"value": "mp3", "label": "mp3"},
71
+ {"value": "wav", "label": "wav"},
72
+ {"value": "pcm", "label": "pcm"},
73
+ ],
74
+ ),
75
+ "output_type": OutputPort(
76
+ name="output_type",
77
+ port_type=PortType.SELECT,
78
+ value="only_link",
79
+ options=[
80
+ {"value": "only_link", "label": "only_link"},
81
+ {"value": "html", "label": "html"},
82
+ ],
83
+ ),
84
+ "output": OutputPort(),
85
+ },
86
+ )
87
+
88
+
89
+ class SoundEffects(Node):
90
+ def __init__(self, id: Optional[str] = None):
91
+ super().__init__(
92
+ node_type="SoundEffects",
93
+ category="audio_generation",
94
+ task_name="audio_generation.sound_effects",
95
+ node_id=id,
96
+ ports={
97
+ "text": InputPort(
98
+ name="text",
99
+ port_type=PortType.TEXTAREA,
100
+ value="",
101
+ max_length=50,
102
+ ),
103
+ "video": InputPort(
104
+ name="video",
105
+ port_type=PortType.FILE,
106
+ value=list(),
107
+ support_file_types=[".mp4", ".mov", ".webm", ".m4v", ".gif"],
108
+ ),
109
+ "length": InputPort(
110
+ name="length",
111
+ port_type=PortType.NUMBER,
112
+ value=5,
113
+ min=1,
114
+ max=60,
115
+ ),
116
+ "output_type": OutputPort(
117
+ name="output_type",
118
+ port_type=PortType.SELECT,
119
+ value="only_link",
120
+ options=[
121
+ {"value": "only_link", "label": "only_link"},
122
+ {"value": "html", "label": "html"},
123
+ ],
124
+ ),
125
+ "output": OutputPort(),
126
+ },
127
+ )
128
+
129
+
130
+ class Tts(Node):
131
+ def __init__(self, id: Optional[str] = None):
132
+ super().__init__(
133
+ node_type="Tts",
134
+ category="audio_generation",
135
+ task_name="audio_generation.tts",
136
+ node_id=id,
137
+ ports={
138
+ "text": InputPort(
139
+ name="text",
140
+ port_type=PortType.TEXTAREA,
141
+ value="",
142
+ ),
143
+ "output_type": OutputPort(
144
+ name="output_type",
145
+ port_type=PortType.SELECT,
146
+ value="only_link",
147
+ options=[
148
+ {"value": "only_link", "label": "only_link"},
149
+ {"value": "html", "label": "html"},
150
+ ],
151
+ ),
152
+ "output": OutputPort(),
153
+ },
154
+ )