mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
commit
44f4820cee
|
@ -33,11 +33,26 @@ mirai_http_api_config = {
|
||||||
# },
|
# },
|
||||||
# "http_proxy": "http://127.0.0.1:12345"
|
# "http_proxy": "http://127.0.0.1:12345"
|
||||||
# }
|
# }
|
||||||
|
#
|
||||||
|
# 现已支持反向代理,可以添加reverse_proxy字段以使用反向代理
|
||||||
|
# 使用反向代理可以在国内使用OpenAI的API,反向代理的配置请参考
|
||||||
|
# https://github.com/Ice-Hazymoon/openai-scf-proxy
|
||||||
|
#
|
||||||
|
# 反向代理填写示例:
|
||||||
|
# openai_config = {
|
||||||
|
# "api_key": {
|
||||||
|
# "default": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
# "key1": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
# "key2": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
# },
|
||||||
|
# "reverse_proxy": "http://example.com:12345/v1"
|
||||||
|
# }
|
||||||
openai_config = {
|
openai_config = {
|
||||||
"api_key": {
|
"api_key": {
|
||||||
"default": "openai_api_key"
|
"default": "openai_api_key"
|
||||||
},
|
},
|
||||||
"http_proxy": None
|
"http_proxy": None,
|
||||||
|
"reverse_proxy": None
|
||||||
}
|
}
|
||||||
|
|
||||||
# [必需] 管理员QQ号,用于接收报错等通知及执行管理员级别指令
|
# [必需] 管理员QQ号,用于接收报错等通知及执行管理员级别指令
|
||||||
|
|
5
main.py
5
main.py
|
@ -194,6 +194,11 @@ def start(first_time_init=False):
|
||||||
|
|
||||||
pkg.openai.dprompt.register_all()
|
pkg.openai.dprompt.register_all()
|
||||||
|
|
||||||
|
# 配置openai api_base
|
||||||
|
if "reverse_proxy" in config.openai_config and config.openai_config["reverse_proxy"] is not None:
|
||||||
|
import openai
|
||||||
|
openai.api_base = config.openai_config["reverse_proxy"]
|
||||||
|
|
||||||
# 主启动流程
|
# 主启动流程
|
||||||
database = pkg.database.manager.DatabaseManager()
|
database = pkg.database.manager.DatabaseManager()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user