beswarm 0.1.23__py3-none-any.whl → 0.1.25__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/aient/setup.py +1 -1
- beswarm/aient/src/aient/core/utils.py +1 -1
- beswarm/aient/src/aient/models/chatgpt.py +4 -4
- beswarm/aient/src/aient/plugins/excute_command.py +20 -10
- {beswarm-0.1.23.dist-info → beswarm-0.1.25.dist-info}/METADATA +1 -1
- {beswarm-0.1.23.dist-info → beswarm-0.1.25.dist-info}/RECORD +8 -8
- {beswarm-0.1.23.dist-info → beswarm-0.1.25.dist-info}/WHEEL +1 -1
- {beswarm-0.1.23.dist-info → beswarm-0.1.25.dist-info}/top_level.txt +0 -0
beswarm/aient/setup.py
CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
|
|
4
4
|
|
5
5
|
setup(
|
6
6
|
name="aient",
|
7
|
-
version="1.0.
|
7
|
+
version="1.0.84",
|
8
8
|
description="Aient: The Awakening of Agent.",
|
9
9
|
long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
|
10
10
|
long_description_content_type="text/markdown",
|
@@ -21,7 +21,7 @@ def get_model_dict(provider):
|
|
21
21
|
if type(model) == str:
|
22
22
|
model_dict[model] = model
|
23
23
|
if isinstance(model, dict):
|
24
|
-
model_dict.update({new: old for old, new in model.items()})
|
24
|
+
model_dict.update({str(new): old for old, new in model.items()})
|
25
25
|
return model_dict
|
26
26
|
|
27
27
|
class BaseAPI:
|
@@ -540,10 +540,10 @@ class chatgpt(BaseLLM):
|
|
540
540
|
if tool_name == "read_file" and "<read_file error>" not in tool_response:
|
541
541
|
self.latest_file_content[tool_info['parameter']["file_path"]] = tool_response
|
542
542
|
all_responses.append(f"[{tool_name}({tool_args}) Result]:\n\nRead file successfully! The file content has been updated in the tag <latest_file_content>.")
|
543
|
-
elif tool_name == "write_to_file":
|
544
|
-
|
545
|
-
|
546
|
-
|
543
|
+
# elif tool_name == "write_to_file":
|
544
|
+
# tool_info['parameter']["content"] = "...文件已写入,内容已省略以节省上下文..."
|
545
|
+
# tool_args = json.dumps(tool_info['parameter'], ensure_ascii=False) if not isinstance(tool_info['parameter'], str) else tool_info['parameter']
|
546
|
+
# all_responses.append(f"[{tool_name}({tool_args}) Result]:\n\n{tool_response}")
|
547
547
|
else:
|
548
548
|
all_responses.append(f"[{tool_name}({tool_args}) Result]:\n\n{tool_response}")
|
549
549
|
|
@@ -1,21 +1,26 @@
|
|
1
1
|
import subprocess
|
2
2
|
from .registry import register_tool
|
3
3
|
|
4
|
+
import html
|
5
|
+
|
6
|
+
def unescape_html(input_string: str) -> str:
|
7
|
+
"""
|
8
|
+
将字符串中的 HTML 实体(例如 &)转换回其原始字符(例如 &)。
|
9
|
+
|
10
|
+
Args:
|
11
|
+
input_string: 包含 HTML 实体的输入字符串。
|
12
|
+
|
13
|
+
Returns:
|
14
|
+
转换后的字符串。
|
15
|
+
"""
|
16
|
+
return html.unescape(input_string)
|
17
|
+
|
4
18
|
# 执行命令
|
5
19
|
@register_tool()
|
6
20
|
def excute_command(command):
|
7
21
|
"""
|
8
22
|
执行命令并返回输出结果
|
9
23
|
禁止用于查看pdf,禁止使用 pdftotext 命令
|
10
|
-
请确保生成的命令字符串可以直接在终端执行,特殊字符(例如 &&)必须保持原样,不要进行 HTML 编码或任何形式的转义,禁止使用 &&
|
11
|
-
|
12
|
-
for example:
|
13
|
-
|
14
|
-
correct:
|
15
|
-
ls -l && echo 'Hello, World!'
|
16
|
-
|
17
|
-
incorrect:
|
18
|
-
ls -l && echo 'Hello, World!'
|
19
24
|
|
20
25
|
参数:
|
21
26
|
command: 要执行的命令,可以克隆仓库,安装依赖,运行代码等
|
@@ -25,6 +30,7 @@ ls -l && echo 'Hello, World!'
|
|
25
30
|
"""
|
26
31
|
try:
|
27
32
|
# 使用subprocess.run捕获命令输出
|
33
|
+
command = unescape_html(command)
|
28
34
|
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
|
29
35
|
# 返回命令的标准输出
|
30
36
|
if "pip install" in command:
|
@@ -36,4 +42,8 @@ ls -l && echo 'Hello, World!'
|
|
36
42
|
# 如果命令执行失败,返回错误信息和错误输出
|
37
43
|
return f"执行命令失败 (退出码 {e.returncode}):\n错误: {e.stderr}\n输出: {e.stdout}"
|
38
44
|
except Exception as e:
|
39
|
-
return f"执行命令时发生异常: {e}"
|
45
|
+
return f"执行命令时发生异常: {e}"
|
46
|
+
|
47
|
+
if __name__ == "__main__":
|
48
|
+
print(excute_command("ls -l && echo 'Hello, World!'"))
|
49
|
+
print(excute_command("ls -l && echo 'Hello, World!'"))
|
@@ -1,21 +1,21 @@
|
|
1
1
|
beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
2
2
|
beswarm/utils.py,sha256=AdDCcqAIIKQEMl7PfryVgeT9G5sHe7QNsZnrvmTGA8E,283
|
3
3
|
beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
|
4
|
-
beswarm/aient/setup.py,sha256=
|
4
|
+
beswarm/aient/setup.py,sha256=llEi2LmYhrh4rYWh_h2si7x9ibWXM45h7tx8IgGnAik,487
|
5
5
|
beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
|
6
6
|
beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
7
7
|
beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
8
8
|
beswarm/aient/src/aient/core/models.py,sha256=_1wYZg_n9kb2A3C8xCboyqleH2iHc9scwOvtx9DPeok,7582
|
9
9
|
beswarm/aient/src/aient/core/request.py,sha256=DzjOtWb7rm1frsyKRIsnhONCuttURfwtqERc_qJqHgg,60931
|
10
10
|
beswarm/aient/src/aient/core/response.py,sha256=CSAOQmybBu3i2Yq2YUyi91dZWTN1tmtJEBTI8RFwj_s,30594
|
11
|
-
beswarm/aient/src/aient/core/utils.py,sha256=
|
11
|
+
beswarm/aient/src/aient/core/utils.py,sha256=W-PDhwoJIbmlt4xfyrV9GXHu9TwRk4pivBOcDVXjgsc,26163
|
12
12
|
beswarm/aient/src/aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
13
13
|
beswarm/aient/src/aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
|
14
14
|
beswarm/aient/src/aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhFkw,2755
|
15
15
|
beswarm/aient/src/aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
|
16
16
|
beswarm/aient/src/aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
17
17
|
beswarm/aient/src/aient/models/base.py,sha256=z-Z0pJfTN2x0cuwfvu0BdMRY9O-RmLwHEnBIJN1x4Fg,6719
|
18
|
-
beswarm/aient/src/aient/models/chatgpt.py,sha256=
|
18
|
+
beswarm/aient/src/aient/models/chatgpt.py,sha256=0LbiDbBnAUQNnvWBPhQuBWNhKEPXWE171DDwEGhLdIY,44783
|
19
19
|
beswarm/aient/src/aient/models/claude.py,sha256=thK9P8qkaaoUN3OOJ9Shw4KDs-pAGKPoX4FOPGFXva8,28597
|
20
20
|
beswarm/aient/src/aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
|
21
21
|
beswarm/aient/src/aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
|
@@ -24,7 +24,7 @@ beswarm/aient/src/aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yu
|
|
24
24
|
beswarm/aient/src/aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
|
25
25
|
beswarm/aient/src/aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
|
26
26
|
beswarm/aient/src/aient/plugins/config.py,sha256=KnZ5xtb5o41FI2_qvxTEQhssdd3WJc7lIAFNR85INQw,7817
|
27
|
-
beswarm/aient/src/aient/plugins/excute_command.py,sha256=
|
27
|
+
beswarm/aient/src/aient/plugins/excute_command.py,sha256=A5jvmo8DGcluylIooczMHk8t8zs7vq-wQzbF1ETYY2A,1606
|
28
28
|
beswarm/aient/src/aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
|
29
29
|
beswarm/aient/src/aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
|
30
30
|
beswarm/aient/src/aient/plugins/list_directory.py,sha256=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G8A,1394
|
@@ -125,7 +125,7 @@ beswarm/tools/repomap.py,sha256=CwvwoN5Swr42EzrORTTeV8MMb7mPviy4a4b0fxBu50k,4082
|
|
125
125
|
beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
|
126
126
|
beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
|
127
127
|
beswarm/tools/worker.py,sha256=JZkMT4JAkrV_0-CBATLAPVZzVGEMMEM2XUTTMGmED0E,5245
|
128
|
-
beswarm-0.1.
|
129
|
-
beswarm-0.1.
|
130
|
-
beswarm-0.1.
|
131
|
-
beswarm-0.1.
|
128
|
+
beswarm-0.1.25.dist-info/METADATA,sha256=8ZKP725Gzt9mnuWTSJ2-kdHcz3BnOzHZWrDdq5yfTg8,2870
|
129
|
+
beswarm-0.1.25.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
130
|
+
beswarm-0.1.25.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
131
|
+
beswarm-0.1.25.dist-info/RECORD,,
|
File without changes
|