mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat(vertex-ai): 重构 Vertex AI 为插件化 adapter,支持 service_account 认证与动态路由
将 Vertex AI 从 transport.py 的硬编码逻辑重构为独立的 plugin adapter, 支持 service_account/oauth 认证类型、模型格式自动识别、区域路由和 URL 构建。 前端新增 Key 认证类型选择和 Service Account 配置表单。 Co-authored-by: NyaDoo <65238336+NyaDoo@users.noreply.github.com> Closes #194
This commit is contained in:
@@ -72,7 +72,7 @@ FIXED_PROVIDERS: dict[ProviderType, FixedProviderTemplate] = {
|
||||
provider_type=ProviderType.CODEX,
|
||||
display_name="Codex",
|
||||
api_base_url="https://chatgpt.com/backend-api/codex",
|
||||
endpoint_signatures=["openai:cli"],
|
||||
endpoint_signatures=["openai:cli", "openai:compact"],
|
||||
oauth=FixedProviderOAuth(
|
||||
authorize_url="https://auth.openai.com/oauth/authorize",
|
||||
token_url="https://auth.openai.com/oauth/token",
|
||||
@@ -121,6 +121,23 @@ FIXED_PROVIDERS: dict[ProviderType, FixedProviderTemplate] = {
|
||||
use_pkce=False,
|
||||
),
|
||||
),
|
||||
ProviderType.VERTEX_AI: FixedProviderTemplate(
|
||||
provider_type=ProviderType.VERTEX_AI,
|
||||
display_name="Vertex AI",
|
||||
# Vertex uses fixed global base URL; concrete upstream path is selected by transport hook.
|
||||
api_base_url="https://aiplatform.googleapis.com",
|
||||
endpoint_signatures=["gemini:chat", "claude:chat"],
|
||||
# Vertex does not use this OAuth flow (it uses API Key / Service Account).
|
||||
oauth=FixedProviderOAuth(
|
||||
authorize_url="",
|
||||
token_url="",
|
||||
client_id="",
|
||||
client_secret="",
|
||||
scopes=[],
|
||||
redirect_uri="",
|
||||
use_pkce=False,
|
||||
),
|
||||
),
|
||||
ProviderType.ANTIGRAVITY: FixedProviderTemplate(
|
||||
provider_type=ProviderType.ANTIGRAVITY,
|
||||
display_name="Antigravity",
|
||||
|
||||
@@ -21,6 +21,7 @@ class ProviderType(str, Enum):
|
||||
CODEX = "codex"
|
||||
GEMINI_CLI = "gemini_cli"
|
||||
ANTIGRAVITY = "antigravity"
|
||||
VERTEX_AI = "vertex_ai"
|
||||
|
||||
|
||||
# 所有有效 provider_type 值的集合(用于校验)
|
||||
|
||||
Reference in New Issue
Block a user