fix: 文生图/视频测试连接走媒体端点直连(_proxy_for_url 增加 images/videos 直连规则),绕过智能路由代理重置长连接导致的 Server disconnected;gpt-image-2/agnes 测试连接恢复。配合 models.py 的 1024x1024 size 与 chat_media.py 的 failover 路由(默认模型第一顺位)。

This commit is contained in:
QihuAI Design committed 2026-07-20 22:26:30 +08:00
1 parent 0b00d6da45
commit 75f53a7e8a
1 file changed
+9
+9
View File
@@ -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: