pycoze 0.1.463__py3-none-any.whl → 0.1.465__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_base.py +6 -2
- {pycoze-0.1.463.dist-info → pycoze-0.1.465.dist-info}/METADATA +1 -1
- {pycoze-0.1.463.dist-info → pycoze-0.1.465.dist-info}/RECORD +6 -6
- {pycoze-0.1.463.dist-info → pycoze-0.1.465.dist-info}/LICENSE +0 -0
- {pycoze-0.1.463.dist-info → pycoze-0.1.465.dist-info}/WHEEL +0 -0
- {pycoze-0.1.463.dist-info → pycoze-0.1.465.dist-info}/top_level.txt +0 -0
pycoze/bot/chat_base.py
CHANGED
@@ -287,10 +287,15 @@ async def handle_user_inputs(
|
|
287
287
|
"content": f"\n```json\n{cleaned_content}\n```\n",
|
288
288
|
}
|
289
289
|
)
|
290
|
+
# 获取错误位置前后的上下文
|
291
|
+
start = max(0, e.pos - 100)
|
292
|
+
end = min(len(cleaned_content), e.pos + 100)
|
293
|
+
context = cleaned_content[start:end]
|
294
|
+
|
290
295
|
conversation_history.append(
|
291
296
|
{
|
292
297
|
"role": "user",
|
293
|
-
"content": "
|
298
|
+
"content": f"JSON parsing error\n\nError type: {type(e).__name__}\nError message: {e.msg}\nPosition: line {e.lineno}, column {e.colno}\n\nError context:\n{context}\n\nPlease check and correct the JSON format, then try again.",
|
294
299
|
}
|
295
300
|
)
|
296
301
|
start_new_stream["value"] = True
|
@@ -314,7 +319,6 @@ async def handle_user_inputs(
|
|
314
319
|
conversation_history.append(
|
315
320
|
{"role": "system", "content": "[Tool Result Begin]\n"+ result+ "\n[Tool Result End]"}
|
316
321
|
)
|
317
|
-
print("conversation_history", conversation_history)
|
318
322
|
if tool_name in ["complete_all_tasks", "ask_follow_up_question"]:
|
319
323
|
need_break = True
|
320
324
|
break
|
@@ -11,7 +11,7 @@ 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
13
|
pycoze/bot/chat.py,sha256=bScsMc0hGh2NlvhQxzWEbnA_WXU9JdAJv-rx27SpEB8,6554
|
14
|
-
pycoze/bot/chat_base.py,sha256=
|
14
|
+
pycoze/bot/chat_base.py,sha256=V7I-ikamB8dZaylK2TwGFGl2pgSTGJPY8SStfmXrzGk,13123
|
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=UtwZ31wFvNtvM9ZTA4BU2yT1Rb-qnUdU3Ny1O37Tt3Q,14077
|
@@ -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.465.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
37
|
+
pycoze-0.1.465.dist-info/METADATA,sha256=GkLhYBf-NNWenSsSmLITGbWWgmjdmChRzdATS55UEcw,854
|
38
|
+
pycoze-0.1.465.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
39
|
+
pycoze-0.1.465.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
40
|
+
pycoze-0.1.465.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|