vectorvein 0.2.35__py3-none-any.whl → 0.2.37__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.
@@ -10,10 +10,11 @@ class PortsDict(Dict[str, Port]):
10
10
  def __init__(self, owner_node: "Node", *args, **kwargs):
11
11
  super().__init__(*args, **kwargs)
12
12
  self._owner_node = owner_node
13
+ self._initializing = True # 初始化标志
13
14
 
14
15
  def __setitem__(self, key: str, value: Port) -> None:
15
- # 如果端口已存在,允许更新
16
- if key in self:
16
+ # 初始化阶段或端口已存在时,允许直接添加/更新
17
+ if self._initializing or key in self:
17
18
  super().__setitem__(key, value)
18
19
  return
19
20
 
@@ -29,6 +30,10 @@ class PortsDict(Dict[str, Port]):
29
30
 
30
31
  super().__setitem__(key, value)
31
32
 
33
+ def finish_initialization(self):
34
+ """结束初始化阶段"""
35
+ self._initializing = False
36
+
32
37
 
33
38
  class Node:
34
39
  def __init__(
@@ -59,6 +64,9 @@ class Node:
59
64
  if ports:
60
65
  for name, port in ports.items():
61
66
  self.ports[name] = port
67
+ # 结束初始化阶段
68
+ self.ports.finish_initialization()
69
+
62
70
  self.position: Dict[str, float] = position or {"x": 0, "y": 0}
63
71
  self.seleted_workflow_title: str = seleted_workflow_title
64
72
  self.is_template: bool = is_template
@@ -48,28 +48,28 @@ class Workflow:
48
48
  # 检查源节点是否存在
49
49
  source_node_exists = any(node.id == source_node_id for node in self.nodes)
50
50
  if not source_node_exists:
51
- raise ValueError(f"源节点不存在: {source_node_id}")
51
+ raise ValueError(f"Source node not found: {source_node_id}")
52
52
 
53
53
  # 检查目标节点是否存在
54
54
  target_node_exists = any(node.id == target_node_id for node in self.nodes)
55
55
  if not target_node_exists:
56
- raise ValueError(f"目标节点不存在: {target_node_id}")
56
+ raise ValueError(f"Target node not found: {target_node_id}")
57
57
 
58
58
  # 检查源节点的端口是否存在
59
59
  source_node_obj = next(node for node in self.nodes if node.id == source_node_id)
60
60
  if not source_node_obj.has_output_port(source_port):
61
- raise ValueError(f"源节点 {source_node_id} 不存在输出端口: {source_port}")
61
+ raise ValueError(f"Source node {source_node_id} has no output port: {source_port}")
62
62
 
63
63
  # 检查目标节点的端口是否存在
64
64
  target_node_obj = next(node for node in self.nodes if node.id == target_node_id)
65
65
  if not target_node_obj.has_input_port(target_port):
66
- raise ValueError(f"目标节点 {target_node_id} 不存在输入端口: {target_port}")
66
+ raise ValueError(f"Target node {target_node_id} has no input port: {target_port}")
67
67
 
68
68
  # 检查目标端口是否已有被连接的线
69
69
  for edge in self.edges:
70
70
  if edge.target == target_node_id and edge.target_handle == target_port:
71
71
  raise ValueError(
72
- f"目标节点 {target_node_id} 的输入端口 {target_port} 已经被连接: {edge.source}({edge.source_handle}) → {edge.target}({edge.target_handle})"
72
+ f"The input port {target_port} of the target node {target_node_id} is already connected: {edge.source}({edge.source_handle}) → {edge.target}({edge.target_handle})"
73
73
  )
74
74
 
75
75
  # 创建并添加边
@@ -290,6 +290,7 @@ class ProgrammingFunction(Node):
290
290
  field_type="textarea",
291
291
  ),
292
292
  },
293
+ can_add_input_ports=True,
293
294
  )
294
295
 
295
296
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.2.35
3
+ Version: 0.2.37
4
4
  Summary: VectorVein Python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
- vectorvein-0.2.35.dist-info/METADATA,sha256=cIifHIbhWkmoBq64isEQVHa0BoZKKCp1aXuR3IAyKCw,4570
2
- vectorvein-0.2.35.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.2.35.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.2.37.dist-info/METADATA,sha256=fJpDR72JlBhl26sqEpD_Ejvr6ukbHTXBPjUiMfH1PAQ,4570
2
+ vectorvein-0.2.37.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.2.37.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  vectorvein/api/__init__.py,sha256=lfY-XA46fgD2iIZTU0VYP8i07AwA03Egj4Qua0vUKrQ,738
6
6
  vectorvein/api/client.py,sha256=xF-leKDQzVyyy9FnIRaz0k4eElYW1XbbzeRLcpnyk90,33047
