beswarm 0.2.85__py3-none-any.whl → 0.2.87__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 +24 -10
- beswarm/tools/subtasks.py +8 -0
- {beswarm-0.2.85.dist-info → beswarm-0.2.87.dist-info}/METADATA +1 -1
- {beswarm-0.2.85.dist-info → beswarm-0.2.87.dist-info}/RECORD +6 -6
- {beswarm-0.2.85.dist-info → beswarm-0.2.87.dist-info}/WHEEL +0 -0
- {beswarm-0.2.85.dist-info → beswarm-0.2.87.dist-info}/top_level.txt +0 -0
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 "
|
25
|
-
tags = f"
|
24
|
+
if "#" in tags:
|
25
|
+
tags = f"{tags.split('#')}"
|
26
26
|
else:
|
27
|
-
|
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 "
|
49
|
-
tags = f"
|
52
|
+
if "#" in tags:
|
53
|
+
tags = f"{tags.split('#')}"
|
50
54
|
else:
|
51
|
-
|
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 "
|
74
|
-
tags = f"
|
80
|
+
if "#" in tags:
|
81
|
+
tags = f"{tags.split('#')}"
|
75
82
|
else:
|
76
|
-
|
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
|
beswarm/tools/subtasks.py
CHANGED
@@ -24,6 +24,14 @@ def create_task(goal, tools, work_dir):
|
|
24
24
|
str: 当任务成功完成时,返回字符串 "任务已完成"。
|
25
25
|
"""
|
26
26
|
task_manager = current_task_manager.get()
|
27
|
+
|
28
|
+
# 检查工作目录是否与现有任务重复
|
29
|
+
for task_id, task_info in task_manager.tasks_cache.items():
|
30
|
+
if task_id == "root_path":
|
31
|
+
continue
|
32
|
+
if task_info.get("args", {}).get("work_dir") == work_dir:
|
33
|
+
return f"<tool_error>工作目录 '{work_dir}' 已被任务 {task_id} 使用。请为子任务选择一个唯一的工作目录。</tool_error>"
|
34
|
+
|
27
35
|
# 获取 worker 函数,这是正确的
|
28
36
|
worker_fun = registry.tools["worker"]
|
29
37
|
|
@@ -111,17 +111,17 @@ 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=
|
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
|
118
118
|
beswarm/tools/screenshot.py,sha256=hyL6F8_k9Y03Nb_X18cY-klCpWWdkqyC-iGXfKX-7jc,1007
|
119
119
|
beswarm/tools/search_arxiv.py,sha256=NLiJV1B7Um6EuZXLxnL950d837_he2LGG7qaGACSgwg,10750
|
120
120
|
beswarm/tools/search_web.py,sha256=0fTeczXiOX_LJQGaLEGbuJtIPzofeuquGWEt3yDMtVw,17498
|
121
|
-
beswarm/tools/subtasks.py,sha256=
|
121
|
+
beswarm/tools/subtasks.py,sha256=Wekein1vgI9BA5fKS_x5OToquyesDWhOa6Y4jsCK1SU,10889
|
122
122
|
beswarm/tools/worker.py,sha256=mQ1qdrQ8MgL99byAbTvxfEByFFGN9mty3UHqHjARMQ8,2331
|
123
123
|
beswarm/tools/write_csv.py,sha256=u0Hq18Ksfheb52MVtyLNCnSDHibITpsYBPs2ub7USYA,1466
|
124
|
-
beswarm-0.2.
|
125
|
-
beswarm-0.2.
|
126
|
-
beswarm-0.2.
|
127
|
-
beswarm-0.2.
|
124
|
+
beswarm-0.2.87.dist-info/METADATA,sha256=6LrVVhuYW6X4pFOO_0WPpQdylYCcMUBaZE_911CYLtw,3878
|
125
|
+
beswarm-0.2.87.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
126
|
+
beswarm-0.2.87.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
127
|
+
beswarm-0.2.87.dist-info/RECORD,,
|
File without changes
|
File without changes
|