config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import request from '../utils/request';
  2. //import axios from 'axios';
  3. import {CONFIG_MODULE} from "./_prefix";
  4. import {axios} from '../utils/request'
  5. import {MOCK} from "./_prefix";
  6. /**
  7. * 添加模型配置信息 POST
  8. * @param {*} payload
  9. * @returns
  10. */
  11. export const addConfig = payload => {
  12. const { fileInfoId, userId, learningType, configName, features, label} = payload;
  13. return axios.post(`${CONFIG_MODULE}`, {
  14. fileInfoId, userId, learningType ,configName ,features, label
  15. }).then(res => {
  16. return res;
  17. });
  18. // return axios.post(`${MOCK}/ml/configs`, {
  19. // fileInfoId, userId, learningType ,configName ,features, label
  20. // }).then(res => {
  21. // return res;
  22. // });
  23. }
  24. /**
  25. * 获取所有模型配置 GET /get/all/{userId} 传入用户id
  26. * @param {*} payload
  27. * @returns
  28. */
  29. export const getAllConfig = payload => {
  30. const {userId} = payload;
  31. return axios.get(`${CONFIG_MODULE}`,{
  32. params:{
  33. userId: userId
  34. }
  35. }).then(res => {
  36. return res;
  37. // return axios.get(`${MOCK}/ml/configs:useId=1`).then(res => {
  38. // return res;
  39. });
  40. }
  41. /**
  42. * 获取所有新配置 GET /get/all_new/{userId}
  43. * @param {*} payload
  44. * @returns
  45. */
  46. export const getAllNew = payload => {
  47. const { uid } = payload;
  48. return axios.get(`${CONFIG_MODULE}/get/all_new/${uid}`).then(res => {
  49. return res;
  50. });
  51. }
  52. /**
  53. * 获取单个个配置 GET /get/one/config/{configId}
  54. * @param {*} payload
  55. * @returns
  56. */
  57. export const getOneConfig = payload => {
  58. const { configId, userId } = payload;
  59. return axios.get(`${CONFIG_MODULE}/${configId}`,{
  60. params:{
  61. userId: userId
  62. }
  63. }).then(res => {
  64. return res;});
  65. // return axios.get(`${MOCK}/ml/configs/:configId`).then(res => {
  66. // return res;});
  67. }
  68. /**
  69. * 更改配置 GET /change/{configId}?confName={confName}&trainFeatureList={trainFeatureList}
  70. * @param {*} payload
  71. * @returns
  72. */
  73. export const changeConfig = payload => {
  74. // console.log("change");
  75. console.log("changeConfig",payload);
  76. const { configId,confName,tranFeatureList } = payload;
  77. return axios.get(`${CONFIG_MODULE}/change/${configId}?confName=${confName}&trainFeatureList={trainFeatureList}`).then(res => {
  78. return res;
  79. });
  80. }
  81. /**
  82. * 删除配置 GET /delete/{configId}
  83. * @param {*} payload
  84. * @returns
  85. */
  86. export const deleteConfig = payload => {
  87. const {configId, userId} = payload
  88. return axios.delete(`${CONFIG_MODULE}/${configId}`,{
  89. params:{
  90. userId: userId
  91. }
  92. }).then(res => {
  93. return res;
  94. // return axios.delete(`${MOCK}/ml/configs/${configId}`).then(res => {
  95. // return res;
  96. });
  97. }
  98. /**
  99. * 选择特征 GET /get/features/{fileId}?fieldName={fieldName}
  100. * @param {*} payload
  101. * @returns
  102. */
  103. export const getFeatureSelection = payload => {
  104. const { fileId,fieldName } = payload;
  105. return axios.get(`${CONFIG_MODULE}/get/features?fileId=${fileId}&fieldName=${fieldName}`).then(res => {
  106. return res;
  107. });
  108. }