@@ -42,9 +42,9 @@ vectorvein/utilities/media_processing.py,sha256=7KtbLFzOYIn1e9QTN9G6C76NH8CBlV9k
42
42
  vectorvein/utilities/rate_limiter.py,sha256=dwolIUVw2wP83Odqpx0AAaE77de1GzxkYDGH4tM_u_4,10300
43
43
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
44
44
  vectorvein/workflow/graph/edge.py,sha256=1ckyyjCue_PLm7P1ItUfKOy6AKkemOpZ9m1WJ8UXIHQ,1072
45
- vectorvein/workflow/graph/node.py,sha256=9eBS4hOjpiIOdO9ZmG6ctbRtsZeDO29SJqsu_3ELFFc,5033
45
+ vectorvein/workflow/graph/node.py,sha256=U3LAq01wOaDANVUuYWc2BhIq-Pl2-33FirJZkkNL_wA,5329
46
46
  vectorvein/workflow/graph/port.py,sha256=Q6HmI2cUi6viJ98ec6-MmMPMRtKS1-OgaudP3LMwVLA,6054
47
- vectorvein/workflow/graph/workflow.py,sha256=l0rSDZeSd6OtHMwxzhIENfOKS0fJKKB4JUow-dV-LUI,8610
47
+ vectorvein/workflow/graph/workflow.py,sha256=K-1-FMfHO49Ww3sHKDOr_sD8GH-i36ylS7qtyJ-Vivg,8617
48
48
  vectorvein/workflow/nodes/__init__.py,sha256=a1fsitA0mf1UlDOSEz6QjSGjiFsvsQcuDE-p2q9SlhM,3181
49
49
  vectorvein/workflow/nodes/audio_generation.py,sha256=ZRFZ_ycMTSJ2LKmekctagQdJYTl-3q4TNOIKETpS9AM,5870
50
50
  vectorvein/workflow/nodes/control_flows.py,sha256=l8CjFQlsGV3fNGM6SVzS1Kz361K1xDv1fGT7acuDXuU,6613
@@ -56,10 +56,10 @@ vectorvein/workflow/nodes/media_processing.py,sha256=jkSP287gyhvF7hqY8Nohdc1Rdn-
56
56
  vectorvein/workflow/nodes/output.py,sha256=_UQxiddHtGv2rkjhUFE-KDgrjnh0AGJQJyq9-4Aji5A,12567
57
57
  vectorvein/workflow/nodes/relational_db.py,sha256=zfzUhV25TpZGhkIzO18PmAT5xhcsJC4AXKy0zyA05w8,5408
58
58
  vectorvein/workflow/nodes/text_processing.py,sha256=MRo_-oaC65hbzMxm7TYoeiS3rgvqh9y_Rny5RCfoATE,8342
59
- vectorvein/workflow/nodes/tools.py,sha256=uMlqJQI9oel3pG4WYrZdpSmWWy2pDQkAIzqOv5z3tB4,13811
59
+ vectorvein/workflow/nodes/tools.py,sha256=n3gF7r5FqNz4Xg0nXYo5kl4ai_g4tWSRHqfnGrKJAls,13850
60
60
  vectorvein/workflow/nodes/triggers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  vectorvein/workflow/nodes/vector_db.py,sha256=t6I17q6iR3yQreiDHpRrksMdWDPIvgqJs076z-7dlQQ,5712
62
62
  vectorvein/workflow/nodes/video_generation.py,sha256=qmdg-t_idpxq1veukd-jv_ChICMOoInKxprV9Z4Vi2w,4118
63
63
  vectorvein/workflow/nodes/web_crawlers.py,sha256=BhJBX1AZH7-22Gu95Ox4qJqmH5DU-m4dbUb5N5DTA-M,5559
64
64
  vectorvein/workflow/utils/json_to_code.py,sha256=F7dhDy8kGc8ndOeihGLRLGFGlquoxVlb02ENtxnQ0C8,5914
65
- vectorvein-0.2.35.dist-info/RECORD,,
65
+ vectorvein-0.2.37.dist-info/RECORD,,