refactor(api): LLM 提供商管理端点收敛为通用 manage 接口,端点层零特色

- schemas 新增 LlmProviderAction 公共动作词汇表
- LLMProviderManager 新增 provider_manage 统一入口,默认值填充、
  API Key 豁免判断、密钥脱敏与错误归因改写全部下沉封闭,
  不再硬编码 chatgpt/github-copilot 等产品名
- endpoint 收敛为 POST /llm/manage(ManageRequest 透传);
  OAuth 回跳地址由端点按具名回调路由统一构造后注入动作参数,
  /provider-auth/callback/{provider_id} 因浏览器回跳协议约束保留具名路由
- 新增 14 项 provider_manage 契约守护测试,
  替换原针对端点函数的两个旧测试文件
This commit is contained in:
jxxghp
2026-08-16 07:50:16 +08:00
parent a6dbd799d5
commit 441ec9475e
7 changed files with 461 additions and 675 deletions
+23
View File
@@ -531,6 +531,29 @@ class StorageAction(str, Enum):
SUPPORT_TRANSTYPE = "support_transtype"
# LLM 提供商通用管理动作
class LlmProviderAction(str, Enum):
"""
LLM 提供商通用管理动作
作为提供商管理契约的公共词汇表,具体动作的支持范围与参数语义由提供商实现自行解释
"""
# 查询提供商目录
LIST_PROVIDERS = "list_providers"
# 查询模型目录
LIST_MODELS = "list_models"
# 启动授权会话
START_AUTH = "start_auth"
# 查询授权会话状态
AUTH_STATUS = "auth_status"
# 轮询授权会话
POLL_AUTH = "poll_auth"
# 断开授权
DISCONNECT = "disconnect"
# 测试调用
TEST = "test"
# 下载器类型
class DownloaderType(Enum):
# Qbittorrent