beswarm 0.1.61__py3-none-any.whl → 0.1.62__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
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import re
2
3
  import copy
3
4
  import json
4
5
  import platform
@@ -82,7 +83,25 @@ async def worker(goal, tools, work_dir, cache_messages=None):
82
83
  with open(cache_file, "w", encoding="utf-8") as f:
83
84
  f.write(json.dumps(conversation_history, ensure_ascii=False, indent=4))
84
85
 
85
- conversation_history.pop(0)
86
+ work_agent_system_prompt = conversation_history.pop(0)
87
+ if conversation_history:
88
+ # 获取原始内容
89
+ original_content = work_agent_system_prompt["content"]
90
+
91
+ # 定义正则表达式
92
+ regex = r"<latest_file_content>(.*?)</latest_file_content>"
93
+
94
+ # 进行匹配
95
+ match = re.search(regex, original_content, re.DOTALL)
96
+
97
+ # 提取内容或设置为空字符串
98
+ if match:
99
+ extracted_content = f"<latest_file_content>{match.group(1)}</latest_file_content>\n\n"
100
+ else:
101
+ extracted_content = ""
102
+
103
+ conversation_history[0]["content"] = extracted_content + conversation_history[0]["content"]
104
+
86
105
  instruction_agent.conversation["default"][1:] = conversation_history
87
106
  if "find_and_click_element" in str(tools_json):
88
107
  instruction_prompt = await get_current_screen_image_message(instruction_prompt)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.61
3
+ Version: 0.1.62
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -127,8 +127,8 @@ beswarm/tools/repomap.py,sha256=N09K0UgwjCN7Zjg_5TYlVsulp3n2fztYlS8twalChU8,4500
127
127
  beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
128
128
  beswarm/tools/search_web.py,sha256=B24amOnGHnmdV_6S8bw8O2PdhZRRIDtJjg-wXcfP7dQ,11859
129
129
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
130
- beswarm/tools/worker.py,sha256=2EOag_yo8qC020jx32tcU9G_gzT3PeYasukLwuuOAJQ,5976
131
- beswarm-0.1.61.dist-info/METADATA,sha256=NegTlo6GWu7fnnEQJuZ_zR35Ick42dQdgXxp3lns8P0,3553
132
- beswarm-0.1.61.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
133
- beswarm-0.1.61.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
- beswarm-0.1.61.dist-info/RECORD,,
130
+ beswarm/tools/worker.py,sha256=6tg2973BZkr85W73RWcTQ7cGub2sIRxHgluriorVBNc,6741
131
+ beswarm-0.1.62.dist-info/METADATA,sha256=RzS5f38zi_lsfKumv6AqZARc0atpVl0OV_5g4hQ1AkE,3553
132
+ beswarm-0.1.62.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
133
+ beswarm-0.1.62.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
+ beswarm-0.1.62.dist-info/RECORD,,