From 3e715399a1ecaf37276159c567fc8f537128436e Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Thu, 26 Jun 2025 08:52:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E8=A2=AB=E5=BF=BD=E7=95=A5=20(#1895)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/core_lifecycle.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astrbot/core/core_lifecycle.py b/astrbot/core/core_lifecycle.py index 783b1fa9..eccffbd6 100644 --- a/astrbot/core/core_lifecycle.py +++ b/astrbot/core/core_lifecycle.py @@ -46,9 +46,12 @@ class AstrBotCoreLifecycle: self.astrbot_config = astrbot_config # 初始化配置 self.db = db # 初始化数据库 - # 根据环境变量设置代理 - os.environ["https_proxy"] = self.astrbot_config["http_proxy"] - os.environ["http_proxy"] = self.astrbot_config["http_proxy"] + # 设置代理 + if self.astrbot_config.get("http_proxy", ""): + os.environ["https_proxy"] = self.astrbot_config["http_proxy"] + os.environ["http_proxy"] = self.astrbot_config["http_proxy"] + if proxy := os.environ.get("https_proxy"): + logger.debug(f"Using proxy: {proxy}") os.environ["no_proxy"] = "localhost" async def initialize(self):