Merge branch 'master' into ChatGPTAI-perf

This commit is contained in:
Soulter
2023-03-05 12:32:09 +08:00
committed by GitHub
3 changed files with 21 additions and 9 deletions
+2 -2
View File
@@ -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):
+12 -2
View File
@@ -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
+7 -5
View File
@@ -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)