You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

2 months ago
  1. import request from '../utils/request'
  2. const APIurl = import.meta.env.VITE_APP_API_BASE_URL
  3. //各个模块权限code接口
  4. export const pessionAPI = function (params) {
  5. return request({
  6. url: `${APIurl}/api/brain/privilege`,
  7. method: 'post',
  8. data: new URLSearchParams(params),
  9. headers: {
  10. 'Content-Type': 'application/x-www-form-urlencoded'
  11. }
  12. })
  13. }
  14. //数据接口
  15. export const dataListAPI = function (params) {
  16. // URLSearchParams只接受全部字符串的数据
  17. // 将传入数据转化成字符串
  18. const StringParams = new URLSearchParams(
  19. Object.entries(params).map(([key, value]) => [key, String(value)])
  20. )
  21. return request({
  22. url: `${APIurl}/api/brain/data`,
  23. method: 'post',
  24. data: StringParams,
  25. headers: {
  26. 'Content-Type': 'application/x-www-form-urlencoded'
  27. }
  28. })
  29. }
  30. //统计用户行为接口
  31. export const computedUsersAPI = function (params) {
  32. return request({
  33. url: `${APIurl}/BrainStatistics/getStatistic`,
  34. method: 'post',
  35. data: new URLSearchParams(params),
  36. headers: {
  37. 'Content-Type': 'application/x-www-form-urlencoded'
  38. }
  39. })
  40. }
  41. // 获取回复接口
  42. export const getReplyAPI = function (params) {
  43. return request({
  44. url: `https://api.coze.cn/v1/workflow/stream_run`,
  45. method: 'post',
  46. data: JSON.stringify(params),
  47. headers: {
  48. 'Content-Type': 'application/json',
  49. Authorization: 'Bearer pat_TJbuxUiZdl6U3oiiSeceQnHg5XdaZsWpxc6oIozc2Auhd9YuyBvFslJJQUFUym1F'
  50. }
  51. })
  52. }
  53. export const getReplyStreamAPI = function (params) {
  54. return fetch(`https://api.coze.cn/v1/workflow/stream_run`,
  55. {
  56. method: 'POST',
  57. body: JSON.stringify(params),
  58. headers: {
  59. 'Content-Type': 'application/json',
  60. Authorization: 'Bearer pat_TJbuxUiZdl6U3oiiSeceQnHg5XdaZsWpxc6oIozc2Auhd9YuyBvFslJJQUFUym1F'
  61. }
  62. }
  63. )
  64. }