feat: 添加系统代理

This commit is contained in:
Soulter
2023-03-05 13:55:21 +08:00
parent d403323a36
commit c0e4d0595b
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -47,6 +47,10 @@ notice: "此机器人由Github项目QQChannelChatGPT驱动。"
# 设置为false则频道成员不能私聊机器人。
direct_message_mode: true
# 系统代理
# http_proxy: mask
# https_proxy: mask
################外带程序(插件)################
# 逆向ChatGPT库
+7
View File
@@ -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