diff --git a/addons/revChatGPT/revchatgpt.py b/addons/revChatGPT/revchatgpt.py index 7257642e9..31fbf54a9 100644 --- a/addons/revChatGPT/revchatgpt.py +++ b/addons/revChatGPT/revchatgpt.py @@ -3,8 +3,8 @@ from revChatGPT.V1 import Chatbot class revChatGPT: def __init__(self, config): - print("[RevChatGPT] 逆向库初始化:"+str(config)) - config['password'] = str(config['password']) + if 'password' in config: + config['password'] = str(config['password']) self.chatbot = Chatbot(config=config) def chat(self, prompt): diff --git a/configs/config.yaml b/configs/config.yaml index 7fcd33984..f577db6c9 100644 --- a/configs/config.yaml +++ b/configs/config.yaml @@ -56,20 +56,30 @@ direct_message_mode: true # enable设置为true后,将会停止使用上面正常的官方API调用而使用本逆向项目 # # 多账户可以保证每个请求都能得到及时的回复。 -# 关于account的格式 + + +# 关于account的格式,请你务必认真阅读以下格式。 + + +# account支持email+password、session_token、access_token多种方式登录。 +# 如果要使用session_token、access_token登录,直接添加新的一行(注意缩进!) - access_token: xxxxxxx即可 # account: +# - session_token: xxxxxxxx +# - access_token: xxxxxxxx # - email: 第1个账户 # password: 第1个账户密码 # - email: 第2个账户 # password: 第2个账户密码 # - .... # 请严格按照上面这个格式填写。 -# 这里我免费提供2个账号给大家,不过用的人一定会很多的,所以会造成一些bug,因此还是用自己的账号好一点。 +# 这里免费提供2个账号给大家,不过用的人一定会很多的,所以会造成一些bug,因此还是用自己的账号好一点。 # 需要账号可以联系我。QQ905617992 rev_ChatGPT: enable: false account: + - access_token: + # - session_token: xxxxxxxx - email: d.o.m.her.ry61.7@gmail.com password: 11111111 - email: ca.it.li.nal.o.i.si.o91@gmail.com diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index 0200a9ea4..a55d9871a 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -187,17 +187,18 @@ def initBot(cfg, prov): if 'account' in cfg['rev_ChatGPT']: from addons.revChatGPT.revchatgpt import revChatGPT for i in range(0, len(cfg['rev_ChatGPT']['account'])): - print(f"[System] 正在创建rev_ChatGPT负载{str(i)}: " + cfg['rev_ChatGPT']['account'][i]['email']) try: + print(f"[System] 创建rev_ChatGPT负载{str(i)}: " + str(cfg['rev_ChatGPT']['account'][i])) revstat = { 'obj': revChatGPT(cfg['rev_ChatGPT']['account'][i]), 'busy': False } rev_chatgpt.append(revstat) + except: print("[System] 创建rev_ChatGPT负载失败") else: - input("[System-err] 请退出本程序, 然后在配置文件中填写rev_ChatGPT的email和password") + input("[System-err] 请退出本程序, 然后在配置文件中填写rev_ChatGPT相关配置") elif prov == OPENAI_OFFICIAL: from cores.openai.core import ChatGPT chatgpt = ChatGPT(cfg['openai']) @@ -352,10 +353,11 @@ def get_rev_ChatGPT_response(prompts_str): def send_qq_msg(message, res, image_mode=False): if not image_mode: try: - future = asyncio.run_coroutine_threadsafe(message.reply(content=res), client.loop) - future.result() + res = asyncio.run_coroutine_threadsafe(message.reply(content=res), client.loop) + res.result() except BaseException as e: - raise + print("[System-Error] 回复QQ消息失败") + raise e else: asyncio.run_coroutine_threadsafe(message.reply(image=res, content=""), client.loop)