Skip to content

Commit cc6ab56

Browse files
committed
fix bugs and code structure
1 parent 6997fd6 commit cc6ab56

File tree

4 files changed

+40
-24
lines changed

4 files changed

+40
-24
lines changed

Readme.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Using ChatGPT-weBot based on ChatGPT(Non-API key call) and official WeChat hook
8383

8484
2. Download package from Github Releases.
8585

86-
3. Install `WeChat-3.6.0.18.exe` on your computer, **if your version is higher than 3.6.0.18, you can downgrade instantly.** Then get your account online.
86+
3. Install `WeChat-3.6.0.18.exe` on your computer, **if your version is higher than 3.6.0.18, you can downgrade instantly.** Then get your account online. You can also download zip version of WeChat. **If you wanna dual-call WeChat, modify `./dual-start.bat` file guiding by annotation.**
8787

8888

8989

@@ -152,6 +152,7 @@ Using ChatGPT-weBot based on ChatGPT(Non-API key call) and official WeChat hook
152152

153153
## Log
154154

155+
- 2023.2.27 Add zip version of WeChat and `dual-start.bat`, fix the bug that prevents other operations when the response keyword is empty.
155156
- 2023.2.25 Add the option in `config.json` to quote the original question before answering
156157
- 2023.2.25 Complete all API function on features and Debugs for errors
157158
- 2023.2.23 Accomplish some API listed on features

Readme_ZH.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
2. 从 Github Releases 下载需要的包。
8585

86-
3. 在您的计算机上安装 `WeChat-3.6.0.18.exe`**如果您正在使用的微信版本高于3.6.0.18,可以降级覆盖安装。** 之后请登陆您的微信。
86+
3. 在您的计算机上安装 `WeChat-3.6.0.18.exe`**如果您正在使用的微信版本高于3.6.0.18,可以降级覆盖安装。** 之后请登陆您的微信。您也可以下载 zip 版本的微信,**如果您想要实现微信双开,根据批处理注释修改 `./dual-start.bat`**
8787

8888

8989

@@ -148,6 +148,7 @@
148148

149149
## 日志
150150

151+
- 2023年2月27日 添加压缩包版微信与双开脚本,并修复响应关键字为空时无法进行其他操作的 bug
151152
- 2023年2月25日 `config.json` 中添加回答前引用原问题选项
152153
- 2023年2月25日 完成所有功能的 API 函数并修复了其它的错误
153154
- 2023年2月23日 完成了一些在功能列表中列出的 API 并进行了部分调试

client/wxclient.py

+25-22
Original file line numberDiff line numberDiff line change
@@ -257,28 +257,7 @@ def handle_recv_txt_msg(j):
257257
content = re.sub(groupChatKey, "", content)
258258

259259
if autoReply and ((not is_room and prvReplyMode) or (is_room and grpReplyMode)):
260-
if is_ask:
261-
if chatbot is None:
262-
chatbot = Chatbot(
263-
rev_config,
264-
conversation_id=None,
265-
parent_id=None,
266-
)
267-
if is_room:
268-
global_dict[(wx_id, room_id)] = chatbot
269-
else:
270-
global_dict[(wx_id, "")] = chatbot
271-
272-
print("ask:" + content)
273-
for data in chatbot.ask(
274-
prompt=content,
275-
):
276-
reply += data["message"][len(reply):]
277-
278-
if (grpCitationMode and is_room) or (prvCitationMode and not is_room):
279-
reply = content + "\n---------\n" + reply
280-
281-
elif content.startswith(helpKey):
260+
if content.startswith(helpKey):
282261
if is_room:
283262
reply = str(
284263
b'\xe6\xac\xa2\xe8\xbf\x8e\xe4\xbd\xbf\xe7\x94\xa8 ChatGPT-weBot\xef\xbc\x8c\xe6\x9c\xac\xe9'
@@ -314,6 +293,9 @@ def handle_recv_txt_msg(j):
314293
):
315294
reply += data["message"][len(reply):]
316295

296+
if (grpCitationMode and is_room) or (prvCitationMode and not is_room):
297+
reply = content + "\n- - - - - - - -\n" + reply.strip()
298+
317299
elif content.startswith(rollbackKey):
318300
if chatbot is None:
319301
reply = "您还没有问过问题"
@@ -332,6 +314,27 @@ def handle_recv_txt_msg(j):
332314

333315
time.sleep(1.5)
334316

317+
elif is_ask:
318+
if chatbot is None:
319+
chatbot = Chatbot(
320+
rev_config,
321+
conversation_id=None,
322+
parent_id=None,
323+
)
324+
if is_room:
325+
global_dict[(wx_id, room_id)] = chatbot
326+
else:
327+
global_dict[(wx_id, "")] = chatbot
328+
329+
print("ask:" + content)
330+
for data in chatbot.ask(
331+
prompt=content,
332+
):
333+
reply += data["message"][len(reply):]
334+
335+
if (grpCitationMode and is_room) or (prvCitationMode and not is_room):
336+
reply = content + "\n- - - - - - - -\n" + reply.strip()
337+
335338
else:
336339
return
337340
else:

dual-start.bat

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
3+
# Please enter your WeChat setup location in double quotation marks
4+
# 请在下方双引号中填写最新版本的微信安装目录
5+
start /d "D:\Program files(x86)\WeChat\" WeChat.exe
6+
7+
# Please enter your WeChat setup location in double quotation marks
8+
# 请在下方双引号中填写 3.6.0.18 版本的微信安装目录
9+
start /d "D:\Program files(x86)\WeChat\[3.6.0.18]_tmp" WeChat.exe
10+
11+
exit

0 commit comments

Comments
 (0)