pycoze 0.1.476__py3-none-any.whl → 0.1.478__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 CHANGED
@@ -290,7 +290,7 @@ async def handle_user_inputs(
290
290
  conversation_history.append(
291
291
  {
292
292
  "role": "user",
293
- "content": "Invalid JSON content:" + str(e) + ", you should try again. \n\nWhen the content contains triple backticks ```, they MUST be escaped as \`\`\`.",
293
+ "content": "Invalid JSON content:" + str(e) + ", you should try again. \n\nWhen the content contains triple backticks ```, they MUST be escaped as @`@`@`@.",
294
294
  }
295
295
  )
296
296
  start_new_stream["value"] = True
pycoze/bot/prompt.md CHANGED
@@ -108,7 +108,7 @@ def write_or_overwrite_file(path: str, content: str) -> None:
108
108
  Parameters:
109
109
  path (str): The file path to write, which can be a relative path.
110
110
  content (str): The content to write or overwrite into the file. Always provide the full content of the file, do not truncate or omit parts. You must include all sections of the file, even those that haven't been modified!
111
- When the content contains triple backticks ```, they MUST be escaped as \`\`\`.
111
+ When the content contains triple backticks ```, they MUST be escaped as @`@`@`@.
112
112
 
113
113
  Returns:
114
114
  None
@@ -153,6 +153,7 @@ def replace_part_of_a_file(path: str, diff: str) -> None:
153
153
  5. Special Operations:
154
154
  * Moving code: Use two SEARCH/REPLACE blocks (one removes from original position, one inserts into new position)
155
155
  * Deleting code: Use an empty REPLACE section
156
+ 6. When the REPLACE content contains triple backticks ```, they MUST be escaped as @`@`@`@.
156
157
 
157
158
  Parameters:
158
159
  path (str): The file path to modify.
@@ -318,23 +319,24 @@ def complete_all_tasks(result: str, command: str = None) -> None:
318
319
  ==== Usage Rules
319
320
  1. Json content must be formatted within markdown as `json`, thus requiring \`\`\`json at the start and \`\`\` at the end.
320
321
  2. You should communicate in the language used by the user in <task>...task content</task>; if the task content is in English, respond in English; if the task content is in Chinese, respond in Chinese...
322
+ 3. For simple issues, there is no need to consult the user; intelligent judgment and handling can be performed. Do not hastily conclude the task or ask the user questions before completing the user's task.
321
323
  {% if allow_access_webpage or no_exit_if_incomplete %}
322
- 3. The values of explanatory parameters such as {% if allow_access_webpage %} "question" {% endif %} {% if allow_access_webpage and no_exit_if_incomplete %} and {% endif %} {% if no_exit_if_incomplete %} "result" and "<thinking>" {% endif %} need to be in the language used in the <task>...task content</task> by the user;
324
+ 4. The values of explanatory parameters such as {% if allow_access_webpage %} "question" {% endif %} {% if allow_access_webpage and no_exit_if_incomplete %} and {% endif %} {% if no_exit_if_incomplete %} "result" and "<thinking>" {% endif %} need to be in the language used in the <task>...task content</task> by the user;
323
325
  {% endif %}
324
- 4. When encountering an irreparable error, please explain to the user what specific error has been encountered.
326
+ 5. When encountering an irreparable error, please explain to the user what specific error has been encountered.
325
327
  {% if folder_context %}
326
- 5. Be thorough, precise, and thoughtful in every interaction.
327
- 6. Always explain your reasoning, offering insights into why your solution is optimal rather than just presenting json content.
328
- 7. Consider edge cases, potential impacts, and backward compatibility in your suggestions.
329
- 8. Follow best practices specific to the language, ensuring your code is idiomatic and efficient.
330
- 9. Suggest tests, validation steps, or monitoring strategies to ensure the solution works as expected.
331
- 10. Your goal is not only to solve problems but also to elevate developers' skills and understanding, yet your replies should be concise enough.
332
- 11. Iteratively use tools, confirming success at each step before proceeding.
333
- 12. Never assume any outcome of tool usage—always wait for user confirmation.
334
- 13. Be direct and technical in responses, avoiding unnecessary conversational elements.
335
- 14. Always consider the broader context of the project and environment when making decisions.
336
- 15. Before thinking about how to modify an existing code file, it is necessary to first read and understand the content of the existing file.
337
- 16. You can't truncate or omit parts of the file content when writing or overwriting a file.
328
+ 6. Be thorough, precise, and thoughtful in every interaction.
329
+ 7. Always explain your reasoning, offering insights into why your solution is optimal rather than just presenting json content.
330
+ 8. Consider edge cases, potential impacts, and backward compatibility in your suggestions.
331
+ 9. Follow best practices specific to the language, ensuring your code is idiomatic and efficient.
332
+ 10. Suggest tests, validation steps, or monitoring strategies to ensure the solution works as expected.
333
+ 11. Your goal is not only to solve problems but also to elevate developers' skills and understanding, yet your replies should be concise enough.
334
+ 12. Iteratively use tools, confirming success at each step before proceeding.
335
+ 13. Never assume any outcome of tool usage—always wait for user confirmation.
336
+ 14. Be direct and technical in responses, avoiding unnecessary conversational elements.
337
+ 15. Always consider the broader context of the project and environment when making decisions.
338
+ 16. Before thinking about how to modify an existing code file, it is necessary to first read and understand the content of the existing file.
339
+ 17. You can't truncate or omit parts of the file content when writing or overwriting a file.
338
340
 
339
341
 
340
342
  ==== Goals
pycoze/bot/tools.py CHANGED
@@ -117,7 +117,7 @@ class WriteFileTool(Tool):
117
117
  # 创建目录并写入或覆盖文件
118
118
  os.makedirs(os.path.dirname(path), exist_ok=True)
119
119
  with open(path, "w", encoding="utf-8") as f:
120
- f.write(self.params["content"])
120
+ f.write(self.params["content"].replace("@`@`@`@", "```"))
121
121
  return f"File [[{path}]] written successfully."
122
122
 
123
123
 
@@ -142,7 +142,7 @@ class ReplaceInFileTool(Tool):
142
142
  for diff_block in diff_content.split("<<<<<<< SEARCH")[1:]:
143
143
  search, replace = diff_block.split("=======")
144
144
  search = search.strip()
145
- replace = replace.split(">>>>>>> REPLACE")[0].strip()
145
+ replace = replace.split(">>>>>>> REPLACE")[0].strip().replace("@`@`@`@", "```")
146
146
  if search in content:
147
147
  content = content.replace(search, replace, 1)
148
148
  success_count += 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pycoze
3
- Version: 0.1.476
3
+ Version: 0.1.478
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -11,11 +11,11 @@ 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=CQUxMmwCuDOsG8lisrsO_yu5H3sl2u42BJ7nbaUZq-k,12783
14
+ pycoze/bot/chat_base.py,sha256=9GZb605aWzw-dWEM6ZQio88y0Fs_zA2O3nPnWCj-W7c,12784
15
15
  pycoze/bot/lib.py,sha256=WU4h3B7SG7vh9p9BxhtPlaJ7TkU9VsL3HyCn9hKhWOo,7753
16
16
  pycoze/bot/message.py,sha256=udnIi-h4QgGzkbr_5VcAsVGjoLp9wXJSfBCeuOz7_Bk,802
17
- pycoze/bot/prompt.md,sha256=ZWJ3rnvCZQlqfrulki8mqCOFHvi2jKW_71oxaVI3BfA,14160
18
- pycoze/bot/tools.py,sha256=BWMdwvqLzvcyaW38lzxUWtc0K1V-C_qPSEZ3OKlAQvU,11108
17
+ pycoze/bot/prompt.md,sha256=omlr6l814JToT4JkbU8AY7VizNxAsAGPdjev8rNBnkE,14464
18
+ pycoze/bot/tools.py,sha256=mbaCXFSTx72d2PaHPTolrJPe6n_9b2GxJ-eP6Mmm-kM,11160
19
19
  pycoze/reference/__init__.py,sha256=u25FWJnOBWsDRoL8_O4jzW4tkJrHT3Sqp9EGCxUhS3E,211
20
20
  pycoze/reference/bot.py,sha256=UZK24Qm8kpqpwXJy_zNZeTEEDee05luXdSBeUm0NCt0,2029
21
21
  pycoze/reference/fn.py,sha256=ZXnG2ctbHMgr3quQp-4bpnErIkuT-t2_ToSET5LTLbc,750
@@ -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.476.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
37
- pycoze-0.1.476.dist-info/METADATA,sha256=EHQPCr8l1lapiRFkoFZgbpZRIO7r3SvsSRPVm_gcK3g,854
38
- pycoze-0.1.476.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
- pycoze-0.1.476.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
40
- pycoze-0.1.476.dist-info/RECORD,,
36
+ pycoze-0.1.478.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
37
+ pycoze-0.1.478.dist-info/METADATA,sha256=vDpUsy8h1MeYgru8jiP_vUB1-Y_oNplvP7lkYPufdBE,854
38
+ pycoze-0.1.478.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
+ pycoze-0.1.478.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
40
+ pycoze-0.1.478.dist-info/RECORD,,