beswarm 0.1.63__py3-none-any.whl → 0.1.65__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/response.py +3 -2
- beswarm/aient/src/aient/plugins/excute_command.py +3 -0
- beswarm/tools/__init__.py +2 -0
- beswarm/tools/screenshot.py +34 -0
- beswarm/tools/worker.py +8 -3
- {beswarm-0.1.63.dist-info → beswarm-0.1.65.dist-info}/METADATA +1 -1
- {beswarm-0.1.63.dist-info → beswarm-0.1.65.dist-info}/RECORD +10 -9
- {beswarm-0.1.63.dist-info → beswarm-0.1.65.dist-info}/WHEEL +0 -0
- {beswarm-0.1.63.dist-info → beswarm-0.1.65.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.1.
|
7
|
+
version="1.1.18",
|
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",
|
@@ -54,8 +54,6 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
|
|
54
54
|
if line and '\"finishReason\": \"' in line:
|
55
55
|
if "stop" not in line.lower():
|
56
56
|
logger.error(f"finishReason: {line}")
|
57
|
-
sse_string = await generate_sse_response(timestamp, model, stop="stop")
|
58
|
-
yield sse_string
|
59
57
|
is_finish = True
|
60
58
|
if is_finish and '\"promptTokenCount\": ' in line:
|
61
59
|
json_data = parse_json_safely( "{" + line + "}")
|
@@ -117,6 +115,9 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
|
|
117
115
|
sse_string = await generate_sse_response(timestamp, model, content=None, tools_id="chatcmpl-9inWv0yEtgn873CxMBzHeCeiHctTV", function_call_name=None, function_call_content=function_full_response)
|
118
116
|
yield sse_string
|
119
117
|
|
118
|
+
sse_string = await generate_sse_response(timestamp, model, stop="stop")
|
119
|
+
yield sse_string
|
120
|
+
|
120
121
|
sse_string = await generate_sse_response(timestamp, model, None, None, None, None, None, totalTokenCount, promptTokenCount, candidatesTokenCount)
|
121
122
|
yield sse_string
|
122
123
|
|
@@ -185,6 +185,9 @@ def excute_command(command):
|
|
185
185
|
# print(f"is_same: {is_same}", flush=True)
|
186
186
|
# print(f"\n\n\n", flush=True)
|
187
187
|
new_output_lines.append(line)
|
188
|
+
# 限制输出行数
|
189
|
+
if len(new_output_lines) > 500:
|
190
|
+
new_output_lines = new_output_lines[:250] + new_output_lines[-250:]
|
188
191
|
final_output_log = "\n".join(new_output_lines)
|
189
192
|
# print(f"output_lines: {len(new_output_lines)}")
|
190
193
|
|
beswarm/tools/__init__.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from .think import think
|
2
2
|
from .edit_file import edit_file
|
3
3
|
from .worker import worker, worker_gen
|
4
|
+
from .screenshot import save_screenshot_to_file
|
4
5
|
|
5
6
|
from .search_arxiv import search_arxiv
|
6
7
|
from .repomap import get_code_repo_map
|
@@ -45,4 +46,5 @@ __all__ = [
|
|
45
46
|
"scroll_screen",
|
46
47
|
"register_tool",
|
47
48
|
"search_web",
|
49
|
+
"save_screenshot_to_file",
|
48
50
|
]
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from ..aient.src.aient.plugins import register_tool
|
2
|
+
|
3
|
+
@register_tool()
|
4
|
+
def save_screenshot_to_file(save_path):
|
5
|
+
"""
|
6
|
+
截取当前屏幕并保存到指定路径
|
7
|
+
|
8
|
+
参数:
|
9
|
+
save_path: 截图保存的完整路径,包括文件名和扩展名
|
10
|
+
|
11
|
+
返回:
|
12
|
+
成功返回True,失败返回False
|
13
|
+
"""
|
14
|
+
try:
|
15
|
+
import os
|
16
|
+
import pyautogui
|
17
|
+
|
18
|
+
# 确保目标目录存在
|
19
|
+
save_dir = os.path.dirname(save_path)
|
20
|
+
if save_dir and not os.path.exists(save_dir):
|
21
|
+
os.makedirs(save_dir)
|
22
|
+
|
23
|
+
# 截取屏幕
|
24
|
+
screenshot = pyautogui.screenshot()
|
25
|
+
img_width, img_height = pyautogui.size()
|
26
|
+
|
27
|
+
# 保存截图到指定路径
|
28
|
+
screenshot.save(save_path)
|
29
|
+
return f"截图成功保存,尺寸: {img_width}x{img_height},保存路径: {save_path}"
|
30
|
+
|
31
|
+
except ImportError:
|
32
|
+
return "请安装所需库: pip install Pillow pyautogui"
|
33
|
+
except Exception as e:
|
34
|
+
return f"截取屏幕或保存图像时出错: {e}"
|
beswarm/tools/worker.py
CHANGED
@@ -99,8 +99,10 @@ async def worker(goal, tools, work_dir, cache_messages=None):
|
|
99
99
|
extracted_content = f"<latest_file_content>{match.group(1)}</latest_file_content>\n\n"
|
100
100
|
else:
|
101
101
|
extracted_content = ""
|
102
|
-
|
103
|
-
|
102
|
+
if isinstance(conversation_history[0]["content"], str):
|
103
|
+
conversation_history[0]["content"] = extracted_content + conversation_history[0]["content"]
|
104
|
+
elif isinstance(conversation_history[0]["content"], list) and extracted_content:
|
105
|
+
conversation_history[0]["content"].append({"type": "text", "text": extracted_content})
|
104
106
|
|
105
107
|
instruction_agent.conversation["default"][1:] = conversation_history
|
106
108
|
if "find_and_click_element" in str(tools_json):
|
@@ -221,7 +223,10 @@ async def worker_gen(goal, tools, work_dir, cache_messages=None):
|
|
221
223
|
else:
|
222
224
|
extracted_content = ""
|
223
225
|
|
224
|
-
conversation_history[0]["content"]
|
226
|
+
if isinstance(conversation_history[0]["content"], str):
|
227
|
+
conversation_history[0]["content"] = extracted_content + conversation_history[0]["content"]
|
228
|
+
elif isinstance(conversation_history[0]["content"], list) and extracted_content:
|
229
|
+
conversation_history[0]["content"].append({"type": "text", "text": extracted_content})
|
225
230
|
|
226
231
|
instruction_agent.conversation["default"][1:] = conversation_history
|
227
232
|
if "find_and_click_element" in str(tools_json):
|
@@ -1,13 +1,13 @@
|
|
1
1
|
beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
2
2
|
beswarm/utils.py,sha256=Z2Kuus2BLp9EHUC2ZNL9iUsb6NWnPj-MTA7SYzGyg24,1755
|
3
3
|
beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
|
4
|
-
beswarm/aient/setup.py,sha256=
|
4
|
+
beswarm/aient/setup.py,sha256=0O5jHa4fdd3bgqlnZQCmYxkUHk7N5ndVu_xjoshAYxo,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=kF-HLi1I2k_G5r153ZHuiGH8_NmpTlFMfK0_myB28YQ,7366
|
9
9
|
beswarm/aient/src/aient/core/request.py,sha256=nvF_V71svezQ0-UbnC9RB_pXo_wV6QC7WE_SANwQzxE,66195
|
10
|
-
beswarm/aient/src/aient/core/response.py,sha256=
|
10
|
+
beswarm/aient/src/aient/core/response.py,sha256=YphzhA9jtQKzWb3L4XGTp9xJZ2FOzHr1aAMTsi896FQ,33201
|
11
11
|
beswarm/aient/src/aient/core/utils.py,sha256=VQ9uutGRR_JOvECOrjeoRBO2aA6w-pGwoXnnS2UvfPU,27263
|
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_geminimask.py,sha256=HFX8jDbNg_FjjgPNxfYaR-0-roUrOO-ND-FVsuxSoiw,13254
|
@@ -25,7 +25,7 @@ beswarm/aient/src/aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yu
|
|
25
25
|
beswarm/aient/src/aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
|
26
26
|
beswarm/aient/src/aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
|
27
27
|
beswarm/aient/src/aient/plugins/config.py,sha256=Vp6CG9ocdC_FAlCMEGtKj45xamir76DFxdJVvURNtog,6539
|
28
|
-
beswarm/aient/src/aient/plugins/excute_command.py,sha256=
|
28
|
+
beswarm/aient/src/aient/plugins/excute_command.py,sha256=9t7RB8ikltZZRv8NcjoxfaD8FkPuWbJTZ2Vwk7hEwTA,10683
|
29
29
|
beswarm/aient/src/aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
|
30
30
|
beswarm/aient/src/aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
|
31
31
|
beswarm/aient/src/aient/plugins/list_directory.py,sha256=JZVuImecMSfEv6jLqii-0uQJ1UCsrpMNmYlwW3PEDg4,1374
|
@@ -119,16 +119,17 @@ beswarm/queries/tree-sitter-languages/ruby-tags.scm,sha256=vIidsCeE2A0vdFN18yXKq
|
|
119
119
|
beswarm/queries/tree-sitter-languages/rust-tags.scm,sha256=9ljM1nzhfPs_ZTRw7cr2P9ToOyhGcKkCoN4_HPXSWi4,1451
|
120
120
|
beswarm/queries/tree-sitter-languages/scala-tags.scm,sha256=UxQjz80JIrrJ7Pm56uUnQyThfmQNvwk7aQzPNypB-Ao,1761
|
121
121
|
beswarm/queries/tree-sitter-languages/typescript-tags.scm,sha256=OMdCeedPiA24ky82DpgTMKXK_l2ySTuF2zrQ2fJAi9E,1253
|
122
|
-
beswarm/tools/__init__.py,sha256=
|
122
|
+
beswarm/tools/__init__.py,sha256=IJExt6D58d2yxBOjHVC6wYGhV7Pb7okmX61RvyqSCSY,1150
|
123
123
|
beswarm/tools/click.py,sha256=TygaekCXTmU3fIu6Uom7ZcyzEgYMlCC_GX-5SmWHuLI,20762
|
124
124
|
beswarm/tools/edit_file.py,sha256=xlAD0HB_xM0yZYc0eJwLE-9mAkywXa2UQPNHzG1OaW4,7664
|
125
125
|
beswarm/tools/planner.py,sha256=lguBCS6kpwNPoXQvqH-WySabVubT82iyWOkJnjt6dXw,1265
|
126
126
|
beswarm/tools/repomap.py,sha256=N09K0UgwjCN7Zjg_5TYlVsulp3n2fztYlS8twalChU8,45003
|
127
|
+
beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1011
|
127
128
|
beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
|
128
129
|
beswarm/tools/search_web.py,sha256=B24amOnGHnmdV_6S8bw8O2PdhZRRIDtJjg-wXcfP7dQ,11859
|
129
130
|
beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
|
130
|
-
beswarm/tools/worker.py,sha256=
|
131
|
-
beswarm-0.1.
|
132
|
-
beswarm-0.1.
|
133
|
-
beswarm-0.1.
|
134
|
-
beswarm-0.1.
|
131
|
+
beswarm/tools/worker.py,sha256=bZwMGUS4wt4yOleb2kKu0rCLHIJgPcokbCmh9bGMzXA,12679
|
132
|
+
beswarm-0.1.65.dist-info/METADATA,sha256=mr83MLLQT52ThyzMx6WdwBalXIpjwQUgeeFRnFpQKE8,3553
|
133
|
+
beswarm-0.1.65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
134
|
+
beswarm-0.1.65.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
135
|
+
beswarm-0.1.65.dist-info/RECORD,,
|
File without changes
|
File without changes
|