feat(admin): 模型管理 - 支持从上游渠道拉取模型目录 (#36)

以 main 为基线仅补齐拉取模型能力:管理员可一键导入缺失模型(默认停用待定价),并提供登录态后端代理目录接口避免 CORS。

Co-authored-by: ddcat666 <2695092045@qq.com>
This commit is contained in:
yep
2026-07-23 22:04:54 +08:00
committed by GitHub
parent 61d12ec3ff
commit 243c43f6c2
11 changed files with 293 additions and 7 deletions

View File

@@ -218,6 +218,11 @@ export function listAdminChannelModels(channelId: string) {
return request<{ models: ChannelModel[] }>(api.get(`/admin/channels/${encodeURIComponent(channelId)}/models`));
}
// 管理员从上游拉取模型目录;服务端只导入缺失项,价格和启用仍需人工确认。
export function fetchAdminChannelModels(channelId: string) {
return request<{ models: string[]; added: number }>(api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/fetch`));
}
export function createAdminChannelModel(channelId: string, input: Omit<ChannelModel, "id" | "channelId" | "priceVersion" | "createdAt" | "updatedAt">) {
return request<{ model: ChannelModel }>(api.post(`/admin/channels/${encodeURIComponent(channelId)}/models`, input));
}