mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
feat: 改为在start流程设置openai.proxy
This commit is contained in:
parent
a002f93f7b
commit
0481167dc6
7
main.py
7
main.py
|
@ -178,9 +178,14 @@ def start(first_time_init=False):
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
traceback.print_exc()
|
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
|
# 配置openai api_base
|
||||||
if "reverse_proxy" in config.openai_config and config.openai_config["reverse_proxy"] is not None:
|
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"]
|
openai.api_base = config.openai_config["reverse_proxy"]
|
||||||
|
|
||||||
# 主启动流程
|
# 主启动流程
|
||||||
|
|
Loading…
Reference in New Issue
Block a user