aiChat.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 基于Agent的智能问答 (SSE) POST /api/ai/chat/agent-chat */
  5. export async function postChatAgentChat(
  6. body: {
  7. session_id: string
  8. query: string
  9. knowledge_base_ids: string[]
  10. knowledge_ids: string[]
  11. agent_id: string
  12. summary_model_id: string
  13. disable_title: boolean
  14. enable_memory: boolean
  15. images: string[]
  16. agent_enabled: boolean
  17. web_search_enabled: boolean
  18. },
  19. options?: { [key: string]: any }
  20. ) {
  21. return request<Record<string, any>>('/api/ai/chat/agent-chat', {
  22. method: 'POST',
  23. headers: {
  24. 'Content-Type': 'application/json'
  25. },
  26. data: body,
  27. ...(options || {})
  28. })
  29. }
  30. /** 基于知识库的问答 (SSE) POST /api/ai/chat/knowledge-chat */
  31. export async function postChatKnowledgeChat(
  32. body: {
  33. session_id: string
  34. query: string
  35. knowledge_base_ids: string[]
  36. knowledge_ids: string[]
  37. summary_model_id: string
  38. disable_title: boolean
  39. enable_memory: boolean
  40. },
  41. options?: { [key: string]: any }
  42. ) {
  43. return request<Record<string, any>>('/api/ai/chat/knowledge-chat', {
  44. method: 'POST',
  45. headers: {
  46. 'Content-Type': 'application/json'
  47. },
  48. data: body,
  49. ...(options || {})
  50. })
  51. }
  52. /** 基于模型聊天 (SSE) POST /api/ai/chat/model-chat */
  53. export async function postChatModelChat(
  54. body: {
  55. session_id: string
  56. query: string
  57. summary_model_id: string
  58. disable_title: boolean
  59. enable_memory: boolean
  60. },
  61. options?: { [key: string]: any }
  62. ) {
  63. return request<Record<string, any>>('/api/ai/chat/model-chat', {
  64. method: 'POST',
  65. headers: {
  66. 'Content-Type': 'application/json'
  67. },
  68. data: body,
  69. ...(options || {})
  70. })
  71. }
  72. /** 创建会话 POST /api/ai/session/create */
  73. export async function postSessionCreate(
  74. body: {
  75. name: string
  76. },
  77. options?: { [key: string]: any }
  78. ) {
  79. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  80. '/api/ai/session/create',
  81. {
  82. method: 'POST',
  83. headers: {
  84. 'Content-Type': 'application/json'
  85. },
  86. data: body,
  87. ...(options || {})
  88. }
  89. )
  90. }
  91. /** 删除会话 POST /api/ai/session/delete */
  92. export async function postSessionOpenApiDelete(
  93. body: {
  94. id: string
  95. },
  96. options?: { [key: string]: any }
  97. ) {
  98. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  99. '/api/ai/session/delete',
  100. {
  101. method: 'POST',
  102. headers: {
  103. 'Content-Type': 'application/json'
  104. },
  105. data: body,
  106. ...(options || {})
  107. }
  108. )
  109. }
  110. /** 获取分页列表 POST /api/ai/session/pageList */
  111. export async function postSessionPageList(
  112. body: {
  113. pageIndex: number
  114. pageSize: number
  115. },
  116. options?: { [key: string]: any }
  117. ) {
  118. return request<{
  119. isSuccess: boolean
  120. code: number
  121. result: {
  122. currentPage: number
  123. hasNextPage: boolean
  124. hasPreviousPage: boolean
  125. model: {
  126. app: string
  127. creationTime: string
  128. entityId: string
  129. id: string
  130. isDeleted: boolean
  131. name: string
  132. sessionId: string
  133. updateTime: string
  134. userId: string
  135. creatorUserId: string
  136. }[]
  137. pageSize: number
  138. totalCount: number
  139. totalPages: number
  140. }
  141. isAuthorized: boolean
  142. }>('/api/ai/session/pageList', {
  143. method: 'POST',
  144. headers: {
  145. 'Content-Type': 'application/json'
  146. },
  147. data: body,
  148. ...(options || {})
  149. })
  150. }
  151. /** 获取消息分页列表 POST /api/ai/session/sessionMessages */
  152. export async function postSessionSessionMessages(
  153. body: {
  154. sessionId: string
  155. pageIndex: number
  156. pageSize: number
  157. },
  158. options?: { [key: string]: any }
  159. ) {
  160. return request<{
  161. isSuccess: boolean
  162. code: number
  163. result: {
  164. currentPage: number
  165. hasNextPage: boolean
  166. hasPreviousPage: boolean
  167. model: {
  168. answer?: string
  169. app?: string
  170. creationTime?: string
  171. creatorUserId?: string
  172. entityId?: string
  173. id?: string
  174. isDeleted?: boolean
  175. message_files?: string
  176. msgId?: string
  177. query?: string
  178. sessionId?: string
  179. taskId?: string
  180. updateTime?: string
  181. userId?: string
  182. }[]
  183. pageSize: number
  184. totalCount: number
  185. totalPages: number
  186. }
  187. isAuthorized: boolean
  188. }>('/api/ai/session/sessionMessages', {
  189. method: 'POST',
  190. headers: {
  191. 'Content-Type': 'application/json'
  192. },
  193. data: body,
  194. ...(options || {})
  195. })
  196. }
  197. /** 更新会话 POST /api/ai/session/update */
  198. export async function postSessionUpdate(
  199. body: {
  200. id: string
  201. name: string
  202. },
  203. options?: { [key: string]: any }
  204. ) {
  205. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  206. '/api/ai/session/update',
  207. {
  208. method: 'POST',
  209. headers: {
  210. 'Content-Type': 'application/json'
  211. },
  212. data: body,
  213. ...(options || {})
  214. }
  215. )
  216. }