beswarm 0.1.18__py3-none-any.whl → 0.1.19__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 CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
4
4
 
5
5
  setup(
6
6
  name="aient",
7
- version="1.0.77",
7
+ version="1.0.78",
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",
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import json
2
3
  from pdfminer.high_level import extract_text
3
4
 
4
5
  from .registry import register_tool
@@ -63,6 +64,40 @@ Examples:
63
64
  # 如果提取结果为空
64
65
  if not text_content:
65
66
  return f"错误: 无法从 '{file_path}' 提取文本内容"
67
+ elif file_path.lower().endswith('.ipynb'):
68
+ try:
69
+ with open(file_path, 'r', encoding='utf-8') as file:
70
+ notebook_content = json.load(file)
71
+
72
+ for cell in notebook_content.get('cells', []):
73
+ if cell.get('cell_type') == 'code' and 'outputs' in cell:
74
+ filtered_outputs = []
75
+ for output in cell.get('outputs', []):
76
+ new_output = output.copy()
77
+ if 'data' in new_output:
78
+ original_data = new_output['data']
79
+ filtered_data = {}
80
+ for key, value in original_data.items():
81
+ if key.startswith('image/'):
82
+ continue
83
+ if key == 'text/html':
84
+ html_content = "".join(value) if isinstance(value, list) else value
85
+ if isinstance(html_content, str) and '<table class="show_videos"' in html_content:
86
+ continue
87
+ filtered_data[key] = value
88
+ if filtered_data:
89
+ new_output['data'] = filtered_data
90
+ filtered_outputs.append(new_output)
91
+ elif 'output_type' in new_output and new_output['output_type'] in ['stream', 'error']:
92
+ filtered_outputs.append(new_output)
93
+
94
+ cell['outputs'] = filtered_outputs
95
+
96
+ text_content = json.dumps(notebook_content, indent=2, ensure_ascii=False)
97
+ except json.JSONDecodeError:
98
+ return f"错误: 文件 '{file_path}' 不是有效的JSON格式 (IPython Notebook)。"
99
+ except Exception as e:
100
+ return f"处理IPython Notebook文件 '{file_path}' 时发生错误: {e}"
66
101
  else:
67
102
  # 读取文件内容
68
103
  with open(file_path, 'r', encoding='utf-8') as file:
@@ -76,4 +111,10 @@ Examples:
76
111
  except UnicodeDecodeError:
77
112
  return f"错误: 文件 '{file_path}' 不是文本文件或编码不是UTF-8"
78
113
  except Exception as e:
79
- return f"读取文件时发生错误: {e}"
114
+ return f"读取文件时发生错误: {e}"
115
+
116
+ if __name__ == "__main__":
117
+ # python -m beswarm.aient.src.aient.plugins.read_file
118
+ result = read_file("./work/cax/Lenia Notebook.ipynb")
119
+ print(result)
120
+ print(len(result))
beswarm/tools/worker.py CHANGED
@@ -92,6 +92,8 @@ async def worker(goal, tools, work_dir, cache_messages=None):
92
92
  print("\n🤖 指令智能体生成的下一步指令:", next_instruction)
93
93
  if "fetch_gpt_response_stream HTTP Error', 'status_code': 404" in next_instruction:
94
94
  raise Exception(f"Model: {instruction_agent_config['engine']} not found!")
95
+ if "'status_code': 413" in next_instruction:
96
+ raise Exception(f"The request body is too long, please try again.")
95
97
  next_instruction = extract_xml_content(next_instruction, "instructions")
96
98
  if not next_instruction:
97
99
  print("\n❌ 指令智能体生成的指令不符合要求,请重新生成。")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,7 +1,7 @@
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=xH0Y3kjGbroYYcerSOt236rxmEN3pe3l5oWABAHbkSQ,487
4
+ beswarm/aient/setup.py,sha256=LNkqjjpH1PJZU-CfEFfQnoiDAhSlI5BPI2X09VWaZVk,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
@@ -28,7 +28,7 @@ beswarm/aient/src/aient/plugins/excute_command.py,sha256=0sQZGLCaRfh0yMM63fXU8XZ
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
31
- beswarm/aient/src/aient/plugins/read_file.py,sha256=kjHqtAGSy6AV8kFpv342x6yWGYfvZ9LGmxFZXJ3XzQI,2369
31
+ beswarm/aient/src/aient/plugins/read_file.py,sha256=v07127SXOhS8YGJ6X82Gw2xlk-nlKvX7SdxzZVe1z0Y,4625
32
32
  beswarm/aient/src/aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
33
33
  beswarm/aient/src/aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
34
34
  beswarm/aient/src/aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
@@ -124,8 +124,8 @@ beswarm/tools/planner.py,sha256=lguBCS6kpwNPoXQvqH-WySabVubT82iyWOkJnjt6dXw,1265
124
124
  beswarm/tools/repomap.py,sha256=CwvwoN5Swr42EzrORTTeV8MMb7mPviy4a4b0fxBu50k,40828
125
125
  beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
126
126
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
127
- beswarm/tools/worker.py,sha256=3YnSyXaboNJ9j052NMLoIEOtxWL-uJ6sllonm7jV02E,5104
128
- beswarm-0.1.18.dist-info/METADATA,sha256=Z2n5ijYcI9b_6Vt4ANp0C_GSAicldrWWUDdRFpyvJkM,2870
129
- beswarm-0.1.18.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
130
- beswarm-0.1.18.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
131
- beswarm-0.1.18.dist-info/RECORD,,
127
+ beswarm/tools/worker.py,sha256=JZkMT4JAkrV_0-CBATLAPVZzVGEMMEM2XUTTMGmED0E,5245
128
+ beswarm-0.1.19.dist-info/METADATA,sha256=mtwZ_0YfG80lilH_1BmJImkjcqedH0-6XIzaXZWwNYU,2870
129
+ beswarm-0.1.19.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
130
+ beswarm-0.1.19.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
131
+ beswarm-0.1.19.dist-info/RECORD,,