feat(frontend): implement comprehensive API Settings Management Interface

Implement a complete API Management Interface for React frontend with split-
panel layout, migrating all features from legacy JS frontend.

New Features:
- API Settings page with 5 tabs: Providers, Endpoints, Cache, Model Pools, CLI Settings
- Provider Management: CRUD operations, multi-key rotation, health checks, test connection
- Endpoint Management: CRUD operations, cache strategy configuration, enable/disable toggle
- Cache Settings: Global configuration, statistics display, clear cache functionality
- Model Pool Management: CRUD operations, auto-discovery feature, provider exclusion
- CLI Settings Management: Provider-based and Direct modes, full CRUD support
- Multi-Key Settings Modal: Manage API keys with rotation strategies and weights
- Manage Models Modal: View and manage models per provider (LLM and Embedding)
- Sync to CodexLens: Integration handler for provider configuration sync

Technical Implementation:
- Created 12 new React components in components/api-settings/
- Extended lib/api.ts with 460+ lines of API client functions
- Created hooks/useApiSettings.ts with 772 lines of TanStack Query hooks
- Added RadioGroup UI component for form selections
- Implemented unified error handling with useNotifications across all operations
- Complete i18n support (500+ keys in English and Chinese)
- Route integration (/api-settings) and sidebar navigation

Code Quality:
- All acceptance criteria from plan.json verified
- Code review passed with Gemini (all 7 IMPL tasks complete)
- Follows existing patterns: Shadcn UI, TanStack Query, react-intl, Lucide icons
This commit is contained in:
catlog22
2026-02-01 23:58:04 +08:00
parent 690597bae8
commit abce912ee5
33 changed files with 5874 additions and 45 deletions

View File

@@ -128,7 +128,11 @@
"modelBaseUrlHint": "为此模型覆盖基础 URL",
"basicInfo": "基本信息",
"endpointSettings": "端点设置",
"apiBaseUpdated": "基础 URL 已更新"
"apiBaseUpdated": "基础 URL 已更新",
"saveError": "保存提供商失败",
"deleteError": "删除提供商失败",
"toggleError": "切换提供商状态失败",
"testError": "测试提供商失败"
},
"endpoints": {
"title": "端点",
@@ -168,7 +172,10 @@
"noEndpointsHint": "添加端点以创建带有缓存的自定义 API 映射。",
"providerBased": "基于提供商",
"direct": "直接",
"off": "关闭"
"off": "关闭",
"saveError": "保存端点失败",
"deleteError": "删除端点失败",
"toggleError": "切换端点状态失败"
},
"cache": {
"title": "缓存",
@@ -249,6 +256,7 @@
"cliSettings": {
"title": "CLI 设置",
"description": "配置 CLI 工具设置和模式",
"modalDescription": "为不同的端点配置 Claude CLI 包装器设置",
"stats": {
"total": "总设置数",
"enabled": "已启用"
@@ -263,12 +271,24 @@
"title": "未找到 CLI 设置",
"message": "添加 CLI 设置以配置工具特定选项。"
},
"searchPlaceholder": "按名称或描述搜索...",
"mode": "模式",
"providerBased": "基于提供商",
"direct": "直接",
"authToken": "认证令牌",
"baseUrl": "基础 URL",
"model": "模型"
"model": "模型",
"namePlaceholder": "例如production-claude",
"descriptionPlaceholder": "此配置的可选描述",
"selectProvider": "选择提供商",
"includeCoAuthoredBy": "在提交中包含 co-authored-by",
"validation": {
"providerRequired": "请选择提供商",
"authOrBaseUrlRequired": "请输入认证令牌或基础 URL"
},
"saveError": "保存 CLI 设置失败",
"deleteError": "删除 CLI 设置失败",
"toggleError": "切换 CLI 设置状态失败"
},
"ccwLitellm": {
"title": "CCW-LiteLLM 包",
@@ -299,6 +319,7 @@
"add": "添加",
"close": "关闭",
"loading": "加载中...",
"saving": "保存中...",
"error": "错误",
"success": "成功",
"warning": "警告",
@@ -311,7 +332,12 @@
"name": "名称",
"description": "描述",
"type": "类型",
"status": "状态"
"status": "状态",
"provider": "提供商",
"enableThis": "启用此",
"validation": {
"nameRequired": "名称为必填项"
}
},
"messages": {
"settingsSaved": "设置保存成功",

View File

@@ -47,6 +47,39 @@
"lastCheck": "最后检查时间"
}
},
"index": {
"operationComplete": "索引操作完成",
"operationFailed": "索引操作失败",
"noProject": "未选择项目",
"noProjectDesc": "请打开一个项目以执行索引操作。",
"starting": "正在启动索引操作...",
"cancelFailed": "取消操作失败",
"unknownError": "发生未知错误",
"complete": "完成",
"failed": "失败",
"cancelled": "已取消",
"inProgress": "进行中"
},
"semantic": {
"installTitle": "安装语义搜索",
"installDescription": "安装 FastEmbed 和语义搜索依赖,支持 GPU 加速。",
"installInfo": "GPU 加速需要兼容的硬件。CPU 模式在所有系统上都可用,但速度较慢。",
"gpu": {
"cpu": "CPU 模式",
"cpuDesc": "通用兼容,处理较慢。适用于所有系统。",
"directml": "DirectMLWindows GPU",
"directmlDesc": "最适合带 AMD/Intel GPU 的 Windows 系统。推荐大多数用户使用。",
"cuda": "CUDANVIDIA GPU",
"cudaDesc": "NVIDIA GPU 性能最佳。需要 CUDA 工具包。"
},
"recommended": "推荐",
"install": "安装",
"installing": "安装中...",
"installSuccess": "安装完成",
"installSuccessDesc": "语义搜索已成功安装,使用 {mode} 模式",
"installFailed": "安装失败",
"unknownError": "发生未知错误"
},
"settings": {
"currentCount": "当前索引数量",
"currentWorkers": "当前工作线程",

View File

@@ -17,6 +17,7 @@
"settings": "设置",
"mcp": "MCP 服务器",
"codexlens": "CodexLens",
"apiSettings": "API 设置",
"endpoints": "CLI 端点",
"installations": "安装",
"help": "帮助",