Compare commits
59 Commits
publish2.5
...
publish2.8
| Author | SHA1 | Date | |
|---|---|---|---|
| f3722b31d5 | |||
| 673a4e2c7f | |||
| 1d8fba05b6 | |||
| 7c06883975 | |||
| 6da12b7a67 | |||
| 0342d752e6 | |||
| a851e34c94 | |||
| ad8aed5724 | |||
| 75101bf270 | |||
| 43df7003d6 | |||
| 502703b749 | |||
| 8365f39f95 | |||
| aa5f8db59d | |||
| d2b60b72d9 | |||
| 14c36ceb52 | |||
| cdc3bdd769 | |||
| 48d0c2a8c8 | |||
| 6923979014 | |||
| 03239439c9 | |||
| da3381a887 | |||
| a1253cc241 | |||
| ffe10cc5c2 | |||
| 7093cf5ab8 | |||
| 979a0cdd2e | |||
| b495a11d1f | |||
| 8698e87e51 | |||
| 6d2f9e5ba8 | |||
| 0e24e107d6 | |||
| 888a4e89ab | |||
| 1a55684ae8 | |||
| 858712dcbc | |||
| ad4d068bbc | |||
| 0f5a2101b7 | |||
| 7bc9d8dc7b | |||
| 506a62e6e6 | |||
| 44e22087d8 | |||
| d88c06578d | |||
| 93bc12a89c | |||
| eedcb9b825 | |||
| b8fe50a196 | |||
| 10b1538118 | |||
| 09cfd18f6f | |||
| d01be66344 | |||
| c0e4d0595b | |||
| d403323a36 | |||
| 3092bbd210 | |||
| 9d2cd27705 | |||
| ec48b57358 | |||
| 54cdca01d3 | |||
| 4b35f7f8fd | |||
| 651ba7b3d6 | |||
| cd1390d449 | |||
| d478ff02b6 | |||
| 1da3a19ddd | |||
| db66cbfb9c | |||
| 51729f4a50 | |||
| d739abef60 | |||
| 2ecb3fc7cf | |||
| 69c576086e |
@@ -1,20 +1,22 @@
|
||||
# 2023/3/2 已支持官方ChatGPT API,性能更好!!!
|
||||
|
||||
|
||||
## ⭐体验
|
||||
|
||||
使用手机QQ扫码加入QQ频道(频道名: GPT机器人 | 频道号: x42d56aki2)
|
||||
|
||||

