diff --git a/frontend/src/api/system.ts b/frontend/src/api/system.ts new file mode 100644 index 0000000..aa7db56 --- /dev/null +++ b/frontend/src/api/system.ts @@ -0,0 +1,30 @@ +import { request } from '@/utils/request' + +export const modelApi = { + queryAll: (keyword?: string) => + request.get('/system/aimodel', { params: keyword ? { keyword } : {} }), + add: (data: any) => { + const param = data + if (param.api_key) { + param.api_key = LicenseGenerator.sqlbotEncrypt(data.api_key) + } + if (param.api_domain) { + param.api_domain = LicenseGenerator.sqlbotEncrypt(data.api_domain) + } + return request.post('/system/aimodel', param) + }, + edit: (data: any) => { + const param = data + if (param.api_key) { + param.api_key = LicenseGenerator.sqlbotEncrypt(data.api_key) + } + if (param.api_domain) { + param.api_domain = LicenseGenerator.sqlbotEncrypt(data.api_domain) + } + return request.put('/system/aimodel', param) + }, + delete: (id: number) => request.delete(`/system/aimodel/${id}`), + query: (id: number) => request.get(`/system/aimodel/${id}`), + setDefault: (id: number) => request.put(`/system/aimodel/default/${id}`), + check: (data: any) => request.fetchStream('/system/aimodel/status', data), +}