diff --git a/README.md b/README.md
index 2ea9b1708..949a5c9f8 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,37 @@
-# QQChannelChatGPT
-在QQ和QQ频道上使用ChatGPT、NewBing等语言模型,稳定,一次部署,同时使用。
+

-教程:https://soulter.top/posts/qpdg.html
+[](https://www.python.org/)
+[](https://github.com/Soulter/QQChannelChatGPT/blob/master/LICENSE)
+
+
+_✨在QQ和QQ频道上使用ChatGPT、NewBing等语言模型,稳定,一次部署,同时使用✨_
-欢迎体验😊(频道名: GPT机器人 | 频道号: x42d56aki2) | QQ群号:322154837):
+_✨教程:https://github.com/Soulter/QQChannelChatGPT/wiki ✨_
-

+_✨欢迎体验😊(频道名: GPT机器人 | 频道号: x42d56aki2) | QQ群号:322154837)✨_
+
+
## ⭐功能:
-通知:部署好后,如果使用的是bing或者逆向ChatGPT库,需要使用切换模型指令`/bing`或者'/revgpt'
-
近期新功能:
- 支持一键切换语言模型(使用/bing /revgpt /gpt分别可以切换newbing、逆向ChatGPT、官方ChatGPT模型)
- 热更新
- 接入QQ,支持在QQ上和QQ频道上同时聊天!https://github.com/Soulter/QQChannelChatGPT/issues/82
+- 更强大的Windows启动器,环境配置自动搞定。链接:https://github.com/Soulter/QQChatGPTLauncher/releases/latest
支持的AI语言模型(请在`configs/config.yaml`下配置):
- 逆向ChatGPT库
- 官方ChatGPT AI
-- 文心一言(即将支持,链接https://github.com/Soulter/ERNIEBot 欢迎Star)
+- 文心一言(即将支持)
- NewBing
- Bard (即将支持)
-部署QQ频道机器人教程链接:https://soulter.top/posts/qpdg.html
+部署此项目的教程链接:https://github.com/Soulter/QQChannelChatGPT/wiki
### 基本功能
@@ -129,17 +133,30 @@ pip install -r requirements.txt
```
> ⚠Python版本应>=3.9
+
### 配置
-**详细部署教程链接**https://soulter.top/posts/qpdg.html
+**详细部署教程链接**https://github.com/Soulter/QQChannelChatGPT/wiki
### 启动
- 启动main.py
+## 感谢
+本项目使用了一下项目:
+
+[ChatGPT by acheong08](https://github.com/acheong08/ChatGPT)
+
+[EdgeGPT by acheong08](https://github.com/acheong08/EdgeGPT)
+
+[go-cqhttp by Mrs4s](https://github.com/Mrs4s/go-cqhttp)
+
+[nakuru-project by Lxns-Network](https://github.com/Lxns-Network/nakuru-project)
+
+
## ⚙配置文件说明:
```yaml
-# 如果你不知道怎么部署,请查看https://soulter.top/posts/qpdg.html
+# 如果你不知道怎么部署,请查看https://github.com/Soulter/QQChannelChatGPT/wiki
# 不一定需要key了,如果你没有key但有openAI账号或者必应账号,可以考虑使用下面的逆向库
diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py
index 35b0706a1..a2d82bc2c 100644
--- a/cores/qqbot/core.py
+++ b/cores/qqbot/core.py
@@ -187,12 +187,15 @@ def initBot(cfg, prov):
input("[System-err] 请退出本程序, 然后在配置文件中填写rev_ChatGPT相关配置")
if REV_EDGEGPT in prov:
- if cfg['rev_edgegpt']['enable']:
- from model.provider.provider_rev_edgegpt import ProviderRevEdgeGPT
- from model.command.command_rev_edgegpt import CommandRevEdgeGPT
- rev_edgegpt = ProviderRevEdgeGPT()
- command_rev_edgegpt = CommandRevEdgeGPT(rev_edgegpt)
- chosen_provider = REV_EDGEGPT
+ if not os.path.exists('./cookies.json'):
+ input("【错误】导入Bing模型时发生错误,没有找到cookies文件或者cookies文件放置位置错误。windows启动器启动的用户请把cookies.json文件放到和启动器相同的目录下。\n如何获取请看https://github.com/Soulter/QQChannelChatGPT仓库介绍。")
+ else:
+ if cfg['rev_edgegpt']['enable']:
+ from model.provider.provider_rev_edgegpt import ProviderRevEdgeGPT
+ from model.command.command_rev_edgegpt import CommandRevEdgeGPT
+ rev_edgegpt = ProviderRevEdgeGPT()
+ command_rev_edgegpt = CommandRevEdgeGPT(rev_edgegpt)
+ chosen_provider = REV_EDGEGPT
if OPENAI_OFFICIAL in prov:
if cfg['openai']['key'] is not None:
from model.provider.provider_openai_official import ProviderOpenAIOfficial
@@ -590,12 +593,11 @@ def oper_msg(message, group=False, msg_ref = None, platform = None):
# 敏感过滤
# 过滤不合适的词
- judged_res = chatgpt_res
for i in uw.unfit_words:
- judged_res = re.sub(i, "***", judged_res)
+ chatgpt_res = re.sub(i, "***", chatgpt_res)
# 百度内容审核服务二次审核
if baidu_judge != None:
- check, msg = baidu_judge.judge(judged_res)
+ check, msg = baidu_judge.judge(chatgpt_res)
if not check:
send_message(platform, message, f"你的提问得到的回复【百度内容审核】未通过,不予回复。\n\n{msg}", msg_ref=msg_ref, gocq_loop=gocq_loop, qqchannel_bot=qqchannel_bot, gocq_bot=gocq_bot)
return
diff --git a/main.py b/main.py
index 245a2ce1d..bd12b993a 100644
--- a/main.py
+++ b/main.py
@@ -5,10 +5,15 @@ import os, sys
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)
+ try:
+ import cores.qqbot.core as qqBot
+ import yaml
+ ymlfile = open(abs_path+"configs/config.yaml", 'r', encoding='utf-8')
+ cfg = yaml.safe_load(ymlfile)
+ except BaseException as e:
+ print(e)
+ input("yaml库未导入或者配置文件格式错误,请退出程序重试。")
+ exit()
if 'http_proxy' in cfg:
os.environ['HTTP_PROXY'] = cfg['http_proxy']
@@ -39,28 +44,39 @@ def check_env():
print("请使用Python3.8运行本项目")
input("按任意键退出...")
exit()
- # try:
- # print("检查依赖库中...")
- # if os.path.exists('requirements.txt'):
- # os.system("pip3 install -r requirements.txt")
- # elif os.path.exists('QQChannelChatGPT'+ os.sep +'requirements.txt'):
- # os.system('pip3 install -r QQChannelChatGPT'+ os.sep +'requirements.txt')
- # os.system("clear")
- # print("安装依赖库完毕...")
- # except BaseException as e:
- # print("安装依赖库失败,请手动安装依赖库。")
- # print(e)
- # input("按任意键退出...")
- # exit()
+
+ if os.path.exists('requirements.txt'):
+ pth = 'requirements.txt'
+ else:
+ pth = 'QQChannelChatGPT'+ os.sep +'requirements.txt'
+ print("正在更新三方依赖库...")
+ mm = os.system('pip install -r '+pth)
+ if mm == 0:
+ print("依赖库安装完毕。")
+ else:
+ while True:
+ res = input("依赖库可能安装失败了。\n如果是报错ValueError: check_hostname requires server_hostname,请尝试先关闭代理后重试。\n输入y回车重试\n输入c回车使用国内镜像源下载\n输入其他按键回车继续往下执行。")
+ if res == "y":
+ mm = os.system('pip install -r '+pth)
+ if mm == 0:
+ print("依赖库安装完毕。")
+ break
+ elif res == "c":
+ mm = os.system(f'pip install -r {pth} -i https://mirrors.aliyun.com/pypi/simple/')
+ if mm == 0:
+ print("依赖库安装完毕。")
+ break
+ else:
+ break
# 检查key
- with open(abs_path+"configs/config.yaml", 'r', encoding='utf-8') as ymlfile:
- import yaml
- cfg = yaml.safe_load(ymlfile)
- if cfg['openai']['key'] == '' or cfg['openai']['key'] == None:
- print("请先在configs/config.yaml下添加一个可用的OpenAI Key。详情请前往https://beta.openai.com/account/api-keys")
- if cfg['qqbot']['appid'] == '' or cfg['qqbot']['token'] == '' or cfg['qqbot']['appid'] == None or cfg['qqbot']['token'] == None:
- print("请先在configs/config.yaml下完善appid和token令牌(在https://q.qq.com/上注册一个QQ机器人即可获得)")
+ # with open(abs_path+"configs/config.yaml", 'r', encoding='utf-8') as ymlfile:
+ # import yaml
+ # cfg = yaml.safe_load(ymlfile)
+ # if cfg['openai']['key'] == '' or cfg['openai']['key'] == None:
+ # print("请先在configs/config.yaml下添加一个可用的OpenAI Key。详情请前往https://beta.openai.com/account/api-keys")
+ # if cfg['qqbot']['appid'] == '' or cfg['qqbot']['token'] == '' or cfg['qqbot']['appid'] == None or cfg['qqbot']['token'] == None:
+ # print("请先在configs/config.yaml下完善appid和token令牌(在https://q.qq.com/上注册一个QQ机器人即可获得)")
def get_platform():
import platform
diff --git a/model/provider/provider_rev_edgegpt.py b/model/provider/provider_rev_edgegpt.py
index 34a0d74b8..319f83da8 100644
--- a/model/provider/provider_rev_edgegpt.py
+++ b/model/provider/provider_rev_edgegpt.py
@@ -1,6 +1,7 @@
from model.provider.provider import Provider
from EdgeGPT import Chatbot, ConversationStyle
import json
+import os
class ProviderRevEdgeGPT(Provider):
def __init__(self):
diff --git a/requirements.txt b/requirements.txt
index 8730ccb84..3804be2d4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,10 @@
requests~=2.28.1
openai~=0.27.4
qq-botpy~=1.1.2
-revChatGPT~=4.0.8
+revChatGPT~=5.0.0
baidu-aip~=4.16.9
EdgeGPT~=0.1.22.1
chardet~=5.1.0
Pillow~=9.4.0
GitPython~=3.1.31
-git+https://github.com/Lxns-Network/nakuru-project.git
\ No newline at end of file
+nakuru-project-test~=0.0.1