index.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {
  2. AppListResponse,
  3. CreateAppParams,
  4. IAgent,
  5. IApp,
  6. NativeAppScenesResponse,
  7. StrategyResponse,
  8. TeamMode,
  9. } from '@/types/app';
  10. import { GET, POST } from '../index';
  11. /**
  12. * 查询team_mode模式
  13. */
  14. export const getTeamMode = () => {
  15. return GET<null, TeamMode[]>('/api/v1/team-mode/list');
  16. };
  17. /**
  18. * 创建应用
  19. */
  20. export const addApp = (data: CreateAppParams) => {
  21. return POST<CreateAppParams, IApp>('/api/v1/app/create', data);
  22. };
  23. /**
  24. * 更新应用
  25. */
  26. export const updateApp = (data: CreateAppParams) => {
  27. return POST<CreateAppParams, IApp>('/api/v1/app/edit', data);
  28. };
  29. /**
  30. * 应用列表
  31. */
  32. export const getAppList = (data: Record<string, any>) => {
  33. return POST<Record<string, any>, AppListResponse>(
  34. `/api/v1/app/list?page=${data.page || 1}&page_size=${data.page_size || 12}`,
  35. data,
  36. );
  37. };
  38. /**
  39. * 获取创建应用agents
  40. */
  41. export const getAgents = () => {
  42. return GET<object, IAgent[]>('/api/v1/agents/list', {});
  43. };
  44. /**
  45. * 创建auto_plan应用
  46. * 获取模型策略
  47. */
  48. export const getAppStrategy = () => {
  49. return GET<null, StrategyResponse[]>(`/api/v1/llm-strategy/list`);
  50. };
  51. /**
  52. * 创建native_app应用
  53. * 获取资源参数
  54. */
  55. export const getResource = (data: Record<string, string>) => {
  56. return GET<Record<string, string>, Record<string, any>[]>(`/api/v1/app/resources/list?type=${data.type}`);
  57. };
  58. /**
  59. * 创建native_app应用
  60. * 获取应用类型
  61. */
  62. export const getNativeAppScenes = () => {
  63. return GET<null, NativeAppScenesResponse[]>('/api/v1/native_scenes');
  64. };
  65. /**
  66. * 创建native_app应用
  67. * 获取模型列表
  68. */
  69. export const getAppStrategyValues = (type: string) => {
  70. return GET<string, string[]>(`/api/v1/llm-strategy/value/list?type=${type}`);
  71. };
  72. /**
  73. * 查询应用权限
  74. */
  75. export const getAppAdmins = (appCode: string) => {
  76. return GET<null, string[]>(`/api/v1/app/${appCode}/admins`);
  77. };
  78. /**
  79. * 更新应用权限
  80. */
  81. export const updateAppAdmins = (data: { app_code: string; admins: string[] }) => {
  82. return POST<{ app_code: string; admins: string[] }, null>(`/api/v1/app/admins/update`, data);
  83. };