mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
refactor: 统一代理配置优先级链(key>provider>系统默认)并复用 HTTP 连接池
- 引入 resolve_proxy_param / build_proxy_client_kwargs 工具函数,统一 httpx 客户端的代理+SSL+超时配置,替换各模块中零散的 get_ssl_context() 调用 - 所有涉及上游请求的模块(provider_query, usage replay, endpoint check, model fetch, OAuth, Vertex Auth, Gemini Files/Video 等)改用 resolve_effective_proxy 按 key > provider > 系统默认优先级解析代理 - 流式请求改用 HTTPClientPool.get_upstream_client 复用连接池,移除各处 http_client.aclose() 避免关闭共享客户端 - StreamProcessor._cleanup 不再关闭池中客户端,仅清理响应上下文 - 前端 EndpointFormDialog 增加 body_rules 帮助说明 Popover - Mock handler 补充 OAuth 字段、endpoint extras 及新增 mock 路由
This commit is contained in:
@@ -10,7 +10,6 @@ from __future__ import annotations
|
||||
import json
|
||||
import time
|
||||
from collections import OrderedDict
|
||||
from typing import Optional, Tuple
|
||||
|
||||
import httpx
|
||||
import jwt
|
||||
@@ -129,7 +128,11 @@ class VertexAuthService:
|
||||
# 获取新 Token
|
||||
try:
|
||||
signed_jwt = self._create_jwt()
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
|
||||
# 使用系统默认代理(Vertex AI token endpoint 是外部服务)
|
||||
from src.services.proxy_node.resolver import build_proxy_client_kwargs
|
||||
|
||||
async with httpx.AsyncClient(**build_proxy_client_kwargs(timeout=30)) as client:
|
||||
resp = await client.post(
|
||||
self.TOKEN_URL,
|
||||
data={
|
||||
|
||||
Reference in New Issue
Block a user