beswarm 0.2.85__py3-none-any.whl → 0.2.86__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.
beswarm/tools/graph.py CHANGED
@@ -21,14 +21,18 @@ def add_knowledge_node(parent_path: str, node_name: str, description: str = "",
21
21
  if tags:
22
22
  if "[" not in tags:
23
23
  if "," not in tags:
24
- if " " in tags:
25
- tags = f"[{tags.split(' ')}]"
24
+ if "#" in tags:
25
+ tags = f"{tags.split('#')}"
26
26
  else:
27
- tags = f"['{tags}']"
27
+ if " " in tags:
28
+ tags = f"{tags.split(' ')}"
29
+ else:
30
+ tags = f"['{tags}']"
28
31
  else:
29
32
  tags = f"{tags.split(',')}"
33
+
30
34
  tags = ast.literal_eval(tags) if isinstance(tags, str) else tags
31
- tags = [tag.strip().lstrip("#") for tag in tags]
35
+ tags = [tag.strip().lstrip("#") for tag in tags if tag.strip()]
32
36
  return kgm.add_node(parent_path, node_name, description, tags)
33
37
 
34
38
  @register_tool()
@@ -45,10 +49,13 @@ def add_tags_to_knowledge_node(node_path: str, tags: List[str]) -> str:
45
49
  """
46
50
  if "[" not in tags:
47
51
  if "," not in tags:
48
- if " " in tags:
49
- tags = f"[{tags.split(' ')}]"
52
+ if "#" in tags:
53
+ tags = f"{tags.split('#')}"
50
54
  else:
51
- tags = f"['{tags}']"
55
+ if " " in tags:
56
+ tags = f"{tags.split(' ')}"
57
+ else:
58
+ tags = f"['{tags}']"
52
59
  else:
53
60
  tags = f"{tags.split(',')}"
54
61
 
@@ -70,10 +77,13 @@ def remove_tags_from_knowledge_node(node_path: str, tags: List[str]) -> str:
70
77
  """
71
78
  if "[" not in tags:
72
79
  if "," not in tags:
73
- if " " in tags:
74
- tags = f"[{tags.split(' ')}]"
80
+ if "#" in tags:
81
+ tags = f"{tags.split('#')}"
75
82
  else:
76
- tags = f"['{tags}']"
83
+ if " " in tags:
84
+ tags = f"{tags.split(' ')}"
85
+ else:
86
+ tags = f"['{tags}']"
77
87
  else:
78
88
  tags = f"{tags.split(',')}"
79
89
 
@@ -152,3 +162,7 @@ def get_node_details(node_path: str) -> str:
152
162
  str: 包含节点详细信息的、格式化的文本字符串。
153
163
  """
154
164
  return kgm.get_node_details(node_path)
165
+
166
+ if __name__ == "__main__":
167
+ print(add_knowledge_node(".", "1", "2", "#date: 2023-12-01 #source:官方频道"))
168
+ # python -m beswarm.tools.graph
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.2.85
3
+ Version: 0.2.86
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -111,7 +111,7 @@ beswarm/tools/__init__.py,sha256=CPFj04Lm6TEol_2BFX-mVrpzvVIsmPcfTWhRg3xex7Q,207
111
111
  beswarm/tools/click.py,sha256=wu-Ov5U2ZZLcU0gennDVh_2w_Td7F4dbVJcmu_dfHV4,20872
112
112
  beswarm/tools/completion.py,sha256=AIHtEHfSp6fs4Xa_nTcw9fLgXtYHtYGRDTSy7_x_Fak,544
113
113
  beswarm/tools/edit_file.py,sha256=ZTJvbpsfRlp2t98kTn9XQ5qZBTdsWJVWv9t0lvK4RfU,9147
114
- beswarm/tools/graph.py,sha256=kmf4MZPGpfMTTkRuy_6C_V9U-4TLC_J7Az05b-ksqHg,5384
114
+ beswarm/tools/graph.py,sha256=Ni51LCB65bLDDLC3ZyEJj_BeHAzhimhFgH9Ekr56Ll8,5871
115
115
  beswarm/tools/planner.py,sha256=vsHd7rE8RQHJrZ7BQ0ZXhbt4Fjh3DeyxU4piA5R-VPM,1253
116
116
  beswarm/tools/repomap.py,sha256=w98aHmjNjtvcUVc5maWORqzKqDy2KVGLooOe__uJVCU,45235
117
117
  beswarm/tools/request_input.py,sha256=3n2UW8m8Q7dxGhd7L7hzSJ1kk4ekMbtdtNZZT3dJf20,938
@@ -121,7 +121,7 @@ beswarm/tools/search_web.py,sha256=0fTeczXiOX_LJQGaLEGbuJtIPzofeuquGWEt3yDMtVw,1
121
121
  beswarm/tools/subtasks.py,sha256=4wJWNAqRFgvwmDOP12SddYo_OteWBU5cLhLBh6xILk8,10492
122
122
  beswarm/tools/worker.py,sha256=mQ1qdrQ8MgL99byAbTvxfEByFFGN9mty3UHqHjARMQ8,2331
123
123
  beswarm/tools/write_csv.py,sha256=u0Hq18Ksfheb52MVtyLNCnSDHibITpsYBPs2ub7USYA,1466
124
- beswarm-0.2.85.dist-info/METADATA,sha256=Kgu_r1BYQXoJwR0QQZ1c_-sTpDvSovAQDRvlx2aISDw,3878
125
- beswarm-0.2.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- beswarm-0.2.85.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
127
- beswarm-0.2.85.dist-info/RECORD,,
124
+ beswarm-0.2.86.dist-info/METADATA,sha256=yvQjM0_tqSC5EkC34TU3pH5avrerEPNAnL_-XayVYx0,3878
125
+ beswarm-0.2.86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
+ beswarm-0.2.86.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
127
+ beswarm-0.2.86.dist-info/RECORD,,