feat(admin): 渠道模型 - 拉取模型支持勾选导入并允许离线启停渠道

This commit is contained in:
Rou
2026-09-03 21:59:56 +08:00
parent 7a1f2db8c8
commit d7b808fae4
8 changed files with 410 additions and 14 deletions

View File

@@ -269,9 +269,13 @@ 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`));
return request<{ models: string[] }>(api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/fetch`));
}
export function importAdminChannelModels(channelId: string, models: string[]) {
return request<{ models: string[]; added: number }>(api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/import`, { models }));
}
export function testAdminChannelModel(channelId: string, input: Pick<ChannelModel, "modelKey" | "providerModelKey" | "capability" | "protocol"> & { capabilityConfig?: ChannelModel["capabilityConfig"] }) {