pycoze 0.1.480__py3-none-any.whl → 0.1.482__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.
- pycoze/bot/chat.py +6 -4
- pycoze/bot/chat_base.py +1 -1
- {pycoze-0.1.480.dist-info → pycoze-0.1.482.dist-info}/METADATA +1 -1
- {pycoze-0.1.480.dist-info → pycoze-0.1.482.dist-info}/RECORD +7 -7
- {pycoze-0.1.480.dist-info → pycoze-0.1.482.dist-info}/LICENSE +0 -0
- {pycoze-0.1.480.dist-info → pycoze-0.1.482.dist-info}/WHEEL +0 -0
- {pycoze-0.1.480.dist-info → pycoze-0.1.482.dist-info}/top_level.txt +0 -0
pycoze/bot/chat.py
CHANGED
@@ -18,21 +18,21 @@ def eclipse_tool_result(text, threshold=100):
|
|
18
18
|
pattern = r'\[Tool Result Begin\](.*?)\[Tool Result End\]'
|
19
19
|
|
20
20
|
# 检查标签是否匹配
|
21
|
-
begin_count = text.count('
|
22
|
-
end_count = text.count('
|
21
|
+
begin_count = text.count('<ToolResult>')
|
22
|
+
end_count = text.count('</ToolResult>')
|
23
23
|
if begin_count != end_count:
|
24
24
|
return text
|
25
25
|
|
26
26
|
def replace_match(match):
|
27
27
|
content = match.group(1)
|
28
28
|
# 检查嵌套标签
|
29
|
-
if '
|
29
|
+
if '<ToolResult>' in content or '</ToolResult>' in content:
|
30
30
|
return match.group(0) # 返回原始匹配内容,不替换
|
31
31
|
|
32
32
|
if len(content) < threshold:
|
33
33
|
return match.group(0) # 返回原始匹配内容,不替换
|
34
34
|
else:
|
35
|
-
return "
|
35
|
+
return "<ToolResult>too long to remember...</ToolResult>"
|
36
36
|
|
37
37
|
replaced_text = re.sub(pattern, replace_match, text, flags=re.DOTALL)
|
38
38
|
return replaced_text
|
@@ -117,6 +117,8 @@ def chat(bot_setting_file: str):
|
|
117
117
|
folder_context = bot_setting["folderContext"]
|
118
118
|
if folder_context:
|
119
119
|
cwd = bot_setting["specifiedWorkingDirectory"]
|
120
|
+
if cwd is None:
|
121
|
+
cwd = tempfile.mkdtemp()
|
120
122
|
else:
|
121
123
|
cwd = tempfile.mkdtemp()
|
122
124
|
|
pycoze/bot/chat_base.py
CHANGED
@@ -312,7 +312,7 @@ async def handle_user_inputs(
|
|
312
312
|
{"role": "assistant", "content": assistant_content}
|
313
313
|
)
|
314
314
|
conversation_history.append(
|
315
|
-
{"role": "system", "content": "
|
315
|
+
{"role": "system", "content": "<ToolResult>\n"+ result+ "\n</ToolResult>"}
|
316
316
|
)
|
317
317
|
if tool_name in ["complete_all_tasks", "ask_follow_up_question"]:
|
318
318
|
need_break = True
|
@@ -10,8 +10,8 @@ pycoze/api/lib/view.py,sha256=_PIpTfeuTPPlMDKshMGsqFQYMq7ZiO4Hg5XwHwDoU60,7357
|
|
10
10
|
pycoze/api/lib/web.py,sha256=4HaOV_zYHq6-SSQQIc_O7REnC1asIlXIELxee-pU6zc,2421
|
11
11
|
pycoze/api/lib/window.py,sha256=ZZacqnX0fvZUnLUhNVjbbjhBcKkYdi_6E0LswLp1MqM,2071
|
12
12
|
pycoze/bot/__init__.py,sha256=rL3Q-ycczRpSFfKn84fg3QBl5k22WpyeIU5qOEjEby8,79
|
13
|
-
pycoze/bot/chat.py,sha256=
|
14
|
-
pycoze/bot/chat_base.py,sha256=
|
13
|
+
pycoze/bot/chat.py,sha256=UjiQeK-7rGmBY1w5EhQCx_-Y9ccHXHY_2F5LQX5NIa8,6582
|
14
|
+
pycoze/bot/chat_base.py,sha256=QBti8IWTOTVlXodlQnzID-amUtw3TtBzwJC7C2z_pow,12773
|
15
15
|
pycoze/bot/lib.py,sha256=WU4h3B7SG7vh9p9BxhtPlaJ7TkU9VsL3HyCn9hKhWOo,7753
|
16
16
|
pycoze/bot/message.py,sha256=udnIi-h4QgGzkbr_5VcAsVGjoLp9wXJSfBCeuOz7_Bk,802
|
17
17
|
pycoze/bot/prompt.md,sha256=l2RR3F3Zjp3NawJWCbd5cZslLgoq4eBpvppaXlezexU,14313
|
@@ -33,8 +33,8 @@ pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
|
33
33
|
pycoze/utils/process.py,sha256=U2MURGmxfyWBqdbKfy5UvyV17M40B6HHlNELgWfgrTE,3824
|
34
34
|
pycoze/utils/socket.py,sha256=4Wm4LlwdWXC_kAV0NnZbUc0Y3Kc6KRMyFRqSw79u-9w,2468
|
35
35
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
36
|
-
pycoze-0.1.
|
37
|
-
pycoze-0.1.
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
36
|
+
pycoze-0.1.482.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
37
|
+
pycoze-0.1.482.dist-info/METADATA,sha256=EBkcE5WLD72-WdP_S_lzidUVAwXBU_z8-Tb39fkg3JY,854
|
38
|
+
pycoze-0.1.482.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
39
|
+
pycoze-0.1.482.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
40
|
+
pycoze-0.1.482.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|