import request from '../utils/request'; //import axios from 'axios'; import {CONFIG_MODULE} from "./_prefix"; import {axios} from '../utils/request' import {MOCK} from "./_prefix"; /** * 添加模型配置信息 POST * @param {*} payload * @returns */ export const addConfig = payload => { const { fileInfoId, userId, learningType, configName, features, label} = payload; return axios.post(`${CONFIG_MODULE}`, { fileInfoId, userId, learningType ,configName ,features, label }).then(res => { return res; }); // return axios.post(`${MOCK}/ml/configs`, { // fileInfoId, userId, learningType ,configName ,features, label // }).then(res => { // return res; // }); } /** * 获取所有模型配置 GET /get/all/{userId} 传入用户id * @param {*} payload * @returns */ export const getAllConfig = payload => { const {userId} = payload; return axios.get(`${CONFIG_MODULE}`,{ params:{ userId: userId } }).then(res => { return res; // return axios.get(`${MOCK}/ml/configs:useId=1`).then(res => { // return res; }); } /** * 获取所有新配置 GET /get/all_new/{userId} * @param {*} payload * @returns */ export const getAllNew = payload => { const { uid } = payload; return axios.get(`${CONFIG_MODULE}/get/all_new/${uid}`).then(res => { return res; }); } /** * 获取单个个配置 GET /get/one/config/{configId} * @param {*} payload * @returns */ export const getOneConfig = payload => { const { configId, userId } = payload; return axios.get(`${CONFIG_MODULE}/${configId}`,{ params:{ userId: userId } }).then(res => { return res;}); // return axios.get(`${MOCK}/ml/configs/:configId`).then(res => { // return res;}); } /** * 更改配置 GET /change/{configId}?confName={confName}&trainFeatureList={trainFeatureList} * @param {*} payload * @returns */ export const changeConfig = payload => { // console.log("change"); console.log("changeConfig",payload); const { configId,confName,tranFeatureList } = payload; return axios.get(`${CONFIG_MODULE}/change/${configId}?confName=${confName}&trainFeatureList={trainFeatureList}`).then(res => { return res; }); } /** * 删除配置 GET /delete/{configId} * @param {*} payload * @returns */ export const deleteConfig = payload => { const {configId, userId} = payload return axios.delete(`${CONFIG_MODULE}/${configId}`,{ params:{ userId: userId } }).then(res => { return res; // return axios.delete(`${MOCK}/ml/configs/${configId}`).then(res => { // return res; }); } /** * 选择特征 GET /get/features/{fileId}?fieldName={fieldName} * @param {*} payload * @returns */ export const getFeatureSelection = payload => { const { fileId,fieldName } = payload; return axios.get(`${CONFIG_MODULE}/get/features?fileId=${fileId}&fieldName=${fieldName}`).then(res => { return res; }); }