beswarm 0.1.85__py3-none-any.whl → 0.1.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/worker.py CHANGED
@@ -29,6 +29,7 @@ async def worker(goal, tools, work_dir, cache_messages=None):
29
29
  str: 当任务成功完成时,返回字符串 "任务已完成"。
30
30
  """
31
31
  start_time = datetime.now()
32
+ finish_flag = 0
32
33
 
33
34
  tools_json = [value for _, value in get_function_call_list(tools).items()]
34
35
  work_agent_system_prompt = worker_system_prompt.format(
@@ -153,8 +154,14 @@ async def worker(goal, tools, work_dir, cache_messages=None):
153
154
 
154
155
  # 检查任务是否完成
155
156
  if "任务已完成" in next_instruction and len(next_instruction) < 10:
156
- print("\n✅ 任务已完成!")
157
- break
157
+ if finish_flag == 0:
158
+ finish_flag = 1
159
+ continue
160
+ elif finish_flag == 1:
161
+ print("\n✅ 任务已完成!")
162
+ break
163
+ else:
164
+ finish_flag = 0
158
165
  if "find_and_click_element" in str(tools_json):
159
166
  next_instruction = await get_current_screen_image_message(next_instruction)
160
167
  result = await work_agent.ask_async(next_instruction)
@@ -174,6 +181,7 @@ async def worker(goal, tools, work_dir, cache_messages=None):
174
181
 
175
182
  async def worker_gen(goal, tools, work_dir, cache_messages=None):
176
183
  start_time = datetime.now()
184
+ finish_flag = 0
177
185
  tools_json = [value for _, value in get_function_call_list(tools).items()]
178
186
  work_agent_system_prompt = worker_system_prompt.format(
179
187
  os_version=platform.platform(),
@@ -300,8 +308,14 @@ async def worker_gen(goal, tools, work_dir, cache_messages=None):
300
308
 
301
309
  # 检查任务是否完成
302
310
  if "任务已完成" in next_instruction and len(next_instruction) < 10:
303
- print("\n✅ 任务已完成!")
304
- break
311
+ if finish_flag == 0:
312
+ finish_flag = 1
313
+ continue
314
+ elif finish_flag == 1:
315
+ print("\n✅ 任务已完成!")
316
+ break
317
+ else:
318
+ finish_flag = 0
305
319
  if "find_and_click_element" in str(tools_json):
306
320
  next_instruction = await get_current_screen_image_message(next_instruction)
307
321
  result = await work_agent.ask_async(next_instruction)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.85
3
+ Version: 0.1.86
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -128,8 +128,8 @@ beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1
128
128
  beswarm/tools/search_arxiv.py,sha256=GpuIOYX8T0iRC-X-hmuR9AUJVn15WWZq864DaoC7BUc,8004
129
129
  beswarm/tools/search_web.py,sha256=B24amOnGHnmdV_6S8bw8O2PdhZRRIDtJjg-wXcfP7dQ,11859
130
130
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
131
- beswarm/tools/worker.py,sha256=BfaU_iBDN4XrueCWkvBtpgcHva95e9X26T8HVNVDynY,15569
132
- beswarm-0.1.85.dist-info/METADATA,sha256=1Vtaw1TKQI8N3yi1xyqYZH018FvC_xdMaDeaceql9Lk,3553
133
- beswarm-0.1.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
134
- beswarm-0.1.85.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
135
- beswarm-0.1.85.dist-info/RECORD,,
131
+ beswarm/tools/worker.py,sha256=VOulEZBEc5nF2RBR9aLYs0vT7WBD-r2mlWH5ueEo4hM,16007
132
+ beswarm-0.1.86.dist-info/METADATA,sha256=CEzs_BeynBW6FQDq9GBOZmkYU0eQ4EkYxzSgwBnGfz4,3553
133
+ beswarm-0.1.86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
134
+ beswarm-0.1.86.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
135
+ beswarm-0.1.86.dist-info/RECORD,,