From b71000e2f315a2bdfe1265c3ded4dcb9535147cf Mon Sep 17 00:00:00 2001 From: Junhua Don <1724728802@qq.com> Date: Sun, 17 Aug 2025 10:49:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=20http=5Fproxy=20=E4=BB=A3=E7=90=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#2434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复无法清空http_proxy代理的问题 * perf: 将“127.0.0.1”和“::1”添加到“no_proxy”以确保所有本地流量绕过代理。 Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- astrbot/core/core_lifecycle.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/astrbot/core/core_lifecycle.py b/astrbot/core/core_lifecycle.py index eccffbd64..069e92000 100644 --- a/astrbot/core/core_lifecycle.py +++ b/astrbot/core/core_lifecycle.py @@ -47,12 +47,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): """ From 90cb5a19510a101598d23a82d682e18d078db531 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Tue, 19 Aug 2025 00:52:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=BD=93=E8=BF=94=E5=9B=9E=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E4=B8=BA=E7=A9=BA=E5=B9=B6=E4=B8=94=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E6=97=B6=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=9C=B0=E8=A2=AB=E7=BB=88=E6=AD=A2=E4=BA=8B=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=9C=AA=E8=A2=AB=E8=BF=94=E5=9B=9E=20(#2491)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #2448 #2379 --- astrbot/core/pipeline/process_stage/method/llm_request.py | 4 ++++ astrbot/core/pipeline/respond/stage.py | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index 6820da33e..c81a5df51 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -335,6 +335,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 54ad1e63b..77e62ec7c 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}")