From 3a8ae0e131cb5fcccfaddb21503acddb3a7270e1 Mon Sep 17 00:00:00 2001 From: zhanchunhu <765536121@qq.com> Date: Thu, 19 Jun 2025 10:15:26 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84zip=E5=8C=85?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E5=BC=80=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/NewDatasetServiceImpl.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index d238b7b4..1b99af47 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.InputStreamResource; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -527,10 +528,21 @@ public class NewDatasetServiceImpl implements NewDatasetService { headers.put("Authorization", "Token " + labelDatasetVersionVo.getToken()); InputStream inputStream = HttpUtils.getIntputStream(labelloaclUrl + "/api/projects/" + labelDatasetVersionVo.getProjectId() + "/export?exportType=" + labelDatasetVersionVo.getExportType(), headers); - // 2. 打包成zip包 -// String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip"; - String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion(); - MultipartFile[] files = FileUtil.toMultipartFiles(inputStream, zipFileName); + // 2. 直接保存zip文件,不要重新打包 + String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip"; + + // 将InputStream转换为byte数组 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inputStream.read(buffer)) >= 0) { + baos.write(buffer, 0, length); + } + inputStream.close(); + + // 创建MultipartFile + ByteArrayResource resource = new ByteArrayResource(baos.toByteArray()); + MultipartFile[] files = new MultipartFile[]{new FileUtil.CustomMultipartFile(resource, zipFileName)}; // 3. 上传到minio List> maps = uploadDatasetlocal(files, UUID.randomUUID().toString()); From c286cd58705b200f3e155f6fc1a465445e6d5860 Mon Sep 17 00:00:00 2001 From: zhanchunhu <765536121@qq.com> Date: Thu, 19 Jun 2025 11:13:38 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/platform/utils/FileUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java index 25c3cfe5..2a4961fd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java @@ -136,12 +136,12 @@ public class FileUtil { return new MultipartFile[]{new CustomMultipartFile(resource, fileName)}; } - private static class CustomMultipartFile implements MultipartFile { + public static class CustomMultipartFile implements MultipartFile { private final ByteArrayResource resource; private final String fileName; - CustomMultipartFile(ByteArrayResource resource, String fileName) { + public CustomMultipartFile(ByteArrayResource resource, String fileName) { this.resource = resource; this.fileName = fileName; } From 156c791d578cdda8e83fa7603d6a14a0398a5347 Mon Sep 17 00:00:00 2001 From: zchzch <765536121@qq.com> Date: Fri, 20 Jun 2025 09:04:49 +0800 Subject: [PATCH 3/5] =?UTF-8?q?test=E5=88=86=E6=94=AF=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E6=92=A4=E5=9B=9E=E5=AF=BC=E5=87=BA=E5=88=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/NewDatasetServiceImpl.java | 36 ++++++++++--------- .../com/ruoyi/platform/utils/FileUtil.java | 4 +-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index ae37e1f7..2bac2cfc 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -17,7 +17,6 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.InputStreamResource; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -529,21 +528,26 @@ public class NewDatasetServiceImpl implements NewDatasetService { headers.put("Authorization", "Token " + labelDatasetVersionVo.getToken()); InputStream inputStream = HttpUtils.getIntputStream(labelloaclUrl + "/api/projects/" + labelDatasetVersionVo.getProjectId() + "/export?exportType=" + labelDatasetVersionVo.getExportType(), headers); - // 2. 直接保存zip文件,不要重新打包 - String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip"; - - // 将InputStream转换为byte数组 - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inputStream.read(buffer)) >= 0) { - baos.write(buffer, 0, length); - } - inputStream.close(); - - // 创建MultipartFile - ByteArrayResource resource = new ByteArrayResource(baos.toByteArray()); - MultipartFile[] files = new MultipartFile[]{new FileUtil.CustomMultipartFile(resource, zipFileName)}; + // 2. 打包成zip包 + // String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip"; + String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion(); + MultipartFile[] files = FileUtil.toMultipartFiles(inputStream, zipFileName); + +// // 2. 直接保存zip文件,不要重新打包 +// String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip"; +// +// // 将InputStream转换为byte数组 +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// byte[] buffer = new byte[1024]; +// int length; +// while ((length = inputStream.read(buffer)) >= 0) { +// baos.write(buffer, 0, length); +// } +// inputStream.close(); +// +// // 创建MultipartFile +// ByteArrayResource resource = new ByteArrayResource(baos.toByteArray()); +// MultipartFile[] files = new MultipartFile[]{new FileUtil.CustomMultipartFile(resource, zipFileName)}; // 3. 上传到minio List> maps = uploadDatasetlocal(files, UUID.randomUUID().toString()); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java index 2a4961fd..d900b6a1 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java @@ -136,12 +136,12 @@ public class FileUtil { return new MultipartFile[]{new CustomMultipartFile(resource, fileName)}; } - public static class CustomMultipartFile implements MultipartFile { + private static class CustomMultipartFile implements MultipartFile { private final ByteArrayResource resource; private final String fileName; - public CustomMultipartFile(ByteArrayResource resource, String fileName) { + private CustomMultipartFile(ByteArrayResource resource, String fileName) { this.resource = resource; this.fileName = fileName; } From af78389c11ed584f49d4f155271a0670f3194b46 Mon Sep 17 00:00:00 2001 From: zhaowei Date: Fri, 20 Jun 2025 13:59:20 +0800 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0=E7=89=B9=E5=BE=81?= =?UTF-8?q?=E9=A2=84=E5=A4=84=E7=90=86=E7=AE=97=E6=B3=95=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoML/components/CreateForm/utils.ts | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/react-ui/src/pages/AutoML/components/CreateForm/utils.ts b/react-ui/src/pages/AutoML/components/CreateForm/utils.ts index 16553178..51360529 100644 --- a/react-ui/src/pages/AutoML/components/CreateForm/utils.ts +++ b/react-ui/src/pages/AutoML/components/CreateForm/utils.ts @@ -42,37 +42,43 @@ export const regressorAlgorithms = [ // 特征预处理算法 export const featureAlgorithms = [ - { label: 'densifier (数据增稠)', value: 'densifier' }, + { label: 'densifier (缺失值填充)', value: 'densifier' }, { - label: 'extra_trees_preproc_for_classification (分类任务极端随机树)', + label: 'extra_trees_preproc_for_classification (特征选择-分类任务极端随机树)', value: 'extra_trees_preproc_for_classification', }, { - label: 'extra_trees_preproc_for_regression (回归任务极端随机树)', + label: 'extra_trees_preproc_for_regression (特征选择-回归任务极端随机树)', value: 'extra_trees_preproc_for_regression', }, - { label: 'fast_ica (快速独立成分分析)', value: 'fast_ica' }, - { label: 'feature_agglomeration (特征聚合)', value: 'feature_agglomeration' }, - { label: 'kernel_pca (核主成分分析)', value: 'kernel_pca' }, - { label: 'kitchen_sinks (随机特征映射)', value: 'kitchen_sinks' }, - { label: 'liblinear_svc_preprocessor (线性svc预处理器)', value: 'liblinear_svc_preprocessor' }, + { label: 'fast_ica (特征选择-快速独立成分分析)', value: 'fast_ica' }, + { label: 'feature_agglomeration (特征变换-特征聚合)', value: 'feature_agglomeration' }, + { label: 'kernel_pca (特征选择-核主成分分析)', value: 'kernel_pca' }, + { label: 'kitchen_sinks (特征变换-随机特征映射)', value: 'kitchen_sinks' }, + { + label: 'liblinear_svc_preprocessor (特征选择-线性svc预处理器)', + value: 'liblinear_svc_preprocessor', + }, { label: 'no_preprocessing (无预处理)', value: 'no_preprocessing' }, - { label: 'nystroem_sampler (尼斯特罗姆采样器)', value: 'nystroem_sampler' }, - { label: 'pca (主成分分析)', value: 'pca' }, - { label: 'polynomial (多项式特征扩展)', value: 'polynomial' }, - { label: 'random_trees_embedding (随机森林特征嵌入)', value: 'random_trees_embedding' }, + { label: 'nystroem_sampler (特征变换-尼斯特罗姆采样器)', value: 'nystroem_sampler' }, + { label: 'pca (特征选择-主成分分析)', value: 'pca' }, + { label: 'polynomial (特征变换-多项式特征扩展)', value: 'polynomial' }, + { label: 'random_trees_embedding (特征变换-随机森林特征嵌入)', value: 'random_trees_embedding' }, { - label: 'select_percentile_classification (基于百分位的分类特征选择)', + label: 'select_percentile_classification 特征选择-基于百分位的分类特征选择)', value: 'select_percentile_classification', }, { - label: 'select_percentile_regression (基于百分位的回归特征选择)', + label: 'select_percentile_regression (特征选择-基于百分位的回归特征选择)', value: 'select_percentile_regression', }, { - label: 'select_rates_classification (基于比率的分类特征选择)', + label: 'select_rates_classification (特征选择-基于比率的分类特征选择)', value: 'select_rates_classification', }, - { label: 'select_rates_regression (基于比率的回归特征选择)', value: 'select_rates_regression' }, - { label: 'truncatedSVD (截断奇异值分解)', value: 'truncatedSVD' }, + { + label: 'select_rates_regression (特征选择-基于比率的回归特征选择)', + value: 'select_rates_regression', + }, + { label: 'truncatedSVD (特征变换-截断奇异值分解)', value: 'truncatedSVD' }, ]; From 08a1d4610205f8d6fcccb93402b0c9a7a7c17dc0 Mon Sep 17 00:00:00 2001 From: zhaowei Date: Fri, 20 Jun 2025 15:51:12 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E9=9B=86=20&=20?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=8F=AF=E4=BB=A5=E7=BC=96=E8=BE=91=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EditVersionModal/index.tsx | 121 ++++++++++++++++++ .../Dataset/components/ResourceInfo/index.tsx | 21 +++ react-ui/src/pages/Dataset/config.tsx | 5 + react-ui/src/services/dataset/index.js | 17 +++ 4 files changed, 164 insertions(+) create mode 100644 react-ui/src/pages/Dataset/components/EditVersionModal/index.tsx diff --git a/react-ui/src/pages/Dataset/components/EditVersionModal/index.tsx b/react-ui/src/pages/Dataset/components/EditVersionModal/index.tsx new file mode 100644 index 00000000..f17bf404 --- /dev/null +++ b/react-ui/src/pages/Dataset/components/EditVersionModal/index.tsx @@ -0,0 +1,121 @@ +import KFModal from '@/components/KFModal'; +import { DataSource, ResourceData, ResourceType, resourceConfig } from '@/pages/Dataset/config'; +import { to } from '@/utils/promise'; +import { Form, Input, message, type ModalProps } from 'antd'; + +interface EditVersionModalProps extends Omit { + resourceType: ResourceType; + resourceVersion: ResourceData; + onOk: () => void; +} + +function EditVersionModal({ resourceType, resourceVersion, onOk, ...rest }: EditVersionModalProps) { + const config = resourceConfig[resourceType]; + const { name: resoureName, version, version_desc } = resourceVersion; + + // 修改请求 + const editDatasetVersion = async (params: any) => { + const request = config.editVersion; + const [res] = await to(request(params)); + if (res) { + message.success('编辑成功'); + onOk?.(); + } + }; + + // 提交 + const onFinish = (formData: any) => { + const params = { + ...resourceVersion, + ...formData, + [config.sourceParamKey]: DataSource.Create, + }; + editDatasetVersion(params); + }; + + const name = config.name; + + return ( + +
+ + + + { + if (value === 'master') { + return Promise.reject(`${name}版本不能为 master`); + } else if (value === 'origin') { + return Promise.reject(`${name}版本不能为 origin`); + } + return Promise.resolve(); + }, + }, + ]} + > + + + + + +
+
+ ); +} + +export default EditVersionModal; diff --git a/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx b/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx index 2f162f9b..dd5d2ff3 100644 --- a/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx @@ -23,6 +23,7 @@ import { App, Button, Flex, Select, Tabs } from 'antd'; import classNames from 'classnames'; import { useCallback, useEffect, useState } from 'react'; import AddVersionModal from '../AddVersionModal'; +import EditVersionModal from '../EditVersionModal'; import ResourceIntro from '../ResourceIntro'; import ResourceVersion from '../ResourceVersion'; import VersionCompareModal from '../VersionCompareModal'; @@ -132,6 +133,18 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { }); }; + // 版本编辑 + const showEditVersionModal = () => { + const { close } = openAntdModal(EditVersionModal, { + resourceType: resourceType, + resourceVersion: info, + onOk: () => { + getResourceDetail(); + close(); + }, + }); + }; + // 选择版本 const showVersionSelector = () => { const { close } = openAntdModal(VersionSelectorModal, { @@ -291,6 +304,14 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { +