diff --git a/astrbot/core/core_lifecycle.py b/astrbot/core/core_lifecycle.py index d50955cd1..d126ff26c 100644 --- a/astrbot/core/core_lifecycle.py +++ b/astrbot/core/core_lifecycle.py @@ -50,12 +50,19 @@ class AstrBotCoreLifecycle: self.db = db # 初始化数据库 # 设置代理 - 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" + proxy_config = self.astrbot_config.get("http_proxy", "") + if proxy_config != "": + os.environ["https_proxy"] = proxy_config + os.environ["http_proxy"] = proxy_config + logger.debug(f"Using proxy: {proxy_config}") + else: + # 清空代理环境变量 + if "https_proxy" in os.environ: + del os.environ["https_proxy"] + if "http_proxy" in os.environ: + del os.environ["http_proxy"] + logger.debug("HTTP proxy cleared") + os.environ["no_proxy"] = "localhost,127.0.0.1,::1" async def initialize(self): """ diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index 5d38a90cc..8ae02dc63 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -531,6 +531,10 @@ class LLMRequestSubStage(Stage): ): return + if not llm_response.completion_text and not req.tool_calls_result: + logger.debug("LLM 响应为空,不保存记录。") + return + # 历史上下文 messages = copy.deepcopy(req.contexts) # 这一轮对话请求的用户输入 diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index ffdebf276..14ec16076 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -144,8 +144,6 @@ class RespondStage(Stage): try: if await self._is_empty_message_chain(result.chain): logger.info("消息为空,跳过发送阶段") - event.clear_result() - event.stop_event() return except Exception as e: logger.warning(f"空内容检查异常: {e}")