feat: 新增openai自定api_base

This commit is contained in:
Soulter
2023-03-25 10:32:15 +08:00
parent 502703b749
commit 43df7003d6
2 changed files with 23 additions and 18 deletions
+20 -17
View File
@@ -5,10 +5,16 @@
# - 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
@@ -29,7 +35,7 @@ qqbot:
# 设置是否一个人一个会话
uniqueSessionMode: false
# QChannelBot 的版本,请勿修改此字段,否则可能产生一些bug
version: 2.7 ChineseVeryGood Ver.
version: 2.8
# [Beta] 转储历史记录时间间隔(分钟)
dump_history_interval: 10
# 一个用户只能在time秒内发送count条消息
@@ -47,6 +53,7 @@ direct_message_mode: true
# http_proxy: http://localhost:7890
# https_proxy: http://localhost:7890
################外带程序(插件)################
# 百度内容审核服务
@@ -57,6 +64,10 @@ baidu_aip:
api_key:
secret_key:
# 逆向文心一言【暂时不可用,请勿使用】
rev_ernie:
enable: false
# 逆向ChatGPT库
# https://github.com/acheong08/ChatGPT
# 优点:免费(无免费额度限制);
@@ -64,29 +75,21 @@ baidu_aip:
# enable设置为true后,将会停止使用上面正常的官方API调用而使用本逆向项目
#
# 多账户可以保证每个请求都能得到及时的回复。
# 关于account的格式,请你务必认真阅读以下格式。
# account支持email+password、session_token、access_token多种方式登录。
# 如果要使用session_token、access_token登录,直接添加新的一行(注意缩进!) - access_token: xxxxxxx即可
# 关于account的格式
# account:
# - session_token: xxxxxxxx
# - access_token: xxxxxxxx
# - email: 第1个账户
# password: 第1个账户密码
# - 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:
+3 -1
View File
@@ -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']