From 5fe010f52d96625217e09065b41069558b08500e Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Wed, 21 May 2025 16:34:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=9C=8D=E5=8A=A1=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=B8=AD=E6=89=8D=E6=98=BE=E7=A4=BA=E9=A2=84?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResourceSelectorModal/config.tsx | 8 +++--- .../ModelDeployment/VersionInfo/index.tsx | 28 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/react-ui/src/components/ResourceSelectorModal/config.tsx b/react-ui/src/components/ResourceSelectorModal/config.tsx index 20687713..80d69904 100644 --- a/react-ui/src/components/ResourceSelectorModal/config.tsx +++ b/react-ui/src/components/ResourceSelectorModal/config.tsx @@ -24,11 +24,11 @@ export enum ResourceSelectorType { } // 数据集、模型列表转为树形结构 -const convertDatasetToTreeData = (list: ResourceData[]): TreeDataNode[] => { +const convertDatasetToTreeData = (list: ResourceData[], isPublic: boolean): TreeDataNode[] => { return list.map((v) => ({ ...v, key: `${v.id}`, - title: v.name, + title: isPublic ? `${v.name} (${v.owner})` : v.name, isLeaf: false, checkable: false, })); @@ -106,7 +106,7 @@ export class DatasetSelector implements SelectorTypeInfo { const res = await getDatasetList({ is_public: isPublic, page: 0, size: 2000 }); if (res && res.data) { const list = res.data.content || []; - return convertDatasetToTreeData(list); + return convertDatasetToTreeData(list, isPublic); } else { return Promise.reject('获取数据集列表失败'); } @@ -158,7 +158,7 @@ export class ModelSelector implements SelectorTypeInfo { const res = await getModelList({ is_public: isPublic, page: 0, size: 2000 }); if (res && res.data) { const list = res.data.content || []; - return convertDatasetToTreeData(list); + return convertDatasetToTreeData(list, isPublic); } else { return Promise.reject('获取模型列表失败'); } diff --git a/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx b/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx index 3232add1..6cabf87a 100644 --- a/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx +++ b/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx @@ -6,6 +6,7 @@ import FullScreenFrame from '@/components/FullScreenFrame'; import KFIcon from '@/components/KFIcon'; import PageTitle from '@/components/PageTitle'; +import { ServiceRunStatus } from '@/enums'; import { getServiceVersionInfoReq } from '@/services/modelDeployment'; import { to } from '@/utils/promise'; import { useParams } from '@umijs/max'; @@ -50,18 +51,6 @@ function ServiceVersionInfo() { icon: , children: , }, - { - key: ModelDeploymentTabKey.Predict, - label: '预测', - icon: , - children: ( -
- {versionInfo?.page_path && ( - - )} -
- ), - }, { key: ModelDeploymentTabKey.Guide, label: '调用指南', @@ -76,6 +65,21 @@ function ServiceVersionInfo() { }, ]; + if (versionInfo?.run_state === ServiceRunStatus.Running) { + tabItems.splice(1, 0, { + key: ModelDeploymentTabKey.Predict, + label: '预测', + icon: , + children: ( +
+ {versionInfo?.page_path && ( + + )} +
+ ), + }); + } + return (
From 14a96291671906913e321aea10452aa9a70aaea2 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Wed, 21 May 2025 17:05:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0iframe=20=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/components/IFramePage/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/react-ui/src/components/IFramePage/index.tsx b/react-ui/src/components/IFramePage/index.tsx index a087da42..53629ce6 100644 --- a/react-ui/src/components/IFramePage/index.tsx +++ b/react-ui/src/components/IFramePage/index.tsx @@ -83,15 +83,21 @@ function IframePage({ type, openInTab = false, className, style }: IframePagePro requestIframeUrl(); }, [type]); - const hideLoading = () => { + const handleLoad = () => { // setLoading(false); Loading.hide(); }; + const handleError = (error?: React.SyntheticEvent) => { + // setLoading(false); + console.log('error', error); + Loading.hide(); + }; + return (
{/* {loading && createPortal(, document.body)} */} - + {openInTab && window.open(iframeUrl, '_blank')} />}
);