aiChat.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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/session/create */
  93. export async function postSessionCreate(
  94. body: {
  95. name: string
  96. },
  97. options?: { [key: string]: any }
  98. ) {
  99. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  100. '/api/ai/session/create',
  101. {
  102. method: 'POST',
  103. headers: {
  104. 'Content-Type': 'application/json'
  105. },
  106. data: body,
  107. ...(options || {})
  108. }
  109. )
  110. }
  111. /** 删除会话 POST /api/ai/session/delete */
  112. export async function postSessionOpenApiDelete(
  113. body: {
  114. id: string
  115. },
  116. options?: { [key: string]: any }
  117. ) {
  118. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  119. '/api/ai/session/delete',
  120. {
  121. method: 'POST',
  122. headers: {
  123. 'Content-Type': 'application/json'
  124. },
  125. data: body,
  126. ...(options || {})
  127. }
  128. )
  129. }
  130. /** 获取分页列表 POST /api/ai/session/pageList */
  131. export async function postSessionPageList(
  132. body: {
  133. pageIndex: number
  134. pageSize: number
  135. },
  136. options?: { [key: string]: any }
  137. ) {
  138. return request<{
  139. isSuccess: boolean
  140. code: number
  141. result: {
  142. currentPage: number
  143. hasNextPage: boolean
  144. hasPreviousPage: boolean
  145. model: {
  146. app: string
  147. creationTime: string
  148. entityId: string
  149. id: string
  150. isDeleted: boolean
  151. name: string
  152. sessionId: string
  153. updateTime: string
  154. userId: string
  155. creatorUserId: string
  156. }[]
  157. pageSize: number
  158. totalCount: number
  159. totalPages: number
  160. }
  161. isAuthorized: boolean
  162. }>('/api/ai/session/pageList', {
  163. method: 'POST',
  164. headers: {
  165. 'Content-Type': 'application/json'
  166. },
  167. data: body,
  168. ...(options || {})
  169. })
  170. }
  171. /** 获取消息分页列表 POST /api/ai/session/sessionMessages */
  172. export async function postSessionSessionMessages(
  173. body: {
  174. sessionId: string
  175. pageIndex: number
  176. pageSize: number
  177. },
  178. options?: { [key: string]: any }
  179. ) {
  180. return request<{
  181. isSuccess: boolean
  182. code: number
  183. result: {
  184. currentPage: number
  185. hasNextPage: boolean
  186. hasPreviousPage: boolean
  187. model: {
  188. answer?: string
  189. app?: string
  190. creationTime?: string
  191. creatorUserId?: string
  192. entityId?: string
  193. id?: string
  194. isDeleted?: boolean
  195. message_files?: string
  196. msgId?: string
  197. query?: string
  198. sessionId?: string
  199. taskId?: string
  200. updateTime?: string
  201. userId?: string
  202. }[]
  203. pageSize: number
  204. totalCount: number
  205. totalPages: number
  206. }
  207. isAuthorized: boolean
  208. }>('/api/ai/session/sessionMessages', {
  209. method: 'POST',
  210. headers: {
  211. 'Content-Type': 'application/json'
  212. },
  213. data: body,
  214. ...(options || {})
  215. })
  216. }
  217. /** 更新会话 POST /api/ai/session/update */
  218. export async function postSessionUpdate(
  219. body: {
  220. id: string
  221. name: string
  222. },
  223. options?: { [key: string]: any }
  224. ) {
  225. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  226. '/api/ai/session/update',
  227. {
  228. method: 'POST',
  229. headers: {
  230. 'Content-Type': 'application/json'
  231. },
  232. data: body,
  233. ...(options || {})
  234. }
  235. )
  236. }