|
||||
<img src="https://user-images.githubusercontent.com/37870767/227197121-4f1e02a4-92fd-4497-8768-9d6977a291b7.jpg" width="200"></img>
|
||||
|
||||
**Windows用户推荐Windows一键安装,请前往Release下载最新版本**
|
||||
|
||||
**详细部署教程链接**https://soulter.top/posts/qpdg.html
|
||||
详细部署教程链接:https://soulter.top/posts/qpdg.html
|
||||
|
||||
有任何问题请加频道反馈。
|
||||
有网络问题报错的请先看issue,解决不了再加频道反馈
|
||||
|
||||
## ⭐功能:
|
||||
|
||||
- 逆向ChatGPT库
|
||||
- 官方ChatGPT AI
|
||||
- 文心一言(即将支持,链接https://github.com/Soulter/ERNIEBot 欢迎Star)
|
||||
- NewBing(即将支持)
|
||||
|
||||
### 基本功能
|
||||
<details>
|
||||
<summary>✅ 回复符合上下文</summary>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
from aip import AipContentCensor
|
||||
|
||||
class BaiduJudge:
|
||||
def __init__(self, baidu_configs) -> None:
|
||||
if 'app_id' in baidu_configs and 'api_key' in baidu_configs and 'secret_key' in baidu_configs:
|
||||
self.app_id = str(baidu_configs['app_id'])
|
||||
self.api_key = baidu_configs['api_key']
|
||||
self.secret_key = baidu_configs['secret_key']
|
||||
self.client = AipContentCensor(self.app_id, self.api_key, self.secret_key)
|
||||
else:
|
||||
raise ValueError("Baidu configs error! 请填写百度内容审核服务相关配置!")
|
||||
def judge(self, text):
|
||||
res = self.client.textCensorUserDefined(text)
|
||||
if 'conclusionType' not in res:
|
||||
return False, "百度审核服务未知错误"
|
||||
if res['conclusionType'] == 1:
|
||||
return True, "合规"
|
||||
else:
|
||||
if 'data' not in res:
|
||||
return False, "百度审核服务未知错误"
|
||||
count = len(res['data'])
|
||||
info = f"百度审核服务发现 {count} 处违规:\n"
|
||||
for i in res['data']:
|
||||
info += f"{i['msg']};\n"
|
||||
info += "\n判断结果:"+res['conclusion']
|
||||
return False, info
|
||||
@@ -3,13 +3,27 @@ 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):
|
||||
resp = ''
|
||||
|
||||
"""
|
||||
Base class for exceptions in this module.
|
||||
Error codes:
|
||||
-1: User error
|
||||
0: Unknown error
|
||||
1: Server error
|
||||
2: Rate limit error
|
||||
3: Invalid request error
|
||||
4: Expired access token error
|
||||
5: Invalid access token error
|
||||
6: Prohibited concurrent query error
|
||||
"""
|
||||
|
||||
|
||||
err_count = 0
|
||||
retry_count = 5
|
||||
|
||||
@@ -19,11 +33,13 @@ class revChatGPT:
|
||||
resp = data["message"]
|
||||
break
|
||||
except BaseException as e:
|
||||
print(e)
|
||||
print("[RevChatGPT] 请求出现了一些问题, 正在重试。次数"+str(err_count))
|
||||
err_count += 1
|
||||
if err_count == retry_count:
|
||||
raise e
|
||||
try:
|
||||
print("[RevChatGPT] 请求出现了一些问题, 正在重试。次数"+str(err_count))
|
||||
err_count += 1
|
||||
if err_count >= retry_count:
|
||||
raise e
|
||||
except BaseException:
|
||||
err_count += 1
|
||||
|
||||
print("[RevChatGPT] "+str(resp))
|
||||
return resp
|
||||
@@ -0,0 +1,47 @@
|
||||
import asyncio
|
||||
from EdgeGPT import Chatbot, ConversationStyle
|
||||
import json
|
||||
|
||||
class revEdgeGPT:
|
||||
def __init__(self):
|
||||
self.busy = False
|
||||
self.wait_stack = []
|
||||
with open('./cookies.json', 'r') as f:
|
||||
cookies = json.load(f)
|
||||
self.bot = Chatbot(cookies=cookies)
|
||||
|
||||
def is_busy(self):
|
||||
return self.busy
|
||||
|
||||
async def reset(self):
|
||||
try:
|
||||
await self.bot.reset()
|
||||
return False
|
||||
except BaseException:
|
||||
return True
|
||||
|
||||
async def chat(self, prompt):
|
||||
if self.busy:
|
||||
return
|
||||
self.busy = True
|
||||
resp = 'err'
|
||||
err_count = 0
|
||||
retry_count = 5
|
||||
|
||||
while err_count < retry_count:
|
||||
try:
|
||||
resp = await self.bot.ask(prompt=prompt, conversation_style=ConversationStyle.creative)
|
||||
resp = resp['item']['messages'][len(resp['item']['messages'])-1]['text']
|
||||
if resp == prompt:
|
||||
resp += '\n\n如果你没有让我复述你的话,那代表我可能不想和你继续这个话题了,请输入/reset重置会话😶'
|
||||
break
|
||||
except BaseException as e:
|
||||
print(e.with_traceback)
|
||||
err_count += 1
|
||||
if err_count >= retry_count:
|
||||
raise e
|
||||
print("[RevEdgeGPT] 请求出现了一些问题, 正在重试。次数"+str(err_count))
|
||||
self.busy = False
|
||||
|
||||
print("[RevEdgeGPT] "+str(resp))
|
||||
return resp
|
||||
@@ -1,42 +0,0 @@
|
||||
openai:
|
||||
# 注意:在1.7版本已支持多key自动切换,方法:
|
||||
# key:
|
||||
# - xxxxx
|
||||
# - xxxxxx
|
||||
# 在下方非注释的地方使用以上格式
|
||||
key:
|
||||
-
|
||||
|
||||
chatGPTConfigs:
|
||||
engine: "gpt-3.5-turbo"
|
||||
max_tokens: 1000
|
||||
temperature: 0.9
|
||||
top_p: 1
|
||||
frequency_penalty: 0
|
||||
presence_penalty: 0
|
||||
|
||||
total_tokens_limit: 2000
|
||||
qqbot:
|
||||
appid:
|
||||
token:
|
||||
|
||||
# 设置是否一个人一个会话
|
||||
uniqueSessionMode: false
|
||||
|
||||
# QChannelBot 的版本,请勿修改此字段,否则可能产生一些bug
|
||||
version: 2.4 RealChatGPT Ver.
|
||||
|
||||
# [Beta] 转储历史记录时间间隔(分钟)
|
||||
dump_history_interval: 10
|
||||
|
||||
# 一个用户只能在time秒内发送count条消息
|
||||
limit:
|
||||
time: 60
|
||||
count: 5
|
||||
# 公告
|
||||
notice: "此机器人由Github项目QQChannelChatGPT驱动。"
|
||||
|
||||
# 是否打开私信功能
|
||||
# 设置为true则频道成员可以私聊机器人。
|
||||
# 设置为false则频道成员不能私聊机器人。
|
||||
direct_message_mode: true
|
||||
+36
-14
@@ -5,20 +5,26 @@
|
||||
# - sk-xxxxxx
|
||||
# - sk-xxxxxx
|
||||
# 在下方非注释的地方使用以上格式
|
||||
|
||||
# 关于api_base:可以使用一些云函数(如腾讯、阿里)来避免国内被墙的问题。
|
||||
# 详见:
|
||||
# https://github.com/Ice-Hazymoon/openai-scf-proxy
|
||||
# https://github.com/Soulter/QQChannelChatGPT/issues/42
|
||||
# 设置为none则表示使用官方默认api地址
|
||||
openai:
|
||||
key:
|
||||
-
|
||||
|
||||
api_base: none
|
||||
# 这里是GPT配置,语言模型默认使用gpt-3.5-turbo
|
||||
chatGPTConfigs:
|
||||
model: gpt-3.5-turbo
|
||||
max_tokens: 1500
|
||||
max_tokens: 3000
|
||||
temperature: 0.9
|
||||
top_p: 1
|
||||
frequency_penalty: 0
|
||||
presence_penalty: 0
|
||||
|
||||
total_tokens_limit: 2800
|
||||
total_tokens_limit: 5000
|
||||
|
||||
# QQ开放平台的appid和令牌
|
||||
# q.qq.com
|
||||
@@ -28,27 +34,43 @@ qqbot:
|
||||
|
||||
# 设置是否一个人一个会话
|
||||
uniqueSessionMode: false
|
||||
|
||||
# QChannelBot 的版本,请勿修改此字段,否则可能产生一些bug
|
||||
version: 2.5 RealChatGPT Ver.
|
||||
|
||||
version: 2.8
|
||||
# [Beta] 转储历史记录时间间隔(分钟)
|
||||
dump_history_interval: 10
|
||||
|
||||
# 一个用户只能在time秒内发送count条消息
|
||||
limit:
|
||||
time: 60
|
||||
count: 5
|
||||
# 公告
|
||||
notice: "此机器人由Github项目QQChannelChatGPT驱动。"
|
||||
|
||||
# 是否打开私信功能
|
||||
# 设置为true则频道成员可以私聊机器人。
|
||||
# 设置为false则频道成员不能私聊机器人。
|
||||
direct_message_mode: true
|
||||
|
||||
# 系统代理
|
||||
# http_proxy: http://localhost:7890
|
||||
# https_proxy: http://localhost:7890
|
||||
|
||||
|
||||
################外带程序(插件)################
|
||||
|
||||
# 百度内容审核服务
|
||||
# 新用户免费5万次调用。https://cloud.baidu.com/doc/ANTIPORN/index.html
|
||||
baidu_aip:
|
||||
enable: false
|
||||
app_id:
|
||||
api_key:
|
||||
secret_key:
|
||||
|
||||
# 逆向文心一言【暂时不可用,请勿使用】
|
||||
rev_ernie:
|
||||
enable: false
|
||||
|
||||
rev_edgegpt:
|
||||
enable: false
|
||||
|
||||
# 逆向ChatGPT库
|
||||
# https://github.com/acheong08/ChatGPT
|
||||
# 优点:免费(无免费额度限制);
|
||||
@@ -63,14 +85,14 @@ direct_message_mode: true
|
||||
# - email: 第2个账户
|
||||
# password: 第2个账户密码
|
||||
# - ....
|
||||
# 支持使用session_token\access_token登录
|
||||
# 例:
|
||||
# - session_token: xxxxx
|
||||
# - access_token: xxxx
|
||||
# 请严格按照上面这个格式填写。
|
||||
# 这里我免费提供2个账号给大家,不过用的人一定会很多的,所以会造成一些bug,因此还是用自己的账号好一点。
|
||||
# 需要账号可以联系我。QQ905617992
|
||||
|
||||
rev_ChatGPT:
|
||||
enable: false
|
||||
account:
|
||||
- email: d.o.m.her.ry61.7@gmail.com
|
||||
password: 11111111
|
||||
- email: ca.it.li.nal.o.i.si.o91@gmail.com
|
||||
password: 11111111
|
||||
- email:
|
||||
password:
|
||||
+25
-41
@@ -14,7 +14,9 @@ key_record_path = abs_path+'chatgpt_key_record'
|
||||
class ChatGPT:
|
||||
def __init__(self, cfg):
|
||||
self.key_list = []
|
||||
if cfg['key'] != '' or cfg['key'] != '修改我!!':
|
||||
if 'api_base' in cfg and cfg['api_base'] != 'none' and cfg['api_base'] != '':
|
||||
openai.api_base = cfg['api_base']
|
||||
if cfg['key'] != '' and cfg['key'] != None:
|
||||
print("[System] 读取ChatGPT Key成功")
|
||||
self.key_list = cfg['key']
|
||||
# openai.api_key = cfg['key']
|
||||
@@ -29,55 +31,37 @@ class ChatGPT:
|
||||
self.chatGPT_configs = chatGPT_configs
|
||||
self.openai_configs = cfg
|
||||
|
||||
def chat(self, prompt, image_mode = False):
|
||||
def chat(self, req, image_mode = False):
|
||||
# ChatGPT API 2023/3/2
|
||||
messages = [{"role": "user", "content": prompt}]
|
||||
# messages = [{"role": "user", "content": prompt}]
|
||||
try:
|
||||
if not image_mode:
|
||||
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=messages,
|
||||
**self.chatGPT_configs
|
||||
)
|
||||
else:
|
||||
response = openai.Image.create(
|
||||
prompt=prompt,
|
||||
n=1,
|
||||
size="512x512",
|
||||
)
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=req,
|
||||
**self.chatGPT_configs
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if 'You exceeded' in str(e) or 'Billing hard limit has been reached' in str(e) or 'No API key provided.' in str(e):
|
||||
print("[System] 当前Key已超额,正在切换")
|
||||
if 'You exceeded' in str(e) or 'Billing hard limit has been reached' in str(e) or 'No API key provided' in str(e) or 'Incorrect API key provided' in str(e):
|
||||
print("[System] 当前Key已超额或者不正常,正在切换")
|
||||
self.key_stat[openai.api_key]['exceed'] = True
|
||||
self.save_key_record()
|
||||
|
||||
response, is_switched = self.handle_switch_key(prompt)
|
||||
response, is_switched = self.handle_switch_key(req)
|
||||
if not is_switched:
|
||||
# 所有Key都超额
|
||||
# 所有Key都超额或不正常
|
||||
raise e
|
||||
else:
|
||||
if not image_mode:
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=messages,
|
||||
**self.chatGPT_configs
|
||||
)
|
||||
else:
|
||||
response = openai.Image.create(
|
||||
prompt=prompt,
|
||||
n=1,
|
||||
size="512x512",
|
||||
)
|
||||
if not image_mode:
|
||||
self.key_stat[openai.api_key]['used'] += response['usage']['total_tokens']
|
||||
self.save_key_record()
|
||||
print("[ChatGPT] "+str(response["choices"][0]["message"]["content"]))
|
||||
return str(response["choices"][0]["message"]["content"]).strip(), response['usage']['total_tokens']
|
||||
else:
|
||||
return response['data'][0]['url']
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=req,
|
||||
**self.chatGPT_configs
|
||||
)
|
||||
self.key_stat[openai.api_key]['used'] += response['usage']['total_tokens']
|
||||
self.save_key_record()
|
||||
print("[ChatGPT] "+str(response["choices"][0]["message"]["content"]))
|
||||
return str(response["choices"][0]["message"]["content"]).strip(), response['usage']['total_tokens']
|
||||
|
||||
def handle_switch_key(self, prompt):
|
||||
messages = [{"role": "user", "content": prompt}]
|
||||
def handle_switch_key(self, req):
|
||||
# messages = [{"role": "user", "content": prompt}]
|
||||
while True:
|
||||
is_all_exceed = True
|
||||
for key in self.key_stat:
|
||||
@@ -85,10 +69,10 @@ class ChatGPT:
|
||||
is_all_exceed = False
|
||||
openai.api_key = key
|
||||
print(f"[System] 切换到Key: {key}, 已使用token: {self.key_stat[key]['used']}")
|
||||
if prompt != '':
|
||||
if len(req) > 0:
|
||||
try:
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=messages,
|
||||
messages=req,
|
||||
**self.chatGPT_configs
|
||||
)
|
||||
return response, True
|
||||
|
||||
+221
-86
@@ -1,5 +1,6 @@
|
||||
import botpy
|
||||
from botpy.message import Message
|
||||
from botpy.types.message import Reference
|
||||
import yaml
|
||||
import re
|
||||
from util.errors.errors import PromptExceededError
|
||||
@@ -14,6 +15,7 @@ import util.unfit_words as uw
|
||||
import os
|
||||
import sys
|
||||
from cores.qqbot.personality import personalities
|
||||
from addons.baidu_aip_judge import BaiduJudge
|
||||
|
||||
|
||||
history_dump_interval = 10
|
||||
@@ -59,11 +61,13 @@ direct_message_mode = True
|
||||
abs_path = os.path.dirname(os.path.realpath(sys.argv[0])) + '/'
|
||||
|
||||
# 版本
|
||||
version = '2.4 RealChatGPT Ver.'
|
||||
version = '2.9'
|
||||
|
||||
# 语言模型提供商
|
||||
REV_CHATGPT = 'rev_chatgpt'
|
||||
OPENAI_OFFICIAL = 'openai_official'
|
||||
REV_ERNIE = 'rev_ernie'
|
||||
REV_EDGEGPT = 'rev_edgegpt'
|
||||
provider = ''
|
||||
|
||||
# 逆向库对象及负载均衡
|
||||
@@ -72,6 +76,10 @@ rev_chatgpt = []
|
||||
# gpt配置信息
|
||||
gpt_config = {}
|
||||
|
||||
# 百度内容审核实例
|
||||
baidu_judge = None
|
||||
|
||||
|
||||
def new_sub_thread(func, args=()):
|
||||
thread = threading.Thread(target=func, args=args, daemon=True)
|
||||
thread.start()
|
||||
@@ -80,8 +88,9 @@ class botClient(botpy.Client):
|
||||
# 收到At消息
|
||||
async def on_at_message_create(self, message: Message):
|
||||
toggle_count(at=True, message=message)
|
||||
message_reference = Reference(message_id=message.id, ignore_get_message_error=False)
|
||||
# executor.submit(oper_msg, message, True)
|
||||
new_sub_thread(oper_msg, (message, True))
|
||||
new_sub_thread(oper_msg, (message, True, message_reference))
|
||||
# await oper_msg(message=message, at=True)
|
||||
|
||||
# 收到私聊消息
|
||||
@@ -156,7 +165,7 @@ def upload():
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
key_stat = chatgpt.get_key_stat()
|
||||
d = {"data": {"guild_count": guild_count, "guild_msg_count": guild_msg_count, "guild_direct_msg_count": guild_direct_msg_count, "session_count": session_count, 'addr': addr, 'winver': version, 'key_stat':key_stat}}
|
||||
d = {"data": {'version': version, "guild_count": guild_count, "guild_msg_count": guild_msg_count, "guild_direct_msg_count": guild_direct_msg_count, "session_count": session_count, 'addr': addr, 'key_stat':key_stat}}
|
||||
d = json.dumps(d).encode("utf-8")
|
||||
res = requests.put(f'https://uqfxtww1.lc-cn-n1-shared.com/1.1/classes/bot_record/{object_id}', headers = headers, data = d)
|
||||
if json.loads(res.text)['code'] == 1:
|
||||
@@ -176,7 +185,7 @@ def upload():
|
||||
初始化机器人
|
||||
'''
|
||||
def initBot(cfg, prov):
|
||||
global chatgpt, provider, rev_chatgpt
|
||||
global chatgpt, provider, rev_chatgpt, baidu_judge, rev_ernie, rev_edgegpt
|
||||
global now_personality, gpt_config, config, uniqueSession, history_dump_interval, frequency_count, frequency_time,announcement, direct_message_mode, version
|
||||
|
||||
provider = prov
|
||||
@@ -187,14 +196,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'])
|
||||
revstat = {
|
||||
'obj': revChatGPT(cfg['rev_ChatGPT']['account'][i]),
|
||||
'busy': False
|
||||
}
|
||||
rev_chatgpt.append(revstat)
|
||||
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'])
|
||||
@@ -231,7 +244,23 @@ def initBot(cfg, prov):
|
||||
# 得到GPT配置信息
|
||||
if 'openai' in cfg and 'chatGPTConfigs' in cfg['openai']:
|
||||
gpt_config = cfg['openai']['chatGPTConfigs']
|
||||
elif prov == REV_ERNIE:
|
||||
from addons.revERNIE import revernie
|
||||
rev_ernie = revernie.wx
|
||||
elif prov == REV_EDGEGPT:
|
||||
from addons.revEdgeGPT import revedgegpt
|
||||
rev_edgegpt = revedgegpt.revEdgeGPT()
|
||||
|
||||
|
||||
# 百度内容审核
|
||||
if 'baidu_aip' in cfg and 'enable' in cfg['baidu_aip'] and cfg['baidu_aip']['enable']:
|
||||
try:
|
||||
baidu_judge = BaiduJudge(cfg['baidu_aip'])
|
||||
print("[System] 百度内容审核初始化成功")
|
||||
except BaseException as e:
|
||||
input("[System] 百度内容审核初始化失败: " + str(e))
|
||||
exit()
|
||||
|
||||
# 统计上传
|
||||
if is_upload_log:
|
||||
# 读取object_id
|
||||
@@ -252,8 +281,13 @@ def initBot(cfg, prov):
|
||||
|
||||
# 得到版本
|
||||
if 'version' in cfg:
|
||||
version = cfg['version']
|
||||
print("[System] QQChannelChatGPT版本: "+str(version))
|
||||
try:
|
||||
f = open(abs_path+"version.txt", 'r', encoding='utf-8')
|
||||
version = f.read()
|
||||
except:
|
||||
print('[System-Err] 读取更新记录文件失败')
|
||||
# version = 'Unknown'
|
||||
# print("[System] QQChannelChatGPT版本: "+str(version))
|
||||
|
||||
# 得到发言频率配置
|
||||
if 'limit' in cfg:
|
||||
@@ -263,7 +297,7 @@ def initBot(cfg, prov):
|
||||
if 'time' in cfg['limit']:
|
||||
frequency_time = cfg['limit']['time']
|
||||
|
||||
announcement += '[QQChannelChatGPT项目]\n所有回答与腾讯公司无关。出现问题请前往[GPT机器人]官方频道\n\n'
|
||||
announcement += '[QQChannelChatGPT项目,觉得好用的话欢迎前往Github给Star]\n所有回答与腾讯公司无关。出现问题请前往[GPT机器人]官方频道\n\n'
|
||||
# 得到公告配置
|
||||
if 'notice' in cfg:
|
||||
print('[System] 公告配置: '+cfg['notice'])
|
||||
@@ -285,7 +319,7 @@ def initBot(cfg, prov):
|
||||
print("\n[System] 如果有任何问题,请在https://github.com/Soulter/QQChannelChatGPT上提交issue说明问题!或者添加QQ:905617992")
|
||||
print("[System] 请给https://github.com/Soulter/QQChannelChatGPT点个star!")
|
||||
print("[System] 请给https://github.com/Soulter/QQChannelChatGPT点个star!")
|
||||
input("\n仔细阅读完以上信息后,输入任意信息并回车以继续")
|
||||
# input("\n仔细阅读完以上信息后,输入任意信息并回车以继续")
|
||||
try:
|
||||
run_bot(cfg['qqbot']['appid'], cfg['qqbot']['token'])
|
||||
except BaseException as e:
|
||||
@@ -304,16 +338,24 @@ def run_bot(appid, token):
|
||||
'''
|
||||
得到OpenAI官方API的回复
|
||||
'''
|
||||
def get_chatGPT_response(prompts_str, image_mode=False):
|
||||
def get_chatGPT_response(context, request, image_mode=False):
|
||||
res = ''
|
||||
usage = ''
|
||||
|
||||
req_list = []
|
||||
for i in context:
|
||||
req_list.append(i['user'])
|
||||
req_list.append(i['AI'])
|
||||
req_list.append(request['user'])
|
||||
|
||||
if not image_mode:
|
||||
res, usage = chatgpt.chat(prompts_str)
|
||||
print("[Debug] "+ str(req_list))
|
||||
res, usage = chatgpt.chat(req_list)
|
||||
# 处理结果文本
|
||||
chatgpt_res = res.strip()
|
||||
return res, usage
|
||||
else:
|
||||
res = chatgpt.chat(prompts_str, image_mode = True)
|
||||
res = chatgpt.chat(req_list, image_mode = True)
|
||||
return res
|
||||
|
||||
'''
|
||||
@@ -324,14 +366,26 @@ def get_rev_ChatGPT_response(prompts_str):
|
||||
print("[Debug] "+str(rev_chatgpt))
|
||||
for revstat in rev_chatgpt:
|
||||
if not revstat['busy']:
|
||||
revstat['busy'] = True
|
||||
print("[Debug] 使用逆向ChatGPT回复ing", end='')
|
||||
res = revstat['obj'].chat(prompts_str)
|
||||
print("OK")
|
||||
revstat['busy'] = False
|
||||
# 处理结果文本
|
||||
chatgpt_res = res.strip()
|
||||
return res
|
||||
try:
|
||||
revstat['busy'] = True
|
||||
print("[Debug] 使用逆向ChatGPT回复ing", end='', flush=True)
|
||||
res = revstat['obj'].chat(prompts_str)
|
||||
print("OK")
|
||||
revstat['busy'] = False
|
||||
# 处理结果文本
|
||||
chatgpt_res = res.strip()
|
||||
return res
|
||||
except Exception as e:
|
||||
print("[System-Error] 逆向ChatGPT回复失败" + str(e))
|
||||
try:
|
||||
if e.code == 2:
|
||||
print("[System-Error] 频率限制,正在切换账号。"+ str(e))
|
||||
continue
|
||||
else:
|
||||
res = '所有的非忙碌OpenAI账号经过测试都暂时出现问题,请稍后再试或者联系管理员~'
|
||||
return res
|
||||
except BaseException:
|
||||
continue
|
||||
res = '所有的OpenAI账号都有负载, 请稍后再试~'
|
||||
return res
|
||||
|
||||
@@ -339,12 +393,17 @@ def get_rev_ChatGPT_response(prompts_str):
|
||||
'''
|
||||
回复QQ消息
|
||||
'''
|
||||
def send_qq_msg(message, res, image_mode=False):
|
||||
def send_qq_msg(message, res, image_mode=False, msg_ref = None):
|
||||
if not image_mode:
|
||||
try:
|
||||
asyncio.run_coroutine_threadsafe(message.reply(content=res), client.loop)
|
||||
except:
|
||||
raise
|
||||
if msg_ref is not None:
|
||||
res = asyncio.run_coroutine_threadsafe(message.reply(content=res, message_reference = msg_ref), client.loop)
|
||||
else:
|
||||
res = asyncio.run_coroutine_threadsafe(message.reply(content=res), client.loop)
|
||||
res.result()
|
||||
except BaseException as e:
|
||||
print("[System-Error] 回复QQ消息失败")
|
||||
raise e
|
||||
else:
|
||||
asyncio.run_coroutine_threadsafe(message.reply(image=res, content=""), client.loop)
|
||||
|
||||
@@ -363,10 +422,13 @@ def get_prompts_by_cache_list(cache_data_list, divide=False, paging=False, size=
|
||||
page_end = len(cache_data_list)
|
||||
cache_data_list = cache_data_list[page_begin:page_end]
|
||||
for item in cache_data_list:
|
||||
prompts += str(item['prompt'])
|
||||
prompts += str(item['user']['role']) + ":\n" + str(item['user']['content']) + "\n"
|
||||
prompts += str(item['AI']['role']) + ":\n" + str(item['AI']['content']) + "\n"
|
||||
|
||||
if divide:
|
||||
prompts += "----------\n"
|
||||
return prompts
|
||||
|
||||
|
||||
def get_user_usage_tokens(cache_list):
|
||||
usage_tokens = 0
|
||||
@@ -398,7 +460,7 @@ def check_frequency(id) -> bool:
|
||||
'''
|
||||
处理消息
|
||||
'''
|
||||
def oper_msg(message, at=False, loop=None):
|
||||
def oper_msg(message, at=False, msg_ref = None):
|
||||
global session_dict, provider
|
||||
print("[QQBOT] 接收到消息:"+ str(message.content))
|
||||
qq_msg = ''
|
||||
@@ -453,11 +515,12 @@ def oper_msg(message, at=False, loop=None):
|
||||
|
||||
# 这里是预设,你可以按需更改
|
||||
if qq_msg.strip() == 'hello' or qq_msg.strip() == '你好' or qq_msg.strip() == '':
|
||||
send_qq_msg(message, f"你好呀~")
|
||||
send_qq_msg(message, f"你好呀🥰,输入/help查看指令噢", msg_ref=msg_ref)
|
||||
return
|
||||
# if qq_msg.strip() == '傻逼' or qq_msg.strip() == 'sb':
|
||||
# send_qq_msg(message, f"好好好")
|
||||
# return
|
||||
|
||||
# if '喜多' in qq_msg:
|
||||
# send_qq_msg(message, 'http://rn2ztkeap.hn-bkt.clouddn.com/xd1.gif', True)
|
||||
# if '台湾' in qq_msg or 'taiwan' in qq_msg:
|
||||
@@ -465,8 +528,14 @@ def oper_msg(message, at=False, loop=None):
|
||||
|
||||
# 关键词拦截器
|
||||
for i in uw.unfit_words_q:
|
||||
if i in qq_msg.strip():
|
||||
send_qq_msg(message, f"你的提问中有不太合适的内容😭\n请更换措辞~")
|
||||
matches = re.match(i, qq_msg.strip(), re.I | re.M)
|
||||
if matches:
|
||||
send_qq_msg(message, f"你的提问得到的回复未通过【自有关键词拦截】服务,不予回复。", msg_ref=msg_ref)
|
||||
return
|
||||
if baidu_judge != None:
|
||||
check, msg = baidu_judge.judge(qq_msg)
|
||||
if not check:
|
||||
send_qq_msg(message, f"你的提问得到的回复未通过【百度AI内容审核】服务,不予回复。\n\n{msg}", msg_ref=msg_ref)
|
||||
return
|
||||
|
||||
# 会话机制
|
||||
@@ -488,30 +557,50 @@ def oper_msg(message, at=False, loop=None):
|
||||
f.close()
|
||||
|
||||
chatgpt_res = "[Error] 占位符"
|
||||
|
||||
if provider == OPENAI_OFFICIAL:
|
||||
|
||||
# 获取缓存
|
||||
cache_prompt = ''
|
||||
# cache_prompt = ''
|
||||
cache_data_list = session_dict[session_id]
|
||||
cache_prompt = get_prompts_by_cache_list(cache_data_list)
|
||||
cache_prompt += "\nHuman: "+ qq_msg + "\nAI: "
|
||||
# cache_prompt = get_prompts_by_cache_list(cache_data_list)
|
||||
# cache_prompt += "\nHuman: "+ qq_msg + "\nAI: "
|
||||
|
||||
# 创建一个新的Record
|
||||
|
||||
record_obj = {
|
||||
"user": {
|
||||
"role": "user",
|
||||
"content": qq_msg,
|
||||
},
|
||||
"AI": {},
|
||||
'usage_tokens': 0,
|
||||
}
|
||||
|
||||
# ChatGPT API 回复倾向(人格)
|
||||
if command_type == 1:
|
||||
record_obj["user"]["role"] = "system"
|
||||
|
||||
print("[Debug] "+ str(cache_data_list))
|
||||
|
||||
# 请求chatGPT获得结果
|
||||
try:
|
||||
chatgpt_res, current_usage_tokens = get_chatGPT_response(prompts_str=cache_prompt)
|
||||
chatgpt_res, current_usage_tokens = get_chatGPT_response(context=cache_data_list, request=record_obj)
|
||||
except (BaseException) as e:
|
||||
print("[System-Err] OpenAI API错误。原因如下:\n"+str(e))
|
||||
if 'maximum context length' in str(e):
|
||||
print("token超限, 清空对应缓存")
|
||||
session_dict[session_id] = []
|
||||
cache_data_list = []
|
||||
cache_prompt = "Human: "+ qq_msg + "\nAI: "
|
||||
chatgpt_res, current_usage_tokens = get_chatGPT_response(prompts_str=cache_prompt)
|
||||
chatgpt_res, current_usage_tokens = get_chatGPT_response(context=cache_data_list, request=record_obj)
|
||||
elif 'exceeded' in str(e):
|
||||
send_qq_msg(message, f"OpenAI API错误。原因:\n{str(e)} \n超额了。可自己搭建一个机器人(Github仓库:QQChannelChatGPT)")
|
||||
return
|
||||
else:
|
||||
send_qq_msg(message, f"OpenAI API错误。原因如下:\n{str(e)} \n前往官方频道反馈~")
|
||||
return
|
||||
f_res = re.sub(r'(https|http)?:\/\/(\w|\.|\/|\?|\=|\&|\%)*\b', '[被隐藏的链接]', str(e), flags=re.MULTILINE)
|
||||
f_res = f_res.replace(".", "·")
|
||||
send_qq_msg(message, f"OpenAI API错误。原因如下:\n{f_res} \n前往官方频道反馈~")
|
||||
return
|
||||
|
||||
# 超过指定tokens, 尽可能的保留最多的条目,直到小于max_tokens
|
||||
if current_usage_tokens > max_tokens:
|
||||
@@ -520,35 +609,45 @@ def oper_msg(message, at=False, loop=None):
|
||||
while t > max_tokens:
|
||||
if index >= len(cache_data_list):
|
||||
break
|
||||
if 'level' in cache_data_list[index] and cache_data_list[index]['level'] != 'max':
|
||||
# 保留倾向(人格)信息
|
||||
if 'user' in cache_data_list[index] and cache_data_list[index]['user']['role'] != 'system':
|
||||
t -= int(cache_data_list[index]['single_tokens'])
|
||||
del cache_data_list[index]
|
||||
else:
|
||||
index += 1
|
||||
# 删除完后更新相关字段
|
||||
session_dict[session_id] = cache_data_list
|
||||
cache_prompt = get_prompts_by_cache_list(cache_data_list)
|
||||
# cache_prompt = get_prompts_by_cache_list(cache_data_list)
|
||||
|
||||
# 添加新条目进入缓存的prompt
|
||||
if command_type == 1:
|
||||
level = 'max'
|
||||
record_obj['AI'] = {
|
||||
'role': 'assistant',
|
||||
'content': chatgpt_res,
|
||||
}
|
||||
record_obj['usage_tokens'] = current_usage_tokens
|
||||
if len(cache_data_list) > 0:
|
||||
record_obj['single_tokens'] = current_usage_tokens - int(cache_data_list[-1]['usage_tokens'])
|
||||
else:
|
||||
level = 'normal'
|
||||
if len(cache_data_list) > 0:
|
||||
single_record = {
|
||||
"prompt": f'Human: {qq_msg}\nAI: {chatgpt_res}\n',
|
||||
"usage_tokens": current_usage_tokens,
|
||||
"single_tokens": current_usage_tokens - int(cache_data_list[-1]['usage_tokens']),
|
||||
"level": level
|
||||
}
|
||||
else:
|
||||
single_record = {
|
||||
"prompt": f'Human: {qq_msg}\nAI: {chatgpt_res}\n',
|
||||
"usage_tokens": current_usage_tokens,
|
||||
"single_tokens": current_usage_tokens,
|
||||
"level": level
|
||||
}
|
||||
cache_data_list.append(single_record)
|
||||
record_obj['single_tokens'] = current_usage_tokens
|
||||
|
||||
cache_data_list.append(record_obj)
|
||||
# if len(cache_data_list) > 0:
|
||||
# single_record = {
|
||||
# 'role': 'assistant',
|
||||
# "content": chatgpt_res,
|
||||
# "usage_tokens": current_usage_tokens,
|
||||
# "single_tokens": current_usage_tokens - int(cache_data_list[-1]['usage_tokens']),
|
||||
# "level": level
|
||||
# }
|
||||
# else:
|
||||
# single_record = {
|
||||
# 'role': 'assistant',
|
||||
# "prompt": f'Human: {qq_msg}\nAI: {chatgpt_res}\n',
|
||||
# "usage_tokens": current_usage_tokens,
|
||||
# "single_tokens": current_usage_tokens,
|
||||
# "level": level
|
||||
# }
|
||||
# cache_data_list.append(single_record)
|
||||
session_dict[session_id] = cache_data_list
|
||||
|
||||
elif provider == REV_CHATGPT:
|
||||
@@ -558,38 +657,62 @@ def oper_msg(message, at=False, loop=None):
|
||||
print("[System-Err] Rev ChatGPT API错误。原因如下:\n"+str(e))
|
||||
send_qq_msg(message, f"Rev ChatGPT API错误。原因如下:\n{str(e)} \n前往官方频道反馈~")
|
||||
return
|
||||
elif provider == REV_ERNIE:
|
||||
try:
|
||||
chatgpt_res = "[RevERNIE]"+str(rev_ernie.chatViaSelenium(qq_msg))
|
||||
except BaseException as e:
|
||||
print("[System-Err] Rev ERNIE API错误。原因如下:\n"+str(e))
|
||||
send_qq_msg(message, f"Rev ERNIE API错误。原因如下:\n{str(e)} \n前往官方频道反馈~")
|
||||
return
|
||||
elif provider == REV_EDGEGPT:
|
||||
try:
|
||||
if rev_edgegpt.is_busy():
|
||||
send_qq_msg(message, f"[RevBing] 正忙,请稍后再试",msg_ref=msg_ref)
|
||||
return
|
||||
else:
|
||||
chatgpt_res = "[RevBing]"
|
||||
chatgpt_res += str(asyncio.run_coroutine_threadsafe(rev_edgegpt.chat(qq_msg), client.loop).result())
|
||||
except BaseException as e:
|
||||
print("[System-Err] Rev NewBing API错误。原因如下:\n"+str(e))
|
||||
send_qq_msg(message, f"Rev NewBing API错误。原因如下:\n{str(e)} \n前往官方频道反馈~")
|
||||
return
|
||||
# 记录日志
|
||||
logf.write("[GPT] "+ str(chatgpt_res)+'\n')
|
||||
logf.flush()
|
||||
|
||||
# 敏感过滤
|
||||
# 过滤不合适的词
|
||||
judged_res = chatgpt_res
|
||||
for i in uw.unfit_words:
|
||||
judged_res = re.sub(i, "***", judged_res)
|
||||
# 百度内容审核服务二次审核
|
||||
if baidu_judge != None:
|
||||
check, msg = baidu_judge.judge(judged_res)
|
||||
if not check:
|
||||
send_qq_msg(message, f"你的提问得到的回复【百度内容审核】未通过,不予回复。\n\n{msg}", msg_ref=msg_ref)
|
||||
return
|
||||
# 发送qq信息
|
||||
try:
|
||||
# 防止被qq频道过滤消息
|
||||
gap_chatgpt_res = chatgpt_res.replace(".", " . ")
|
||||
if '```' in gap_chatgpt_res:
|
||||
chatgpt_res.replace('```', "")
|
||||
# 过滤不合适的词
|
||||
for i in uw.unfit_words:
|
||||
if i in gap_chatgpt_res:
|
||||
gap_chatgpt_res = gap_chatgpt_res.replace(i, "***")
|
||||
gap_chatgpt_res = judged_res.replace(".", " . ")
|
||||
send_qq_msg(message, ''+gap_chatgpt_res, msg_ref=msg_ref)
|
||||
# 发送信息
|
||||
send_qq_msg(message, ''+gap_chatgpt_res)
|
||||
except:
|
||||
|
||||
except BaseException as e:
|
||||
print("QQ频道API错误: \n"+str(e))
|
||||
f_res = ""
|
||||
for t in chatgpt_res:
|
||||
f_res += t + ' '
|
||||
try:
|
||||
send_qq_msg(message, ''+f_res)
|
||||
send_qq_msg(message, ''+f_res, msg_ref=msg_ref)
|
||||
# send(message, f"QQ频道API错误:{str(e)}\n下面是格式化后的回答:\n{f_res}")
|
||||
except:
|
||||
except BaseException as e:
|
||||
# 如果还是不行则过滤url
|
||||
f_res = re.sub(r'(https|http)?:\/\/(\w|\.|\/|\?|\=|\&|\%)*\b', '', f_res, flags=re.MULTILINE)
|
||||
f_res = re.sub(r'(https|http)?:\/\/(\w|\.|\/|\?|\=|\&|\%)*\b', '[被隐藏的链接]', str(e), flags=re.MULTILINE)
|
||||
f_res = f_res.replace(".", "·")
|
||||
send_qq_msg(message, ''+f_res)
|
||||
send_qq_msg(message, ''+f_res, msg_ref=msg_ref)
|
||||
# send(message, f"QQ频道API错误:{str(e)}\n下面是格式化后的回答:\n{f_res}")
|
||||
|
||||
# 记录日志
|
||||
logf.write("[GPT] "+ str(chatgpt_res)+'\n')
|
||||
logf.flush()
|
||||
|
||||
|
||||
'''
|
||||
获取统计信息
|
||||
@@ -625,7 +748,7 @@ def get_stat():
|
||||
def command_oper(qq_msg, message, session_id, name, user_id, user_name, at):
|
||||
go = False # 是否处理完指令后继续执行msg_oper后面的代码
|
||||
msg = ''
|
||||
global session_dict, now_personality, provider
|
||||
global session_dict, now_personality, provider, rev_edgegpt, client
|
||||
|
||||
# 指令返回值,/set设置人格是1
|
||||
type = -1
|
||||
@@ -633,8 +756,12 @@ def command_oper(qq_msg, message, session_id, name, user_id, user_name, at):
|
||||
# 指令控制
|
||||
if qq_msg == "/reset" or qq_msg == "/重置":
|
||||
msg = ''
|
||||
session_dict[session_id] = []
|
||||
if provider == REV_EDGEGPT and rev_edgegpt is not None:
|
||||
asyncio.run_coroutine_threadsafe(rev_edgegpt.reset(), client.loop).result()
|
||||
else:
|
||||
session_dict[session_id] = []
|
||||
if at:
|
||||
|
||||
msg = f"{name}(id: {session_id})的历史记录重置成功\n\n{announcement}"
|
||||
else:
|
||||
msg = f"你的历史记录重置成功"
|
||||
@@ -683,7 +810,7 @@ def command_oper(qq_msg, message, session_id, name, user_id, user_name, at):
|
||||
key_stat = chatgpt.get_key_stat()
|
||||
key_list = chatgpt.get_key_list()
|
||||
index = 1
|
||||
max = 900000
|
||||
max = 9000000
|
||||
gg_count = 0
|
||||
total = 0
|
||||
tag = ''
|
||||
@@ -726,7 +853,8 @@ def command_oper(qq_msg, message, session_id, name, user_id, user_name, at):
|
||||
|
||||
if qq_msg[:6] == "/unset":
|
||||
now_personality = {}
|
||||
msg = "已清除人格"
|
||||
session_dict[session_id] = []
|
||||
msg = "已清除人格并重置历史记录。"
|
||||
|
||||
if qq_msg[:4] == "/set":
|
||||
if len(qq_msg) == 4:
|
||||
@@ -764,5 +892,12 @@ def command_oper(qq_msg, message, session_id, name, user_id, user_name, at):
|
||||
go = True
|
||||
type = 1
|
||||
else:
|
||||
msg = f"人格{ps}不存在, 请使用/set list查看人格列表"
|
||||
return msg, go, type
|
||||
now_personality = {
|
||||
'name': '自定义人格',
|
||||
'prompt': ps
|
||||
}
|
||||
session_dict[session_id] = []
|
||||
msg = f"你的自定义人格已设置。 \n人格信息: {ps}\n请耐心等待机器人回复第一条信息。"
|
||||
go = True
|
||||
type = 1
|
||||
return msg, go, type
|
||||
|
||||
@@ -8,12 +8,19 @@ import requests,json
|
||||
|
||||
abs_path = os.path.dirname(os.path.realpath(sys.argv[0])) + '/'
|
||||
|
||||
|
||||
def main(loop, event):
|
||||
import cores.qqbot.core as qqBot
|
||||
import yaml
|
||||
|
||||
ymlfile = open(abs_path+"configs/config.yaml", 'r', encoding='utf-8')
|
||||
cfg = yaml.safe_load(ymlfile)
|
||||
|
||||
if 'http_proxy' in cfg:
|
||||
os.environ['HTTP_PROXY'] = cfg['http_proxy']
|
||||
if 'https_proxy' in cfg:
|
||||
os.environ['HTTPS_PROXY'] = cfg['https_proxy']
|
||||
|
||||
provider = privider_chooser(cfg)
|
||||
print('[System] 当前语言模型提供商: ' + provider)
|
||||
# 执行Bot
|
||||
@@ -24,11 +31,15 @@ def main(loop, event):
|
||||
def privider_chooser(cfg):
|
||||
if 'rev_ChatGPT' in cfg and cfg['rev_ChatGPT']['enable']:
|
||||
return 'rev_chatgpt'
|
||||
elif 'rev_ernie' in cfg and cfg['rev_ernie']['enable']:
|
||||
return 'rev_ernie'
|
||||
elif 'rev_edgegpt' in cfg and cfg['rev_edgegpt']['enable']:
|
||||
return 'rev_edgegpt'
|
||||
else:
|
||||
return 'openai_official'
|
||||
|
||||
# 仅支持linux
|
||||
def hot_update(ver):
|
||||
def hot_update():
|
||||
target = 'target.tar'
|
||||
time.sleep(5)
|
||||
while(True):
|
||||
@@ -82,11 +93,11 @@ def hot_update(ver):
|
||||
print('自启动')
|
||||
py = sys.executable
|
||||
os.execl(py, py, *sys.argv)
|
||||
time.sleep(60*20)
|
||||
time.sleep(60*60*3)
|
||||
except BaseException as e:
|
||||
print(e)
|
||||
print("upd出现异常, 请联系QQ905617992")
|
||||
time.sleep(60*20)
|
||||
time.sleep(60*60*3)
|
||||
|
||||
def update_version(ver):
|
||||
if not os.path.exists('update_record'):
|
||||
@@ -168,8 +179,8 @@ if __name__ == "__main__":
|
||||
check_env()
|
||||
bot_event = threading.Event()
|
||||
loop = asyncio.get_event_loop()
|
||||
ma_type = get_platform()
|
||||
if ma_type == 'linux':
|
||||
threading.Thread(target=hot_update).start()
|
||||
# ma_type = get_platform()
|
||||
# if ma_type == 'linux':
|
||||
# threading.Thread(target=hot_update).start()
|
||||
|
||||
main(loop, bot_event)
|
||||
+6
-3
@@ -1,3 +1,6 @@
|
||||
requests~=2.27.1
|
||||
openai~=0.27.0
|
||||
qq-botpy~=1.1.2
|
||||
requests
|
||||
openai
|
||||
qq-botpy
|
||||
revChatGPT~=4.0.8
|
||||
baidu-aip
|
||||
EdgeGPT~=0.1.2
|
||||
Reference in New Issue
Block a user