fix: 修复实验对比点击面包屑报错

This commit is contained in:
赵伟 2026-03-15 10:23:51 +08:00
parent 52d6dfeca4
commit 9c19de5d73
5 changed files with 14 additions and 13 deletions

View File

@ -163,7 +163,7 @@ export default [
},
{
name: '实验对比',
path: 'compare',
path: 'compare/:id/:type',
routes: [
{
name: '实验对比',
@ -888,7 +888,7 @@ export default [
},
{
name: '实验对比',
path: 'compare',
path: 'compare/:id/:type',
routes: [
{
name: '实验对比',

View File

@ -1,6 +1,6 @@
export enum ComparisonType {
Train = 'Train', // 训练
Evaluate = 'Evaluate', // 评估
Train = 'train', // 训练
Evaluate = 'evaluate', // 评估
}
type ComparisonTypeInfo = {

View File

@ -14,7 +14,7 @@ import { tableSorter } from '@/utils';
import { to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage';
import tableCellRender, { TableCellValueType } from '@/utils/table';
import { useNavigate, useSearchParams } from '@umijs/max';
import { useNavigate, useParams } from '@umijs/max';
import { App, Button, Table, TablePaginationConfig, TableProps } from 'antd';
import classNames from 'classnames';
import { useEffect, useMemo, useState } from 'react';
@ -35,9 +35,8 @@ type TableData = {
};
function ExperimentComparison() {
const [searchParams] = useSearchParams();
const comparisonType = searchParams.get('type') as ComparisonType;
const experimentId = searchParams.get('id');
const { type, id: experimentId } = useParams();
const comparisonType = type as ComparisonType;
const [tableData, setTableData] = useState<TableData[]>([]);
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [total, setTotal] = useState(0);
@ -152,7 +151,7 @@ function ExperimentComparison() {
render: ExperimentStatusCell,
},
{
title: `${config.title}数据集`,
title: `${config?.title ?? ''}数据集`,
dataIndex: 'dataset',
key: 'dataset',
width: 180,
@ -163,7 +162,7 @@ function ExperimentComparison() {
],
},
{
title: `${config.title}参数`,
title: `${config?.title ?? ''}参数`,
align: 'center',
children: paramsNames.map((name) => ({
title: <TableColTitle title={name} />,
@ -177,7 +176,7 @@ function ExperimentComparison() {
})),
},
{
title: `${config.title}指标`,
title: `${config?.title ?? ''}指标`,
align: 'center',
children: metricsNames.map((name) => ({
title: <TableColTitle title={name} />,

View File

@ -468,8 +468,8 @@ function Experiment() {
key: ComparisonType.Evaluate,
},
],
onClick: ({ key }) => {
navigateToUrl(`/pipeline/experiment/compare?type=${key}&id=${experimentId}`);
onClick: ({ key: type }) => {
navigateToUrl(`/pipeline/experiment/compare/${experimentId}/${type}`);
},
};
};

View File

@ -209,12 +209,14 @@ export async function downloadFileWithChunks(
maxConcurrent: 6,
onProgress: onProgress,
onComplete: (blob) => {
message.destroy();
message.success('下载成功');
onComplete?.();
saveFile(blob, filename ?? 'file');
},
onError: (error) => {
onError?.();
message.destroy();
message.error(error.message ?? '下载失败');
},
});