index.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import request from '@/config/axios'
  2. // AI API 密钥 VO
  3. export interface ApiKeyVO {
  4. id: number // 编号
  5. name: string // 名称
  6. apiKey: string // 密钥
  7. platform: string // 平台
  8. url: string // 自定义 API 地址
  9. status: number // 状态
  10. }
  11. // AI API 密钥 API
  12. export const ApiKeyApi = {
  13. // 查询 API 密钥分页
  14. getApiKeyPage: async (params: any) => {
  15. return await request.get({ url: `/ai/api-key/page`, params })
  16. },
  17. // 获得 API 密钥列表
  18. getApiKeySimpleList: async () => {
  19. return await request.get({ url: `/ai/api-key/simple-list` })
  20. },
  21. // 查询 API 密钥详情
  22. getApiKey: async (id: number) => {
  23. return await request.get({ url: `/ai/api-key/get?id=` + id })
  24. },
  25. // 新增 API 密钥
  26. createApiKey: async (data: ApiKeyVO) => {
  27. return await request.post({ url: `/ai/api-key/create`, data })
  28. },
  29. // 修改 API 密钥
  30. updateApiKey: async (data: ApiKeyVO) => {
  31. return await request.put({ url: `/ai/api-key/update`, data })
  32. },
  33. // 删除 API 密钥
  34. deleteApiKey: async (id: number) => {
  35. return await request.delete({ url: `/ai/api-key/delete?id=` + id })
  36. }
  37. }