在proxies返回空时会首先尝试直接连接

This commit is contained in:
Menghuan1918 2023-10-13 15:23:06 +08:00
parent 9ea0fe4de2
commit c3abc46d4d

View File

@ -26,7 +26,13 @@ def get_meta_information(url, chatbot, history):
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Connection': 'keep-alive'
}
try:
session.proxies.update(proxies)
except:
report_execption(chatbot, history,
a=f"获取代理失败 无代理状态下很可能无法访问OpenAI家族的模型及谷歌学术 建议检查USE_PROXY选项是否修改。",
b=f"尝试直接连接")
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
session.headers.update(headers)
response = session.get(url)