From 75f53a7e8a2ecd4fd9065ecb93f9e0713ced33e0 Mon Sep 17 00:00:00 2001 From: QihuAI Design Date: Mon, 20 Jul 2026 22:26:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E7=94=9F=E5=9B=BE/=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5=E8=B5=B0=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E7=AB=AF=E7=82=B9=E7=9B=B4=E8=BF=9E(=5Fproxy=5Ffor=5F?= =?UTF-8?q?url=20=E5=A2=9E=E5=8A=A0=20images/videos=20=E7=9B=B4=E8=BF=9E?= =?UTF-8?q?=E8=A7=84=E5=88=99)=EF=BC=8C=E7=BB=95=E8=BF=87=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E8=B7=AF=E7=94=B1=E4=BB=A3=E7=90=86=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E9=95=BF=E8=BF=9E=E6=8E=A5=E5=AF=BC=E8=87=B4=E7=9A=84=20Server?= =?UTF-8?q?=20disconnected=EF=BC=9Bgpt-image-2/agnes=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=81=A2=E5=A4=8D=E3=80=82=E9=85=8D=E5=90=88?= =?UTF-8?q?=20models.py=20=E7=9A=84=201024x1024=20size=20=E4=B8=8E=20chat?= =?UTF-8?q?=5Fmedia.py=20=E7=9A=84=20failover=20=E8=B7=AF=E7=94=B1(?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=A8=A1=E5=9E=8B=E7=AC=AC=E4=B8=80=E9=A1=BA?= =?UTF-8?q?=E4=BD=8D)=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/python/app/api/chat_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/python/app/api/chat_utils.py b/backend/python/app/api/chat_utils.py index 8bf464e..93dea39 100644 --- a/backend/python/app/api/chat_utils.py +++ b/backend/python/app/api/chat_utils.py @@ -147,6 +147,15 @@ def _proxy_for_url(url: str) -> str | None: + # 文生图 / 视频生成走直连:智能路由代理(172.18.0.1:7890)与 HK 代理对这类长耗时、 + # 大响应体的生成连接会偶发重置(Server disconnected),而各图像/视频供应商均为公网 + # API,直连更稳定(已实测 gpt-image-2 / agnes 直连均返回 200)。故媒体端点统一直连。 + _lower = (url or "").lower() + if "/images/" in _lower or "/videos/" in _lower or "/v1/images" in _lower or "/v1/videos" in _lower: + return None + + + if "agnes-ai.com" in host or "agnes-ai.space" in host: