fix: AGNES 三个模型改走香港代理(实测延迟更低、更稳定)

This commit is contained in:
QihuAI Design committed 2026-07-15 20:17:44 +08:00
1 parent ccc5f799e1
commit fd2011b93e
2 files changed
+20 -9

No files matched your search

+6 -2
View File
@@ -25,15 +25,19 @@ from ..capability_registry import resolve_auto_model
from ..models import AIModel, ModelProvider
# 香港出网代理(实测对 AGNES 延迟更低,2026-07-15 用户实测),与 chat.py 同值。
_HK_PROXY = "http://qyyfw:XHR521yhf@103.242.14.208:11495"
def _proxy_for_url(url: str) -> str | None:
"""按目标域名选择是否走代理(与 chat.py 同逻辑)。
对 AGNES 等国内域名返回 None(直连),平台自有域名直连,其余走智能路由代理。
2026-07-15 调整:AGNES 改走香港代理(实测延迟更低),不再直连。
"""
import os
host = (_urlparse(url).hostname or "").lower()
if "agnes-ai.com" in host or "agnes-ai.space" in host:
return None
return _HK_PROXY
if "qihuyun.com" in host:
return None
return os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY") or "http://172.18.0.1:7890"