From 0481167dc641428a7a461af2468c46d7685a1eda Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Sat, 29 Jul 2023 16:36:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E4=B8=BA=E5=9C=A8start?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=AE=BE=E7=BD=AEopenai.proxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 2f18421..15d5701 100644 --- a/main.py +++ b/main.py @@ -178,9 +178,14 @@ def start(first_time_init=False): logging.error(e) traceback.print_exc() + # 配置OpenAI proxy + import openai + openai.proxy = None # 先重置,因为重载后可能需要清除proxy + if "http_proxy" in config.openai_config and config.openai_config["http_proxy"] is not None: + openai.proxy = config.openai_config["http_proxy"] + # 配置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"] # 主启动流程