beswarm 0.2.13__py3-none-any.whl → 0.2.14__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 +22 -6
- {beswarm-0.2.13.dist-info → beswarm-0.2.14.dist-info}/METADATA +1 -1
- {beswarm-0.2.13.dist-info → beswarm-0.2.14.dist-info}/RECORD +5 -5
- {beswarm-0.2.13.dist-info → beswarm-0.2.14.dist-info}/WHEEL +0 -0
- {beswarm-0.2.13.dist-info → beswarm-0.2.14.dist-info}/top_level.txt +0 -0
beswarm/tools/worker.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import re
|
3
|
+
import sys
|
3
4
|
import copy
|
4
5
|
import json
|
5
6
|
import difflib
|
@@ -7,6 +8,19 @@ import platform
|
|
7
8
|
from pathlib import Path
|
8
9
|
from datetime import datetime
|
9
10
|
|
11
|
+
class Tee:
|
12
|
+
def __init__(self, *files):
|
13
|
+
self.files = files
|
14
|
+
|
15
|
+
def write(self, obj):
|
16
|
+
for f in self.files:
|
17
|
+
f.write(obj)
|
18
|
+
f.flush()
|
19
|
+
|
20
|
+
def flush(self):
|
21
|
+
for f in self.files:
|
22
|
+
f.flush()
|
23
|
+
|
10
24
|
from ..aient.src.aient.models import chatgpt
|
11
25
|
from ..aient.src.aient.plugins import register_tool, get_function_call_list, registry
|
12
26
|
from ..prompt import worker_system_prompt, instruction_system_prompt
|
@@ -34,11 +48,12 @@ async def worker(goal, tools, work_dir, cache_messages=None):
|
|
34
48
|
"""
|
35
49
|
DEBUG = os.getenv("DEBUG", "false").lower() in ("true", "1", "t", "yes")
|
36
50
|
if DEBUG:
|
37
|
-
import sys
|
38
51
|
log_file = open(Path(work_dir) / ".beswarm" / "history.log", "a", encoding="utf-8")
|
39
52
|
log_file.write(f"========== {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ==========\n")
|
40
|
-
sys.stdout
|
41
|
-
sys.stderr
|
53
|
+
original_stdout = sys.stdout
|
54
|
+
original_stderr = sys.stderr
|
55
|
+
sys.stdout = Tee(original_stdout, log_file)
|
56
|
+
sys.stderr = Tee(original_stderr, log_file)
|
42
57
|
|
43
58
|
start_time = datetime.now()
|
44
59
|
os.chdir(Path(work_dir).absolute())
|
@@ -235,11 +250,12 @@ async def worker(goal, tools, work_dir, cache_messages=None):
|
|
235
250
|
async def worker_gen(goal, tools, work_dir, cache_messages=None):
|
236
251
|
DEBUG = os.getenv("DEBUG", "false").lower() in ("true", "1", "t", "yes")
|
237
252
|
if DEBUG:
|
238
|
-
import sys
|
239
253
|
log_file = open(Path(work_dir) / ".beswarm" / "history.log", "a", encoding="utf-8")
|
240
254
|
log_file.write(f"========== {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ==========\n")
|
241
|
-
sys.stdout
|
242
|
-
sys.stderr
|
255
|
+
original_stdout = sys.stdout
|
256
|
+
original_stderr = sys.stderr
|
257
|
+
sys.stdout = Tee(original_stdout, log_file)
|
258
|
+
sys.stderr = Tee(original_stderr, log_file)
|
243
259
|
|
244
260
|
start_time = datetime.now()
|
245
261
|
os.chdir(Path(work_dir).absolute())
|
@@ -134,8 +134,8 @@ beswarm/tools/request_input.py,sha256=gXNAJPOJektMqxJVyzNTFOeMQ7xUkO-wWMYH-r2Rdw
|
|
134
134
|
beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1011
|
135
135
|
beswarm/tools/search_arxiv.py,sha256=GpuIOYX8T0iRC-X-hmuR9AUJVn15WWZq864DaoC7BUc,8004
|
136
136
|
beswarm/tools/search_web.py,sha256=w0T0aCqOVlb6Of5hn_TtpnrGXo6bMtw2aKZdkrYjycI,12069
|
137
|
-
beswarm/tools/worker.py,sha256=
|
138
|
-
beswarm-0.2.
|
139
|
-
beswarm-0.2.
|
140
|
-
beswarm-0.2.
|
141
|
-
beswarm-0.2.
|
137
|
+
beswarm/tools/worker.py,sha256=ZFgSe17Je9NJuITvojZ89uEk2p-pXWJIy9GHNvMDAVo,23491
|
138
|
+
beswarm-0.2.14.dist-info/METADATA,sha256=EDT-5iFXFjVPqxMYNwTTvF7Ob0yvMarAd5zPKTpaPlc,3847
|
139
|
+
beswarm-0.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
140
|
+
beswarm-0.2.14.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
141
|
+
beswarm-0.2.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|