AIRobot.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. import HttpAxios from '@/utils/axios'
  2. const base = import.meta.env.VITE_API_HOST
  3. const baseUrl = `${base}/main_new_version.php`
  4. /**
  5. * Prompt Configuration数据
  6. */
  7. export const getPromptConfiguration = (params: any, config: any) => {
  8. return HttpAxios.post(
  9. `${baseUrl}`,
  10. {
  11. action: 'robot',
  12. ...params
  13. },
  14. config
  15. )
  16. }
  17. /**
  18. * 保存Prompt Configuration数据
  19. */
  20. export const SavePromptConfiguration = (params: any, config: any) => {
  21. return HttpAxios.post(
  22. `${baseUrl}`,
  23. {
  24. action: 'robot',
  25. operate: 'save',
  26. ...params
  27. },
  28. config
  29. )
  30. }
  31. /**
  32. * 编辑返回prompt数据
  33. */
  34. export const EditPrompt = (params: any, config: any) => {
  35. return HttpAxios.post(
  36. `${baseUrl}`,
  37. {
  38. action: 'robot',
  39. operate: 'preview_propmpt_witout_save',
  40. ...params
  41. },
  42. config
  43. )
  44. }
  45. /**
  46. * AI测试问题
  47. */
  48. export const PromptAITest = (params: any, config: any) => {
  49. return HttpAxios.post(
  50. `${baseUrl}`,
  51. {
  52. action: 'robot',
  53. operate: 'test_with_ds_claude',
  54. ...params
  55. },
  56. config
  57. )
  58. }
  59. /**
  60. * 获取prompt提示器
  61. */
  62. export const getPrompt = (params: any, config: any) => {
  63. return HttpAxios.post(
  64. `${baseUrl}`,
  65. {
  66. action: 'robot_chat',
  67. operate: 'ai_chat_prompt',
  68. ...params
  69. },
  70. config
  71. )
  72. }
  73. /**
  74. * ai聊天
  75. */
  76. export const aiChat = (params: any, config: any) => {
  77. return HttpAxios.post(
  78. `${baseUrl}`,
  79. {
  80. action: 'robot_chat',
  81. operate: 'ai_chat',
  82. ...params
  83. },
  84. config
  85. )
  86. }
  87. /**
  88. * 暂停ai聊天
  89. */
  90. export const pauseAiChat = (params: any, config: any) => {
  91. return HttpAxios.post(
  92. `${baseUrl}`,
  93. {
  94. action: 'robot_chat',
  95. operate: 'ai_chat_stop',
  96. ...params
  97. },
  98. config
  99. )
  100. }
  101. /**
  102. * 评价ai聊天
  103. */
  104. export const feedbackAiChat = (params: any, config: any) => {
  105. return HttpAxios.post(
  106. `${baseUrl}`,
  107. {
  108. action: 'robot_chat',
  109. operate: 'ai_chat_answer_mark',
  110. ...params
  111. },
  112. config
  113. )
  114. }
  115. /**
  116. * AI Robot预设问题显示
  117. */
  118. export const AIRobotInit = (params: any, config: any) => {
  119. return HttpAxios.post(
  120. `${baseUrl}`,
  121. {
  122. action: 'robot_chat',
  123. operate: 'ai_chat_fixed_init',
  124. ...params
  125. },
  126. config
  127. )
  128. }
  129. /**
  130. * 获取chat log 表格列
  131. */
  132. export const getChatLogTableColumn = (params: any, config: any) => {
  133. return HttpAxios.post(
  134. `${baseUrl}`,
  135. {
  136. action: 'robot_chat_log',
  137. ...params
  138. },
  139. config
  140. )
  141. }
  142. /**
  143. * 根据筛选项获取chat log 表格数据
  144. */
  145. export const getChatLogTableData = (params: any, config: any) => {
  146. return HttpAxios.post(
  147. `${baseUrl}`,
  148. {
  149. action: 'robot_chat_log',
  150. operate: 'search',
  151. ...params
  152. },
  153. config
  154. )
  155. }
  156. /**
  157. * 获取chat log 表格全部数据
  158. */
  159. export const getChatLogAllTableData = (params: any, config: any) => {
  160. return HttpAxios.post(
  161. `${baseUrl}`,
  162. {
  163. action: 'robot_chat_log',
  164. operate: 'excel',
  165. ...params
  166. },
  167. config
  168. )
  169. }
  170. /**
  171. * 获取ai api log 表格列
  172. */
  173. export const getAIApiLogTableColumn = (params: any, config: any) => {
  174. return HttpAxios.post(
  175. `${baseUrl}`,
  176. {
  177. action: 'robot_api_log',
  178. ...params
  179. },
  180. config
  181. )
  182. }
  183. /**
  184. * 根据筛选项获取ai api log表格数据
  185. */
  186. export const getAIApiLogTableData = (params: any, config: any) => {
  187. return HttpAxios.post(
  188. `${baseUrl}`,
  189. {
  190. action: 'robot_api_log',
  191. operate: 'search',
  192. ...params
  193. },
  194. config
  195. )
  196. }
  197. /**
  198. * 获取ai api log表格全部数据
  199. */
  200. export const getAIApiLogAllTableData = (params: any, config: any) => {
  201. return HttpAxios.post(
  202. `${baseUrl}`,
  203. {
  204. action: 'robot_api_log',
  205. operate: 'excel',
  206. ...params
  207. },
  208. config
  209. )
  210. }
  211. /**
  212. * 获取ai api log弹窗详情
  213. */
  214. export const getAIApiLogDialog = (params: any, config: any) => {
  215. return HttpAxios.post(
  216. `${baseUrl}`,
  217. {
  218. action: 'robot_chat_log',
  219. operate: 'api_log',
  220. ...params
  221. },
  222. config
  223. )
  224. }