index.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import request from '@/config/axios'
  2. // AI 聊天角色 VO
  3. export interface ChatRoleVO {
  4. id: number // 角色编号
  5. modelId: number // 模型编号
  6. name: string // 角色名称
  7. avatar: string // 角色头像
  8. category: string // 角色类别
  9. sort: number // 角色排序
  10. description: string // 角色描述
  11. model2dPath: string // 2D模型路径
  12. model3dPath: string // 3D模型路径
  13. systemMessage: string // 角色设定
  14. welcomeMessage: string // 角色设定
  15. publicStatus: boolean // 是否公开
  16. status: number // 状态
  17. knowledgeIds?: number[] // 引用的知识库 ID 列表
  18. toolIds?: number[] // 引用的工具 ID 列表
  19. }
  20. // AI 聊天角色 分页请求 vo
  21. export interface ChatRolePageReqVO {
  22. name?: string // 角色名称
  23. category?: string // 角色类别
  24. publicStatus: boolean // 是否公开
  25. pageNo: number // 是否公开
  26. pageSize: number // 是否公开
  27. }
  28. // AI 聊天角色 API
  29. export const ChatRoleApi = {
  30. // 查询聊天角色分页
  31. getChatRolePage: async (params: any) => {
  32. return await request.get({ url: `/ai/chat-role/page`, params })
  33. },
  34. // 查询聊天角色详情
  35. getChatRole: async (id: number) => {
  36. return await request.get({ url: `/ai/chat-role/get?id=` + id })
  37. },
  38. // 新增聊天角色
  39. createChatRole: async (data: ChatRoleVO) => {
  40. return await request.post({ url: `/ai/chat-role/create`, data })
  41. },
  42. // 修改聊天角色
  43. updateChatRole: async (data: ChatRoleVO) => {
  44. return await request.put({ url: `/ai/chat-role/update`, data })
  45. },
  46. // 删除聊天角色
  47. deleteChatRole: async (id: number) => {
  48. return await request.delete({ url: `/ai/chat-role/delete?id=` + id })
  49. },
  50. // ======= chat 聊天
  51. // 获取 my role
  52. getMyPage: async (params: ChatRolePageReqVO) => {
  53. return await request.get({ url: `/ai/chat-role/my-page`, params})
  54. },
  55. // 获取角色分类
  56. getCategoryList: async () => {
  57. return await request.get({ url: `/ai/chat-role/category-list`})
  58. },
  59. // 创建角色
  60. createMy: async (data: ChatRoleVO) => {
  61. return await request.post({ url: `/ai/chat-role/create-my`, data})
  62. },
  63. // 更新角色
  64. updateMy: async (data: ChatRoleVO) => {
  65. return await request.put({ url: `/ai/chat-role/update-my`, data})
  66. },
  67. // 删除角色 my
  68. deleteMy: async (id: number) => {
  69. return await request.delete({ url: `/ai/chat-role/delete-my?id=` + id })
  70. },
  71. // 新增:2D模型上传接口
  72. upload2dModelApi: async (formData: FormData) => {
  73. return request.post({
  74. url: '/ai/chat-role/upload-2d-model', // 替换为实际后端接口路径
  75. data: formData,
  76. headers: { 'Content-Type': 'multipart/form-data' } // 关键:设置文件上传头
  77. })
  78. },
  79. }