pycoze 0.1.339__py3-none-any.whl → 0.1.341__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 +34 -14
- {pycoze-0.1.339.dist-info → pycoze-0.1.341.dist-info}/METADATA +7 -9
- {pycoze-0.1.339.dist-info → pycoze-0.1.341.dist-info}/RECORD +6 -6
- {pycoze-0.1.339.dist-info → pycoze-0.1.341.dist-info}/WHEEL +1 -1
- {pycoze-0.1.339.dist-info → pycoze-0.1.341.dist-info}/LICENSE +0 -0
- {pycoze-0.1.339.dist-info → pycoze-0.1.341.dist-info}/top_level.txt +0 -0
pycoze/bot/chat_base.py
CHANGED
@@ -7,10 +7,13 @@ from .tools import ToolExecutor
|
|
7
7
|
from typing import List
|
8
8
|
|
9
9
|
|
10
|
-
def guess_files_in_message(cwd:str, user_message: str) -> List[str]:
|
10
|
+
def guess_files_in_message(cwd: str, user_message: str) -> List[str]:
|
11
11
|
|
12
|
-
value = extract(
|
13
|
-
|
12
|
+
value = extract(
|
13
|
+
{"includedFiles": ["relative path format", "relative path format", "..."]},
|
14
|
+
'Please find the files mentioned in the text. If none, return {"includedFiles": []}:\n'
|
15
|
+
+ user_message,
|
16
|
+
)
|
14
17
|
return [resolve_relative_path(cwd, p) for p in value["includedFiles"]]
|
15
18
|
|
16
19
|
|
@@ -25,9 +28,15 @@ def user_task_prompt(conversation_history, cwd, user_input: str, programmer_mode
|
|
25
28
|
if os.path.isfile(file_path):
|
26
29
|
file_marker = f"[[{file_path}]]'"
|
27
30
|
file_content = read_local_file(file_path)
|
28
|
-
if not any(
|
31
|
+
if not any(
|
32
|
+
file_marker in msg["content"] for msg in conversation_history
|
33
|
+
):
|
29
34
|
content.append(f"{file_marker}\n{file_content}")
|
30
|
-
content_str =
|
35
|
+
content_str = (
|
36
|
+
"Partial contents of files are as follows:" + "\n".join(content)
|
37
|
+
if content
|
38
|
+
else ""
|
39
|
+
)
|
31
40
|
return f"""
|
32
41
|
<task>
|
33
42
|
{user_input}
|
@@ -145,9 +154,11 @@ async def stream_openai_response(conversation_history, start_new_stream):
|
|
145
154
|
yield ("text", text_content.strip())
|
146
155
|
|
147
156
|
|
148
|
-
async def handle_user_inputs(
|
149
|
-
|
150
|
-
|
157
|
+
async def handle_user_inputs(
|
158
|
+
conversation_history, user_input, cwd, abilities, has_any_tool, bot_setting
|
159
|
+
):
|
160
|
+
no_exit_if_incomplete = bot_setting["systemAbility"]["no_exit_if_incomplete"]
|
161
|
+
programmer_mode = bot_setting["systemAbility"]["programmer_mode"]
|
151
162
|
|
152
163
|
start_new_stream = {
|
153
164
|
"value": False
|
@@ -160,7 +171,9 @@ async def handle_user_inputs(conversation_history, user_input, cwd, abilities, h
|
|
160
171
|
conversation_history.append(
|
161
172
|
{
|
162
173
|
"role": "user",
|
163
|
-
"content": user_task_prompt(
|
174
|
+
"content": user_task_prompt(
|
175
|
+
conversation_history, cwd, user_input, programmer_mode
|
176
|
+
),
|
164
177
|
}
|
165
178
|
)
|
166
179
|
need_break = False
|
@@ -174,7 +187,11 @@ async def handle_user_inputs(conversation_history, user_input, cwd, abilities, h
|
|
174
187
|
conversation_history, start_new_stream
|
175
188
|
):
|
176
189
|
if len(response) == 2:
|
177
|
-
if
|
190
|
+
if (
|
191
|
+
response[0] == "text"
|
192
|
+
and response[1].strip() != ""
|
193
|
+
or (response[0] == "json" and not has_any_tool)
|
194
|
+
):
|
178
195
|
conversation_history.append(
|
179
196
|
{"role": "assistant", "content": response[1]}
|
180
197
|
)
|
@@ -206,7 +223,9 @@ async def handle_user_inputs(conversation_history, user_input, cwd, abilities, h
|
|
206
223
|
)
|
207
224
|
continue
|
208
225
|
|
209
|
-
ok, is_json_dumps, result = ToolExecutor.execute_tool(
|
226
|
+
ok, is_json_dumps, result = ToolExecutor.execute_tool(
|
227
|
+
cwd, tool_request, abilities
|
228
|
+
)
|
210
229
|
if ok:
|
211
230
|
info("assistant", "✅\n")
|
212
231
|
else:
|
@@ -218,13 +237,14 @@ async def handle_user_inputs(conversation_history, user_input, cwd, abilities, h
|
|
218
237
|
+ result
|
219
238
|
)
|
220
239
|
if is_json_dumps:
|
221
|
-
info("assistant", "```json\n" + result + "\n```\n\n")
|
240
|
+
info("assistant", "\n```json\n" + result + "\n```\n\n")
|
222
241
|
else:
|
223
|
-
info("assistant", "```text\n" + result + "\n```\n\n")
|
242
|
+
info("assistant", "\n```text\n" + result + "\n```\n\n")
|
224
243
|
conversation_history.append(
|
225
244
|
{"role": "assistant", "content": assistant_content}
|
226
245
|
)
|
227
|
-
if tool_name in ["complete_all_tasks",
|
246
|
+
if tool_name in ["complete_all_tasks", "ask_follow_up_question"]:
|
247
|
+
print("need_break", need_break)
|
228
248
|
need_break = True
|
229
249
|
break
|
230
250
|
else:
|
@@ -1,22 +1,18 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: pycoze
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.341
|
4
4
|
Summary: Package for pycoze only!
|
5
|
+
Home-page: UNKNOWN
|
5
6
|
Author: Yuan Jie Xiong
|
6
7
|
Author-email: aiqqqqqqq@qq.com
|
8
|
+
License: UNKNOWN
|
9
|
+
Platform: UNKNOWN
|
7
10
|
Classifier: Programming Language :: Python :: 3
|
8
11
|
Classifier: License :: OSI Approved :: MIT License
|
9
12
|
Classifier: Operating System :: OS Independent
|
10
13
|
Requires-Python: >=3.6
|
11
14
|
Description-Content-Type: text/markdown
|
12
15
|
License-File: LICENSE
|
13
|
-
Dynamic: author
|
14
|
-
Dynamic: author-email
|
15
|
-
Dynamic: classifier
|
16
|
-
Dynamic: description
|
17
|
-
Dynamic: description-content-type
|
18
|
-
Dynamic: requires-python
|
19
|
-
Dynamic: summary
|
20
16
|
|
21
17
|
# PYCOZE
|
22
18
|
|
@@ -32,3 +28,5 @@ Package for pycoze only!
|
|
32
28
|
<!-- python setup.py sdist bdist_wheel -->
|
33
29
|
<!-- twine upload dist/* -->
|
34
30
|
<!-- 修改src\renderer\layout\init\const.ts中的库版本要求 -->
|
31
|
+
|
32
|
+
|
@@ -13,7 +13,7 @@ pycoze/api/lib/web.py,sha256=GWgtiTJOolKOX2drXcwuyqTcbo5FQVxa1NuBGcNyjyc,223
|
|
13
13
|
pycoze/api/lib/window.py,sha256=bTkQCzQZ7i3pYXB70bUSTBNJ9C4TW_X3yMae1VkquGk,1944
|
14
14
|
pycoze/bot/__init__.py,sha256=rL3Q-ycczRpSFfKn84fg3QBl5k22WpyeIU5qOEjEby8,79
|
15
15
|
pycoze/bot/chat.py,sha256=s12X8iOZa8MK-5VUd9JfzIA-gLxY80FJfphcfEx3b_s,3414
|
16
|
-
pycoze/bot/chat_base.py,sha256=
|
16
|
+
pycoze/bot/chat_base.py,sha256=d7rsp_E1woC8UFBsqPExicNfwMHAB0e50vsodL8ISGA,9722
|
17
17
|
pycoze/bot/lib.py,sha256=smigeWuhl8esHE-Y5l_9bpjJkEJ5OqrxTyPcO8JIubM,7224
|
18
18
|
pycoze/bot/message.py,sha256=Zq-_k8HztBMOUIs3hbOvWvwHBNopn4UJJBliCROIGcc,718
|
19
19
|
pycoze/bot/prompt.md,sha256=OBxwUY6yiwEmusnUHhwixWYByrWX3BpwfxG_Gfas8UM,15783
|
@@ -33,8 +33,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
|
33
33
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
34
34
|
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
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.341.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
37
|
+
pycoze-0.1.341.dist-info/METADATA,sha256=4TbIEp79JsS7uw3qPGCEUWF6wdY8W9XwtTk3HMuf75c,755
|
38
|
+
pycoze-0.1.341.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
39
|
+
pycoze-0.1.341.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
40
|
+
pycoze-0.1.341.dist-info/RECORD,,
|
File without changes
|
File without changes
|