mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: 补充合并后遗漏的 from __future__ import annotations
合并 fix/python314-upgrade 后,部分文件仍使用 Optional/Dict 等旧式类型 但未添加 future annotations 导入,导致运行时 NameError。
This commit is contained in:
@@ -16,6 +16,8 @@ Chat Adapter 通用基类
|
||||
- compute_total_input_context(): 可选覆盖总输入上下文计算(用于阶梯计费判定)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import traceback
|
||||
from abc import abstractmethod
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
payload, headers = builder.build(original_body, original_headers, endpoint, key)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from abc import ABC, abstractmethod
|
||||
@@ -316,7 +317,7 @@ def build_passthrough_request(
|
||||
async def get_provider_auth(
|
||||
endpoint: "ProviderEndpoint",
|
||||
key: "ProviderAPIKey",
|
||||
) -> Optional[ProviderAuthInfo]:
|
||||
) -> ProviderAuthInfo | None:
|
||||
"""
|
||||
获取 Provider 的认证信息
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ Gemini Chat Adapter
|
||||
处理 Gemini API 格式的请求适配
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
@@ -4,6 +4,8 @@ Gemini Chat Handler
|
||||
处理 Gemini API 格式的请求
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from src.api.handlers.base.chat_handler_base import ChatHandlerBase
|
||||
|
||||
@@ -17,6 +17,8 @@ Gemini Files API 代理端点
|
||||
https://ai.google.dev/api/files
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ Vertex AI Service Account 认证服务
|
||||
Access Token 会被缓存,直到过期前 60 秒才刷新。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import time
|
||||
from collections import OrderedDict
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
ProviderEndpoint 相关的 API 模型定义
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
@@ -171,7 +173,7 @@ class EndpointAPIKeyCreate(BaseModel):
|
||||
default="api_key",
|
||||
description="认证类型:api_key(标准 API Key)或 vertex_ai(Vertex AI Service Account)"
|
||||
)
|
||||
auth_config: Optional[Dict[str, Any]] = Field(
|
||||
auth_config: dict[str, Any] | None = Field(
|
||||
default=None,
|
||||
description="认证配置(JSON):vertex_ai 时存储完整 Service Account JSON"
|
||||
)
|
||||
|
||||
@@ -5,6 +5,8 @@ Google Gemini API 请求/响应模型
|
||||
作为 API 网关,采用宽松类型定义以支持 API 新特性透传
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
@@ -5,6 +5,8 @@ Gemini Files API - 文件与 Key 绑定缓存
|
||||
并在后续 generateContent 请求中优先使用同一 Key。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, Optional, Set
|
||||
|
||||
from src.core.cache_service import CacheService
|
||||
|
||||
Reference in New Issue
Block a user