pycoze 0.1.392__py3-none-any.whl → 0.1.394__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 CHANGED
@@ -59,6 +59,7 @@ async def run_with_interrupt_check(
59
59
  abilities,
60
60
  has_any_tool,
61
61
  bot_setting,
62
+ bot_setting_file:str,
62
63
  interrupt_file,
63
64
  ):
64
65
  clear_chat_data()
@@ -71,6 +72,7 @@ async def run_with_interrupt_check(
71
72
  abilities,
72
73
  has_any_tool,
73
74
  bot_setting,
75
+ bot_setting_file
74
76
  )
75
77
  )
76
78
  check_task = asyncio.create_task(
@@ -138,6 +140,7 @@ def chat(bot_setting_file: str):
138
140
  abilities,
139
141
  has_any_tool,
140
142
  bot_setting,
143
+ bot_setting_file,
141
144
  params["interruptFile"],
142
145
  )
143
146
  )
@@ -150,6 +153,7 @@ def chat(bot_setting_file: str):
150
153
  abilities,
151
154
  has_any_tool,
152
155
  bot_setting,
156
+ bot_setting_file,
153
157
  )
154
158
  )
155
159
  output("assistant", CHAT_DATA["info"])
@@ -185,7 +189,7 @@ def get_chat_response(bot_setting_file: str, user_input: str):
185
189
  ]
186
190
  asyncio.run(
187
191
  handle_user_inputs(
188
- conversation_history, user_input, cwd, abilities, has_any_tool, bot_setting
192
+ conversation_history, user_input, cwd, abilities, has_any_tool, bot_setting, bot_setting_file
189
193
  )
190
194
  )
191
195
 
pycoze/bot/chat_base.py CHANGED
@@ -36,7 +36,14 @@ def format_content(cwd, potential_paths, conversation_history):
36
36
  else ""
37
37
  )
38
38
 
39
- def generate_user_task_prompt(conversation_history, cwd, user_input: str, programmer_mode: bool, active_file:str, opened_files: List[str]):
39
+ def generate_user_task_prompt(conversation_history, cwd, user_input: str, bot_setting_file:str):
40
+ # 需要重新读取openedFiles和activeFile
41
+ with open(bot_setting_file, encoding="utf-8") as f:
42
+ bot_setting = json.load(f)
43
+ programmer_mode = bot_setting["programmerMode"]
44
+ opened_files = bot_setting["openedFiles"]
45
+ active_file = bot_setting["activeFile"]
46
+
40
47
  if programmer_mode:
41
48
  potential_paths = guess_files_in_message(cwd, user_input)
42
49
 
@@ -151,14 +158,11 @@ async def stream_openai_response(conversation_history, start_new_stream):
151
158
 
152
159
 
153
160
  async def handle_user_inputs(
154
- conversation_history, user_input, cwd, abilities, has_any_tool, bot_setting
161
+ conversation_history, user_input, cwd, abilities, has_any_tool, bot_setting, bot_setting_file:str
155
162
  ):
156
163
  no_exit_if_incomplete = bot_setting["systemAbility"]["no_exit_if_incomplete"]
157
- programmer_mode = bot_setting["programmerMode"]
158
164
  show_tool_results = bot_setting["showToolResults"]
159
- opened_files = bot_setting["openedFiles"]
160
- active_file = bot_setting["activeFile"]
161
-
165
+
162
166
  start_new_stream = {
163
167
  "value": False
164
168
  } # 当遇到AI准备执行JSON,即需要新信息的时候,用于强制停止当前stream,减少后续无效的tokens
@@ -171,7 +175,7 @@ async def handle_user_inputs(
171
175
  {
172
176
  "role": "user",
173
177
  "content": generate_user_task_prompt(
174
- conversation_history, cwd, user_input, programmer_mode, active_file, opened_files
178
+ conversation_history, cwd, user_input, bot_setting_file
175
179
  ),
176
180
  }
177
181
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pycoze
3
- Version: 0.1.392
3
+ Version: 0.1.394
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -11,8 +11,8 @@ pycoze/api/lib/view.py,sha256=_PIpTfeuTPPlMDKshMGsqFQYMq7ZiO4Hg5XwHwDoU60,7357
11
11
  pycoze/api/lib/web.py,sha256=GWgtiTJOolKOX2drXcwuyqTcbo5FQVxa1NuBGcNyjyc,223
12
12
  pycoze/api/lib/window.py,sha256=dkzWfLwn5pE_L0DfQ38K8nx9tQyT5KO-GYyXi0rytFc,2073
13
13
  pycoze/bot/__init__.py,sha256=rL3Q-ycczRpSFfKn84fg3QBl5k22WpyeIU5qOEjEby8,79
14
- pycoze/bot/chat.py,sha256=4RGMwg2TjFERd-4LTIpQ6ilaRx4eP566KaQma2jg2O4,6296
15
- pycoze/bot/chat_base.py,sha256=wDPSGuIr4osM-LP0Np3TnNI1hsGWhtX0BE_RJupqUgU,10218
14
+ pycoze/bot/chat.py,sha256=PGjW1_dzck_OU_YwGhr1xfQFz3gLiZnPC_Objx_IZ9E,6449
15
+ pycoze/bot/chat_base.py,sha256=pAfvFqOJNC8a2pF28TeouI5HtTILyftzbnD8UJqaqxk,10317
16
16
  pycoze/bot/lib.py,sha256=WMVhyKFXvNoLrS2wvNOakIJXyUmVE6ujCV6XVDV0M6A,7213
17
17
  pycoze/bot/message.py,sha256=udnIi-h4QgGzkbr_5VcAsVGjoLp9wXJSfBCeuOz7_Bk,802
18
18
  pycoze/bot/prompt.md,sha256=YafQyrBhRGny_RrOWW0kk1IVf_MUxcdDH1dAh_-eHmM,13948
@@ -32,8 +32,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
32
32
  pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
33
33
  pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
34
34
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
35
- pycoze-0.1.392.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
36
- pycoze-0.1.392.dist-info/METADATA,sha256=YgQD1b7uhawWKP8mw0X6XKn3xFaRxaidJbgudM544Iw,854
37
- pycoze-0.1.392.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
38
- pycoze-0.1.392.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
39
- pycoze-0.1.392.dist-info/RECORD,,
35
+ pycoze-0.1.394.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
36
+ pycoze-0.1.394.dist-info/METADATA,sha256=d9-r-wpNgk0aq0qsh8Onb5TF1or1kAH5YMH7CMAyxL0,854
37
+ pycoze-0.1.394.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
38
+ pycoze-0.1.394.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
39
+ pycoze-0.1.394.dist-info/RECORD,,