模型黑名单与密钥模型白名单界面、分组填入、删除弹窗排版
This commit is contained in:
+28
-2
@@ -1,5 +1,13 @@
|
||||
import { request } from './request'
|
||||
import type { AiCallLog, AiChannel, AiContentLog, AiKey, AiModel, AiModelCacheItem } from '@/types/api'
|
||||
import type {
|
||||
AiCallLog,
|
||||
AiChannel,
|
||||
AiContentLog,
|
||||
AiKey,
|
||||
AiModel,
|
||||
AiModelBlacklistItem,
|
||||
AiModelCacheItem,
|
||||
} from '@/types/api'
|
||||
|
||||
// ---- 网关密钥 ----
|
||||
|
||||
@@ -11,6 +19,8 @@ export interface CreateAiKeyRequest {
|
||||
name: string
|
||||
value?: string
|
||||
group?: string
|
||||
/** 模型白名单;缺省/空 = 不限 */
|
||||
models?: string[]
|
||||
}
|
||||
|
||||
/** 创建密钥;key 为明文,仅本次响应返回 */
|
||||
@@ -20,7 +30,7 @@ export function createAiKey(body: CreateAiKeyRequest): Promise<{ key: string; it
|
||||
|
||||
export function updateAiKey(
|
||||
id: number,
|
||||
body: { name?: string; enabled?: boolean; group?: string },
|
||||
body: { name?: string; enabled?: boolean; group?: string; models?: string[] },
|
||||
): Promise<void> {
|
||||
return request(`/ai-keys/${id}`, { method: 'PUT', body })
|
||||
}
|
||||
@@ -78,6 +88,22 @@ export function listAiModels(): Promise<AiModel[]> {
|
||||
return request<{ items: AiModel[] }>('/ai-models').then((r) => r.items)
|
||||
}
|
||||
|
||||
// ---- 模型黑名单 ----
|
||||
|
||||
export function listAiBlacklist(): Promise<AiModelBlacklistItem[]> {
|
||||
return request<{ items: AiModelBlacklistItem[] }>('/ai-blacklist').then((r) => r.items)
|
||||
}
|
||||
|
||||
/** 拉黑模型:删除全部渠道缓存中的同名条目,后续同步 / 探测均过滤 */
|
||||
export function addAiBlacklist(name: string): Promise<void> {
|
||||
return request('/ai-blacklist', { method: 'POST', body: { name } })
|
||||
}
|
||||
|
||||
/** 移出黑名单:缓存不回填,重新同步 / 探测后恢复入池 */
|
||||
export function removeAiBlacklist(id: number): Promise<void> {
|
||||
return request(`/ai-blacklist/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
export function listAiCallLogs(params: {
|
||||
page: number
|
||||
size: number
|
||||
|
||||
Reference in New Issue
Block a user