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

@@ -63,20 +63,23 @@ class ArchitectureRegistry:
]
for arch_cls in builtin:
self.register(arch_cls())
self.register(arch_cls(), _quiet=True)
logger.debug(f"内置架构注册完成: {', '.join(self._architectures.keys())}")
def register(self, architecture: ProviderArchitecture) -> None:
def register(self, architecture: ProviderArchitecture, *, _quiet: bool = False) -> None:
"""
注册架构
Args:
architecture: 架构实例
_quiet: 内部参数,批量注册时抑制逐条日志
"""
if architecture.architecture_id in self._architectures:
logger.warning(f"架构 {architecture.architecture_id} 已存在,将被覆盖")
self._architectures[architecture.architecture_id] = architecture
logger.debug(f"注册架构: {architecture.architecture_id}")
if not _quiet:
logger.debug(f"注册架构: {architecture.architecture_id}")
def unregister(self, architecture_id: str) -> bool:
"""

View File

@@ -292,12 +292,6 @@ class ProviderOpsService:
actual_credentials = credentials
else:
actual_credentials = self._decrypt_credentials(config.connector_credentials)
logger.debug(
f"解密凭据: provider_id={provider_id}, "
f"encrypted_keys={list(config.connector_credentials.keys())}, "
f"decrypted_keys={list(actual_credentials.keys())}, "
f"has_api_key={bool(actual_credentials.get('api_key'))}"
)
if not actual_credentials:
return False, "未提供凭据"
@@ -590,9 +584,6 @@ class ProviderOpsService:
}
await CacheService.set(cache_key, cache_data, BALANCE_CACHE_TTL)
logger.debug(
f"余额缓存已写入: provider_id={provider_id}, extra={data.get('extra') if data else None}"
)
async def _cache_balance_from_verify(
self,
@@ -845,7 +836,6 @@ class ProviderOpsService:
# 使用信号量限制并发数,避免同时发起过多请求耗尽连接池
concurrency = _get_batch_balance_concurrency()
semaphore = asyncio.Semaphore(concurrency)
logger.debug(f"批量余额查询: providers={len(provider_ids)}, concurrency={concurrency}")
async def _query_with_limit(provider_id: str) -> tuple[str, ActionResult]:
async with semaphore: