gaoluyang
9 天以前 86966ec9a83b93decbd93fc8ce2be1882d4c9775
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import type { PageParam, PageResult } from '@vben/request';
 
import { requestClient } from '#/api/request';
 
export namespace AiModelApiKeyApi {
  export interface ApiKey {
    id: number; // 编号
    name: string; // 名称
    apiKey: string; // 密钥
    platform: string; // 平台
    url: string; // 自定义 API 地址
    status: number; // 状态
  }
}
 
/** 查询 API 密钥分页 */
export function getApiKeyPage(params: PageParam) {
  return requestClient.get<PageResult<AiModelApiKeyApi.ApiKey>>(
    '/ai/api-key/page',
    { params },
  );
}
 
/** 获得 API 密钥列表 */
export function getApiKeySimpleList() {
  return requestClient.get<AiModelApiKeyApi.ApiKey[]>(
    '/ai/api-key/simple-list',
  );
}
 
/** 查询 API 密钥详情 */
export function getApiKey(id: number) {
  return requestClient.get<AiModelApiKeyApi.ApiKey>(`/ai/api-key/get?id=${id}`);
}
 
/** 新增 API 密钥 */
export function createApiKey(data: AiModelApiKeyApi.ApiKey) {
  return requestClient.post('/ai/api-key/create', data);
}
 
/** 修改 API 密钥 */
export function updateApiKey(data: AiModelApiKeyApi.ApiKey) {
  return requestClient.put('/ai/api-key/update', data);
}
 
/** 删除 API 密钥 */
export function deleteApiKey(id: number) {
  return requestClient.delete(`/ai/api-key/delete?id=${id}`);
}