aiChat.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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/chat/stop-answer */
  73. export async function postChatStopAnswer(
  74. body: {
  75. session_id: string
  76. msgId: string
  77. },
  78. options?: { [key: string]: any }
  79. ) {
  80. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  81. '/api/ai/chat/stop-answer',
  82. {
  83. method: 'POST',
  84. headers: {
  85. 'Content-Type': 'application/json'
  86. },
  87. data: body,
  88. ...(options || {})
  89. }
  90. )
  91. }
  92. /** 基于智能编排聊天 POST /api/ai/chat/workflow-chat */
  93. export async function postChatWorkflowChat(
  94. body: {
  95. session_id: string
  96. query: string
  97. agent_id: string
  98. files: string[]
  99. params: Record<string, any>
  100. },
  101. options?: { [key: string]: any }
  102. ) {
  103. return request<Record<string, any>>('/api/ai/chat/workflow-chat', {
  104. method: 'POST',
  105. headers: {
  106. 'Content-Type': 'application/json'
  107. },
  108. data: body,
  109. ...(options || {})
  110. })
  111. }
  112. /** 创建会话 POST /api/ai/session/create */
  113. export async function postSessionCreate(
  114. body: {
  115. name: string
  116. },
  117. options?: { [key: string]: any }
  118. ) {
  119. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  120. '/api/ai/session/create',
  121. {
  122. method: 'POST',
  123. headers: {
  124. 'Content-Type': 'application/json'
  125. },
  126. data: body,
  127. ...(options || {})
  128. }
  129. )
  130. }
  131. /** 删除会话 POST /api/ai/session/delete */
  132. export async function postSessionOpenApiDelete(
  133. body: {
  134. id: string
  135. },
  136. options?: { [key: string]: any }
  137. ) {
  138. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  139. '/api/ai/session/delete',
  140. {
  141. method: 'POST',
  142. headers: {
  143. 'Content-Type': 'application/json'
  144. },
  145. data: body,
  146. ...(options || {})
  147. }
  148. )
  149. }
  150. /** 获取分页列表 POST /api/ai/session/pageList */
  151. export async function postSessionPageList(
  152. body: {
  153. pageIndex: number
  154. pageSize: number
  155. },
  156. options?: { [key: string]: any }
  157. ) {
  158. return request<{
  159. isSuccess: boolean
  160. code: number
  161. result: {
  162. currentPage: number
  163. hasNextPage: boolean
  164. hasPreviousPage: boolean
  165. model: {
  166. app: string
  167. creationTime: string
  168. entityId: string
  169. id: string
  170. isDeleted: boolean
  171. name: string
  172. sessionId: string
  173. updateTime: string
  174. userId: string
  175. creatorUserId: string
  176. }[]
  177. pageSize: number
  178. totalCount: number
  179. totalPages: number
  180. }
  181. isAuthorized: boolean
  182. }>('/api/ai/session/pageList', {
  183. method: 'POST',
  184. headers: {
  185. 'Content-Type': 'application/json'
  186. },
  187. data: body,
  188. ...(options || {})
  189. })
  190. }
  191. /** 获取消息分页列表 POST /api/ai/session/sessionMessages */
  192. export async function postSessionSessionMessages(
  193. body: {
  194. sessionId: string
  195. pageIndex: number
  196. pageSize: number
  197. },
  198. options?: { [key: string]: any }
  199. ) {
  200. return request<{
  201. isSuccess: boolean
  202. code: number
  203. result: {
  204. currentPage: number
  205. hasNextPage: boolean
  206. hasPreviousPage: boolean
  207. model: {
  208. answer?: string
  209. app?: string
  210. creationTime?: string
  211. creatorUserId?: string
  212. entityId?: string
  213. id?: string
  214. isDeleted?: boolean
  215. message_files?: string
  216. msgId?: string
  217. query?: string
  218. sessionId?: string
  219. taskId?: string
  220. updateTime?: string
  221. userId?: string
  222. }[]
  223. pageSize: number
  224. totalCount: number
  225. totalPages: number
  226. }
  227. isAuthorized: boolean
  228. }>('/api/ai/session/sessionMessages', {
  229. method: 'POST',
  230. headers: {
  231. 'Content-Type': 'application/json'
  232. },
  233. data: body,
  234. ...(options || {})
  235. })
  236. }
  237. /** 更新会话 POST /api/ai/session/update */
  238. export async function postSessionUpdate(
  239. body: {
  240. id: string
  241. name: string
  242. },
  243. options?: { [key: string]: any }
  244. ) {
  245. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  246. '/api/ai/session/update',
  247. {
  248. method: 'POST',
  249. headers: {
  250. 'Content-Type': 'application/json'
  251. },
  252. data: body,
  253. ...(options || {})
  254. }
  255. )
  256. }