| @@ -108,7 +108,9 @@ export default defineConfig({ | |||
| * @description 内置了 babel import 插件 | |||
| * @doc https://umijs.org/docs/max/antd#antd | |||
| */ | |||
| antd: {}, | |||
| antd: { | |||
| configProvider: {}, | |||
| }, | |||
| /** | |||
| * @name 网络请求配置 | |||
| * @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。 | |||
| @@ -1,6 +1,5 @@ | |||
| // 自定义 Modal | |||
| import { ReactComponent as CloseIcon } from '@/assets/svg/modal-close.svg'; | |||
| import ModalTitle from '@/components/ModalTitle'; | |||
| import { Modal, type ModalProps } from 'antd'; | |||
| import classNames from 'classnames'; | |||
| @@ -15,7 +14,6 @@ function KFModal({ title, image, children, className, ...rest }: KFModalProps) { | |||
| className={classNames(['kf-modal', className])} | |||
| {...rest} | |||
| title={<ModalTitle title={title} image={image}></ModalTitle>} | |||
| closeIcon={<CloseIcon></CloseIcon>} | |||
| > | |||
| {children} | |||
| </Modal> | |||
| @@ -59,12 +59,14 @@ const Dataset = () => { | |||
| const locationParams = useParams(); //新版本获取路由参数接口 | |||
| const [wordList, setWordList] = useState([]); | |||
| const [activeTabKey, setActiveTabKey] = useState('1'); | |||
| const [uuid, setUuid] = useState(Date.now()); | |||
| const getDatasetByDetail = () => { | |||
| getDatasetById(locationParams.id).then((ret) => { | |||
| console.log(ret); | |||
| setDatasetDetailObj(ret.data); | |||
| }); | |||
| }; | |||
| // 获取数据集版本 | |||
| const getDatasetVersionList = () => { | |||
| getDatasetVersionsById(locationParams.id).then((ret) => { | |||
| console.log(ret); | |||
| @@ -77,6 +79,8 @@ const Dataset = () => { | |||
| }; | |||
| }), | |||
| ); | |||
| setVersion(ret.data[0]); | |||
| getDatasetVersions({ version: ret.data[0], dataset_id: locationParams.id }); | |||
| } | |||
| }); | |||
| }; | |||
| @@ -90,6 +94,7 @@ const Dataset = () => { | |||
| form.setFieldsValue({ name: datasetDetailObj.name }); | |||
| setDialogTitle('创建新版本'); | |||
| setUuid(Date.now()); | |||
| setIsModalOpen(true); | |||
| }; | |||
| const handleCancel = () => { | |||
| @@ -118,9 +123,7 @@ const Dataset = () => { | |||
| onOk: () => { | |||
| deleteDatasetVersion({ dataset_id: locationParams.id, version }).then((ret) => { | |||
| setVersion(null); | |||
| getDatasetVersionList(); | |||
| getDatasetVersions({ version, dataset_id: locationParams.id }); | |||
| message.success('删除成功'); | |||
| }); | |||
| }, | |||
| @@ -133,6 +136,7 @@ const Dataset = () => { | |||
| message.success('创建成功'); | |||
| }); | |||
| }; | |||
| // 获取版本下的文件列表 | |||
| const getDatasetVersions = (params) => { | |||
| getDatasetVersionIdList(params).then((res) => { | |||
| setWordList(res?.data?.content ?? []); | |||
| @@ -377,7 +381,7 @@ const Dataset = () => { | |||
| }, | |||
| ]} | |||
| > | |||
| <Upload {...props}> | |||
| <Upload {...props} data={{ uuid: uuid }}> | |||
| <Button | |||
| style={{ | |||
| fontSize: '14px', | |||
| @@ -24,7 +24,16 @@ const PublicData = (React.FC = () => { | |||
| onChange({ file, fileList }) { | |||
| if (file.status !== 'uploading') { | |||
| console.log(file, fileList); | |||
| form.setFieldsValue({ dataset_version_vos: fileList.map((item) => item.response.data[0]) }); | |||
| form.setFieldsValue({ | |||
| dataset_version_vos: fileList.map((item) => { | |||
| const data = item.response.data[0]; | |||
| return { | |||
| file_name: data.fileName, | |||
| file_size: data.fileSize, | |||
| url: data.url, | |||
| }; | |||
| }), | |||
| }); | |||
| } | |||
| }, | |||
| defaultFileList: [], | |||
| @@ -98,7 +98,7 @@ function Experiment() { | |||
| setExperimentInList(list); | |||
| // 获取 TensorBoard 状态 | |||
| list.forEach((item) => { | |||
| if (item.nodes_result.tensorboard_log) { | |||
| if (item.nodes_result?.tensorboard_log) { | |||
| const timerId = setTimeout(() => { | |||
| getTensorBoardStatus(item); | |||
| }, 0); | |||
| @@ -161,8 +161,8 @@ function Experiment() { | |||
| } | |||
| }; | |||
| const expandChange = (e, record) => { | |||
| clearExperimentInTimers(); | |||
| if (record.id === expandedRowKeys) { | |||
| clearExperimentInTimers(); | |||
| setExpandedRowKeys(null); | |||
| } else { | |||
| getQueryByExperiment(record.id); | |||
| @@ -446,7 +446,7 @@ function Experiment() { | |||
| {index + 1} | |||
| </a> | |||
| <div style={{ width: '300px' }}> | |||
| {item.nodes_result.tensorboard_log ? ( | |||
| {item.nodes_result?.tensorboard_log ? ( | |||
| <TensorBoardStatus | |||
| status={item.tensorBoardStatus} | |||
| onClick={() => handleTensorboard(item)} | |||
| @@ -23,14 +23,23 @@ const PublicData = () => { | |||
| onChange({ file, fileList }) { | |||
| if (file.status !== 'uploading') { | |||
| console.log(file, fileList); | |||
| form.setFieldsValue({ dataset_version_vos: fileList.map((item) => item.response.data[0]) }); | |||
| form.setFieldsValue({ | |||
| models_version_vos: fileList.map((item) => { | |||
| const data = item.response.data[0]; | |||
| return { | |||
| file_name: data.fileName, | |||
| file_size: data.fileSize, | |||
| url: data.url, | |||
| }; | |||
| }), | |||
| }); | |||
| } | |||
| }, | |||
| defaultFileList: [], | |||
| }; | |||
| const [queryFlow, setQueryFlow] = useState({ | |||
| page: 0, | |||
| size: 10, | |||
| size: 20, | |||
| name: null, | |||
| available_range: 0, | |||
| }); | |||
| @@ -326,6 +335,21 @@ const PublicData = () => { | |||
| <Input placeholder="请输入模型名称" showCount maxLength={64} /> | |||
| </Form.Item> | |||
| <Form.Item | |||
| label="模型版本" | |||
| name="version" | |||
| rules={ | |||
| [ | |||
| // { | |||
| // required: true, | |||
| // message: 'Please input your username!', | |||
| // }, | |||
| ] | |||
| } | |||
| > | |||
| <Input placeholder="请输入模型版本" /> | |||
| </Form.Item> | |||
| <Form.Item | |||
| label="模型描述" | |||
| name="description" | |||
| @@ -372,9 +396,19 @@ const PublicData = () => { | |||
| > | |||
| <Select allowClear placeholder="请选择模型标签" options={[]} /> | |||
| </Form.Item> | |||
| <Form.Item label="模型文件" name="dataset_version_vos"> | |||
| <Form.Item label="模型文件" name="models_version_vos"> | |||
| <Upload {...props} data={{ uuid: uuid }}> | |||
| <Button icon={<UploadOutlined style={{ color: '#1664ff' }} />}>上传文件</Button> | |||
| <Button | |||
| style={{ | |||
| fontSize: '14px', | |||
| border: '1px solid', | |||
| borderColor: '#1664ff', | |||
| background: '#fff', | |||
| }} | |||
| icon={<UploadOutlined style={{ color: '#1664ff', fontSize: '14px' }} />} | |||
| > | |||
| 上传文件 | |||
| </Button> | |||
| </Upload> | |||
| </Form.Item> | |||
| </Form> | |||
| @@ -10,7 +10,7 @@ const leftdataList = [1, 2, 3]; | |||
| const PublicData = () => { | |||
| const [queryFlow, setQueryFlow] = useState({ | |||
| page: 0, | |||
| size: 10, | |||
| size: 20, | |||
| name: null, | |||
| available_range: 1, | |||
| }); | |||
| @@ -25,7 +25,7 @@ export function addDatesetAndVesion(data) { | |||
| } | |||
| // 新增模型 | |||
| export function addModel(data) { | |||
| return request(`/api/mmp//models`, { | |||
| return request(`/api/mmp/models/addModelAndVersion`, { | |||
| method: 'POST', | |||
| headers: { | |||
| 'Content-Type': 'application/json;charset=UTF-8', | |||
| @@ -52,13 +52,13 @@ public class DatasetController { | |||
| @ApiOperation("数据集广场公开数据集分页查询,根据data_type筛选,1公开0私有") | |||
| public AjaxResult queryByPage(Dataset dataset, @RequestParam("page") int page, | |||
| @RequestParam("size") int size, | |||
| //@RequestParam("available_range") int availableRange , | |||
| @RequestParam(value = "available_range") int availableRange , | |||
| @RequestParam(value = "data_type", required = false) String dataType) { | |||
| if (dataType != null) { // 仅当dataType有值时设置 | |||
| dataset.setDataType(dataType); | |||
| } | |||
| dataset.setAvailableRange(1); | |||
| dataset.setAvailableRange(availableRange); | |||
| PageRequest pageRequest = PageRequest.of(page, size); | |||
| return AjaxResult.success(this.datasetService.queryByPage(dataset, pageRequest)); | |||
| } | |||
| @@ -182,16 +182,15 @@ public class DatasetController { | |||
| /** | |||
| * 上传数据集 | |||
| * | |||
| // * @param datasetId 数据集ID | |||
| * @param files 上传的数据集文件 | |||
| * | |||
| * @param uuid 上传唯一标识,构建url | |||
| * @return 上传结果 | |||
| */ | |||
| @CrossOrigin(origins = "*", allowedHeaders = "*") | |||
| @PostMapping("/upload") | |||
| @ApiOperation(value = "上传数据集", notes = "根据数据集版本表id上传数据集文件,并将信息存入数据库。") | |||
| public AjaxResult uploadDataset(@RequestParam("file") MultipartFile[] files) throws Exception { | |||
| return AjaxResult.success(this.datasetService.uploadDataset(files)); | |||
| public AjaxResult uploadDataset(@RequestParam("file") MultipartFile[] files, @RequestParam("uuid") String uuid) throws Exception { | |||
| return AjaxResult.success(this.datasetService.uploadDataset(files,uuid)); | |||
| } | |||
| @@ -176,8 +176,8 @@ public class ModelsController extends BaseController { | |||
| @CrossOrigin(origins = "*", allowedHeaders = "*") | |||
| @PostMapping("/upload") | |||
| @ApiOperation(value = "上传模型", notes = "根据模型id上传模型文件,并将信息存入数据库。") | |||
| public GenericsAjaxResult<List<Map<String, String>>> uploadModels(@RequestParam("file") MultipartFile[] files) throws Exception { | |||
| return genericsSuccess(this.modelsService.uploadModels(files)); | |||
| public GenericsAjaxResult<List<Map<String, String>>> uploadModels(@RequestParam("file") MultipartFile[] files , @RequestParam("uuid") String uuid) throws Exception { | |||
| return genericsSuccess(this.modelsService.uploadModels(files,uuid)); | |||
| } | |||
| @@ -72,7 +72,7 @@ DatasetService { | |||
| ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception; | |||
| List<Map<String, String>> uploadDataset(MultipartFile[] files) throws Exception; | |||
| List<Map<String, String>> uploadDataset(MultipartFile[] files, String uuid) throws Exception; | |||
| Map uploadDatasetPipeline(DatasetVersion datasetVersion) throws Exception; | |||
| @@ -70,7 +70,7 @@ public interface ModelsService { | |||
| List<Map<String, String>> uploadModels(MultipartFile[] files) throws Exception; | |||
| List<Map<String, String>> uploadModels(MultipartFile[] files, String uuid) throws Exception; | |||
| Map uploadModelsPipeline(ModelsVersion modelsVersion) throws Exception; | |||
| @@ -12,7 +12,7 @@ import com.ruoyi.platform.service.DatasetVersionService; | |||
| import com.ruoyi.platform.utils.BeansUtils; | |||
| import com.ruoyi.platform.utils.FileUtil; | |||
| import com.ruoyi.platform.utils.MinioUtil; | |||
| import com.ruoyi.platform.vo.DatasetVersionVo; | |||
| import com.ruoyi.platform.vo.VersionVo; | |||
| import com.ruoyi.platform.vo.DatasetVo; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -203,16 +203,16 @@ public class DatasetServiceImpl implements DatasetService { | |||
| /** | |||
| * 上传数据集 | |||
| * | |||
| * @param files 文件 | |||
| * @param files 文件 | |||
| * @param uuid | |||
| * @return 是否成功 | |||
| */ | |||
| @Override | |||
| public List<Map<String, String>> uploadDataset(MultipartFile[] files) throws Exception { | |||
| public List<Map<String, String>> uploadDataset(MultipartFile[] files, String uuid) throws Exception { | |||
| List<Map<String, String>> results = new ArrayList<>(); | |||
| //时间戳统一定在外面,一次上传就定好 | |||
| Date createTime = new Date(); | |||
| String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(createTime); | |||
| // //时间戳统一定在外面,一次上传就定好 | |||
| // Date createTime = new Date(); | |||
| // String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(createTime); | |||
| for (MultipartFile file:files){ | |||
| if (file.isEmpty()) { | |||
| @@ -225,20 +225,12 @@ public class DatasetServiceImpl implements DatasetService { | |||
| // 其余操作基于 modelsVersionToUse | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| String fileName = file.getOriginalFilename(); | |||
| String objectName = "datasets/" + username + "/" + timestamp + "/" + fileName; | |||
| String objectName = "datasets/" + username + "/" + uuid + "/" + fileName; | |||
| // 上传文件到MinIO并将记录新增到数据库中 | |||
| try (InputStream inputStream = file.getInputStream()) { | |||
| minioUtil.uploadObject(bucketName, objectName, inputStream); | |||
| // DatasetVersion datasetVersion = new DatasetVersion(); | |||
| // datasetVersion.setDatasetId(id); | |||
| // datasetVersion.setVersion(version); | |||
| // datasetVersion.setUrl(objectName); | |||
| // datasetVersion.setFileName(fileName); | |||
| // datasetVersion.setFileSize(formattedSize); | |||
| // | |||
| // //返回插入结果 | |||
| // DatasetVersion insertedDatasetversion = datasetVersionService.insert(datasetVersion); | |||
| Map<String, String> fileResult = new HashMap<>(); | |||
| fileResult.put("fileName", file.getOriginalFilename()); | |||
| fileResult.put("url", objectName); // objectName根据实际情况定义 | |||
| @@ -313,8 +305,8 @@ public class DatasetServiceImpl implements DatasetService { | |||
| @Override | |||
| @Transactional | |||
| public String insertDatasetAndVersion(DatasetVo datasetVo) throws Exception { | |||
| List<DatasetVersionVo> datasetVersionVos = datasetVo.getDatasetVersionVos(); | |||
| if (datasetVersionVos==null||datasetVersionVos.size()==0){ | |||
| List<VersionVo> datasetVersionVos = datasetVo.getDatasetVersionVos(); | |||
| if (datasetVersionVos==null || datasetVersionVos.isEmpty()){ | |||
| throw new Exception("数据集版本信息错误"); | |||
| } | |||
| @@ -329,7 +321,7 @@ public class DatasetServiceImpl implements DatasetService { | |||
| throw new Exception("新增数据集失败"); | |||
| } | |||
| for (DatasetVersionVo datasetVersionVo :datasetVersionVos){ | |||
| for (VersionVo datasetVersionVo :datasetVersionVos){ | |||
| DatasetVersion datasetVersion = new DatasetVersion(); | |||
| datasetVersion.setDatasetId(datasetInsert.getId()); | |||
| datasetVersion.setVersion(datasetVo.getVersion()); | |||
| @@ -138,9 +138,10 @@ public class DatasetVersionServiceImpl implements DatasetVersionService { | |||
| Map<String, Object> response = new HashMap<>(); | |||
| List<DatasetVersion> datasetVersionList = this.datasetVersionDao.queryAllByDatasetVersion(datasetId, version); | |||
| datasetVersionList.stream(). | |||
| findFirst(). | |||
| ifPresent(datasetVersion -> { | |||
| datasetVersionList.stream() | |||
| .filter(datasetVersion -> datasetVersion.getUrl() != null && !datasetVersion.getUrl().isEmpty()) | |||
| .findFirst() | |||
| .ifPresent(datasetVersion -> { | |||
| String url = datasetVersion.getUrl(); | |||
| String path = bucketName + '/' + url.substring(0, url.lastIndexOf('/')); | |||
| response.put("path", path); | |||
| @@ -1,7 +1,6 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||
| import com.ruoyi.platform.domain.DatasetVersion; | |||
| import com.ruoyi.platform.domain.Models; | |||
| import com.ruoyi.platform.domain.ModelsVersion; | |||
| import com.ruoyi.platform.mapper.ModelsDao; | |||
| @@ -12,16 +11,15 @@ import com.ruoyi.platform.utils.BeansUtils; | |||
| import com.ruoyi.platform.utils.FileUtil; | |||
| import com.ruoyi.platform.utils.MinioUtil; | |||
| import com.ruoyi.platform.vo.ModelsVo; | |||
| import com.ruoyi.platform.vo.VersionVo; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import io.minio.MinioClient; | |||
| import io.netty.util.Version; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.core.io.InputStreamResource; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.HttpStatus; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -33,7 +31,6 @@ import java.io.ByteArrayInputStream; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.InputStream; | |||
| import java.net.URLEncoder; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| import java.util.zip.ZipEntry; | |||
| @@ -169,6 +166,7 @@ public class ModelsServiceImpl implements ModelsService { | |||
| ModelsVersion modelsVersion = this.modelsVersionDao.queryById(id); | |||
| if (modelsVersion == null) { | |||
| throw new Exception("未找到该模型下版本记录"); | |||
| } | |||
| // 从数据库中获取存储路径(即MinIO中的对象名称) | |||
| String objectName = modelsVersion.getUrl(); | |||
| @@ -199,15 +197,16 @@ public class ModelsServiceImpl implements ModelsService { | |||
| * 上传模型 | |||
| * | |||
| * @param files 文件 | |||
| * @param uuid | |||
| * @return 是否成功 | |||
| */ | |||
| @Override | |||
| public List<Map<String, String>> uploadModels(MultipartFile[] files) throws Exception { | |||
| public List<Map<String, String>> uploadModels(MultipartFile[] files, String uuid) throws Exception { | |||
| List<Map<String, String>> results = new ArrayList<>(); | |||
| //时间戳统一定在外面,一次上传就定好 | |||
| Date createTime = new Date(); | |||
| String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(createTime); | |||
| // //时间戳统一定在外面,一次上传就定好 | |||
| // Date createTime = new Date(); | |||
| // String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(createTime); | |||
| for (MultipartFile file:files){ | |||
| if (file.isEmpty()) { | |||
| @@ -217,22 +216,18 @@ public class ModelsServiceImpl implements ModelsService { | |||
| long sizeInBytes = file.getSize(); | |||
| String formattedSize = FileUtil.formatFileSize(sizeInBytes); // 格式化文件大小 | |||
| // 其余操作基于 modelsVersionToUse | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| String fileName = file.getOriginalFilename(); | |||
| String objectName = "models/" + username + "/" + timestamp + "/" + fileName; | |||
| String objectName = "models/" + username + "/" + uuid + "/" + fileName; | |||
| // 上传文件到MinIO并将记录新增到数据库中 | |||
| try (InputStream inputStream = file.getInputStream()) { | |||
| minioUtil.uploadObject(bucketName, objectName, inputStream); | |||
| // ModelsVersion modelsVersion = new ModelsVersion(); | |||
| // modelsVersion.setModelsId(id); | |||
| // modelsVersion.setVersion(version); | |||
| // modelsVersion.setUrl(objectName); | |||
| // modelsVersion.setFileName(fileName); | |||
| // modelsVersion.setFileSize(formattedSize); | |||
| // //返回插入结果 | |||
| // ModelsVersion insertedModelsVersion = modelsVersionService.insert(modelsVersion); | |||
| // | |||
| Map<String, String> fileResult = new HashMap<>(); | |||
| fileResult.put("fileName", file.getOriginalFilename()); | |||
| fileResult.put("url", objectName); // objectName根据实际情况定义 | |||
| @@ -361,6 +356,11 @@ public class ModelsServiceImpl implements ModelsService { | |||
| @Override | |||
| @Transactional | |||
| public String insertModelAndVersion(ModelsVo modelsVo) throws Exception { | |||
| List<VersionVo> modelsVersionVos = modelsVo.getModelsVersionVos(); | |||
| if (modelsVersionVos==null || modelsVersionVos.isEmpty()){ | |||
| throw new Exception("模型版本信息错误"); | |||
| } | |||
| Models models = new Models(); | |||
| models.setName(modelsVo.getName()); | |||
| models.setDescription(modelsVo.getDescription()); | |||
| @@ -371,16 +371,20 @@ public class ModelsServiceImpl implements ModelsService { | |||
| if (modelsInsert == null){ | |||
| throw new Exception("新增模型失败"); | |||
| } | |||
| ModelsVersion modelsVersion = new ModelsVersion(); | |||
| modelsVersion.setModelsId(modelsInsert.getId()); | |||
| modelsVersion.setVersion(modelsVo.getVersion()); | |||
| modelsVersion.setUrl(modelsVo.getUrl()); | |||
| modelsVersion.setFileName(modelsVo.getFileName()); | |||
| modelsVersion.setFileSize(modelsVo.getFileSize()); | |||
| ModelsVersion modelsVersionInsert = this.modelsVersionService.insert(modelsVersion); | |||
| if (modelsVersionInsert == null) { | |||
| throw new Exception("新增模型失败"); | |||
| //遍历版本信息列表,把文件信息插入数据库 | |||
| for(VersionVo modelsVersionVo : modelsVersionVos){ | |||
| ModelsVersion modelsVersion = new ModelsVersion(); | |||
| modelsVersion.setModelsId(modelsInsert.getId()); | |||
| modelsVersion.setVersion(modelsVo.getVersion()); | |||
| modelsVersion.setUrl(modelsVersionVo.getUrl()); | |||
| modelsVersion.setFileName(modelsVersionVo.getFileName()); | |||
| modelsVersion.setFileSize(modelsVersionVo.getFileSize()); | |||
| ModelsVersion modelsVersionInsert = this.modelsVersionService.insert(modelsVersion); | |||
| if (modelsVersionInsert == null) { | |||
| throw new Exception("新增模型版本失败"); | |||
| } | |||
| } | |||
| return "新增模型成功"; | |||
| } | |||
| @@ -166,9 +166,10 @@ public class ModelsVersionServiceImpl implements ModelsVersionService { | |||
| Map<String,Object> response = new HashMap<>(); | |||
| List<ModelsVersion> modelsVersionList = this.modelsVersionDao.queryAllByModelsVersion(modelsId, version); | |||
| modelsVersionList.stream(). | |||
| findFirst(). | |||
| ifPresent(modelsVersion -> { | |||
| modelsVersionList.stream() | |||
| .filter(modelsVersion -> modelsVersion.getUrl() != null && !modelsVersion.getUrl().isEmpty()) | |||
| .findFirst() | |||
| .ifPresent(modelsVersion -> { | |||
| String url = modelsVersion.getUrl(); | |||
| String path = bucketName + '/' + url.substring(0, url.lastIndexOf('/')); | |||
| response.put("path", path); | |||
| @@ -30,7 +30,9 @@ public class DatasetVo implements Serializable { | |||
| */ | |||
| @ApiModelProperty(name = "version") | |||
| private String version; | |||
| private List<DatasetVersionVo> datasetVersionVos; | |||
| @ApiModelProperty(name = "dataset_version_vos") | |||
| private List<VersionVo> datasetVersionVos; | |||
| /** | |||
| * 可用集群 | |||
| */ | |||
| @@ -85,11 +87,11 @@ public class DatasetVo implements Serializable { | |||
| this.version = version; | |||
| } | |||
| public List<DatasetVersionVo> getDatasetVersionVos() { | |||
| public List<VersionVo> getDatasetVersionVos() { | |||
| return datasetVersionVos; | |||
| } | |||
| public void setDatasetVersionVos(List<DatasetVersionVo> datasetVersionVos) { | |||
| public void setDatasetVersionVos(List<VersionVo> datasetVersionVos) { | |||
| this.datasetVersionVos = datasetVersionVos; | |||
| } | |||
| @@ -2,9 +2,11 @@ package com.ruoyi.platform.vo; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import com.ruoyi.platform.domain.ModelsVersion; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| public class ModelsVo implements Serializable { | |||
| @@ -36,27 +38,16 @@ public class ModelsVo implements Serializable { | |||
| */ | |||
| @ApiModelProperty(name = "version") | |||
| private String version; | |||
| /** | |||
| * 模型存储地址 | |||
| */ | |||
| @ApiModelProperty(name = "url") | |||
| private String url; | |||
| /** | |||
| * 文件名 | |||
| */ | |||
| @ApiModelProperty(name = "file_name") | |||
| private String fileName; | |||
| /** | |||
| * 文件大小 | |||
| */ | |||
| @ApiModelProperty(name = "file_size") | |||
| private String fileSize; | |||
| /** | |||
| * 状态 | |||
| */ | |||
| @ApiModelProperty(name = "status") | |||
| private Integer status; | |||
| @ApiModelProperty(name = "models_version_vos") | |||
| private List<VersionVo> modelsVersionVos; | |||
| public String getName() { | |||
| return name; | |||
| @@ -107,35 +98,21 @@ public class ModelsVo implements Serializable { | |||
| this.version = version; | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| } | |||
| public void setUrl(String url) { | |||
| this.url = url; | |||
| } | |||
| public String getFileName() { | |||
| return fileName; | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setFileName(String fileName) { | |||
| this.fileName = fileName; | |||
| public void setStatus(Integer status) { | |||
| this.status = status; | |||
| } | |||
| public String getFileSize() { | |||
| return fileSize; | |||
| public List<VersionVo> getModelsVersionVos() { | |||
| return modelsVersionVos; | |||
| } | |||
| public void setFileSize(String fileSize) { | |||
| this.fileSize = fileSize; | |||
| public void setModelsVersionVos(List<VersionVo> modelsVersionVos) { | |||
| this.modelsVersionVos = modelsVersionVos; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer status) { | |||
| this.status = status; | |||
| } | |||
| } | |||
| @@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
| import java.io.Serializable; | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| public class DatasetVersionVo implements Serializable { | |||
| public class VersionVo implements Serializable { | |||
| /** | |||
| * 数据集存储地址 | |||