refactor: Antigravity/Codex 服务重构为插件化适配器架构

- 将 Antigravity 和 Codex 从独立模块迁移至 src/services/provider/adapters/ 插件体系
- 新增 provider_types 和 oauth_token 模块,移除 maintenance_scheduler 中的 OAuth 定时刷新
- 增强 admin API:扩展 keys 和 provider_query 端点,新增 dashboard 路由
- 大幅增强 ProviderDetailDrawer 组件,新增 AntigravityQuotaDialog
- 改进 handler 基类(chat/cli)和错误分类器
- 优化 fetch_scheduler 和 upstream_fetcher
- 前端 UI 组件清理和优化
- 更新测试以匹配新模块结构
This commit is contained in:
fawney19
2026-02-06 16:37:06 +08:00
parent e01dfee41d
commit b88fb6273b
112 changed files with 5193 additions and 1992 deletions

View File

@@ -585,6 +585,7 @@ class VideoTaskPollerAdapter:
endpoint_sig,
upstream_key,
endpoint_headers=extra_headers,
header_rules=getattr(endpoint, "header_rules", None),
)
if auth_info:
headers.pop("x-goog-api-key", None)

View File

@@ -8,6 +8,7 @@ from sqlalchemy.orm import Session
from src.config.settings import config
from src.core.logger import logger
from src.core.provider_types import ProviderType
from src.models.database import ApiKey
from src.services.candidate.failover import FailoverEngine
from src.services.candidate.policy import RetryPolicy, SkipPolicy
@@ -598,7 +599,7 @@ class TaskService:
if stage <= 0 and request_body_ref.get("_rectified", False):
stage = 1
if stage >= 2 or (stage >= 1 and provider_type_norm != "antigravity"):
if stage >= 2 or (stage >= 1 and provider_type_norm != ProviderType.ANTIGRAVITY):
logger.warning(" [{}] Thinking 错误:已整流仍失败,终止重试", request_id)
self._mark_thinking_error_failed(
candidate_record_id,
@@ -631,7 +632,7 @@ class TaskService:
request_body_ref["_rectified_this_turn"] = True
request_body_ref["_rectify_stage"] = next_stage
if provider_type_norm == "antigravity":
if provider_type_norm == ProviderType.ANTIGRAVITY:
try:
from src.core.metrics import antigravity_degradation_total
@@ -1501,6 +1502,7 @@ class TaskService:
provider_format,
upstream_key,
endpoint_headers=extra_headers,
header_rules=getattr(endpoint, "header_rules", None),
)
client = await HTTPClientPool.get_default_client_async()