From 7355be9e3a399df6cf5cb87add17409cf22980f8 Mon Sep 17 00:00:00 2001 From: jialin Date: Wed, 3 Dec 2025 19:14:31 +0800 Subject: [PATCH] fix: init cluster id when deploy model --- .../seal-form/components/label-info.less | 5 ++-- .../seal-form/components/label-info.tsx | 2 +- src/config/global.d.ts | 2 +- src/layouts/extraRender.tsx | 4 +-- .../components/version-info-modal.tsx | 29 ++++++++----------- src/pages/backends/index.tsx | 13 +++++++++ src/pages/dashboard/components/over-view.less | 3 +- .../components/deploy-builtin-modal.tsx | 6 ++-- .../llmodels/components/deploy-modal.tsx | 2 +- 9 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/components/seal-form/components/label-info.less b/src/components/seal-form/components/label-info.less index cc823c20..2304830e 100644 --- a/src/components/seal-form/components/label-info.less +++ b/src/components/seal-form/components/label-info.less @@ -12,10 +12,11 @@ .note-info { margin-left: 4px; + display: flex; + align-items: center; } .star { - position: relative; - top: 2px; + font-size: 0.7rem; } } diff --git a/src/components/seal-form/components/label-info.tsx b/src/components/seal-form/components/label-info.tsx index 89d76781..c4708803 100644 --- a/src/components/seal-form/components/label-info.tsx +++ b/src/components/seal-form/components/label-info.tsx @@ -14,7 +14,7 @@ const NoteInfo: React.FC = (props) => { if (!label) return null; const renderRequiredStar = required ? ( - * + ﹡ ) : null; diff --git a/src/config/global.d.ts b/src/config/global.d.ts index dffae8ff..c799360d 100644 --- a/src/config/global.d.ts +++ b/src/config/global.d.ts @@ -23,7 +23,7 @@ declare namespace Global { require_password_change: boolean; id: number; source: string; - avatar: string; + avatar_url: string; } type EmptyObject = Record; diff --git a/src/layouts/extraRender.tsx b/src/layouts/extraRender.tsx index ce7c6ffa..1f4ea093 100644 --- a/src/layouts/extraRender.tsx +++ b/src/layouts/extraRender.tsx @@ -272,7 +272,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => { } @@ -322,7 +322,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => { } /> diff --git a/src/pages/backends/components/version-info-modal.tsx b/src/pages/backends/components/version-info-modal.tsx index 5ee32937..0c1b1e0b 100644 --- a/src/pages/backends/components/version-info-modal.tsx +++ b/src/pages/backends/components/version-info-modal.tsx @@ -1,5 +1,7 @@ import ScrollerModal from '@/components/scroller-modal'; +import { PlusOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; +import { Button } from 'antd'; import { useEffect, useState } from 'react'; import { VersionListItem } from '../config/types'; import VersionInfo from '../forms/version-info'; @@ -7,12 +9,14 @@ import VersionInfo from '../forms/version-info'; interface VersionInfoModalProps { open?: boolean; currentData?: any; + addVersion?: () => void; onClose?: () => void; } const VersionInfoModal: React.FC = ({ open, currentData, + addVersion, onClose }) => { const intl = useIntl(); @@ -55,7 +59,14 @@ const VersionInfoModal: React.FC = ({ return ( + {intl.formatMessage({ id: 'backend.versions' })} + + + } width={600} centered destroyOnHidden @@ -63,22 +74,6 @@ const VersionInfoModal: React.FC = ({ maskClosable={false} onOk={onClose} onCancel={onClose} - styles={{ - content: { - padding: '0 0 16px 0' - }, - header: { - padding: 'var(--ant-modal-content-padding)', - paddingBottom: '0' - }, - body: { - padding: '16px 24px 32px' - }, - footer: { - padding: '16px 24px', - margin: '0' - } - }} footer={null} > diff --git a/src/pages/backends/index.tsx b/src/pages/backends/index.tsx index fc1c4358..6931cba3 100644 --- a/src/pages/backends/index.tsx +++ b/src/pages/backends/index.tsx @@ -154,6 +154,18 @@ const BackendList = () => { } }; + const handleAddVersion = () => { + setOpenVersionInfoModal({ + open: false, + currentData: undefined + }); + setOpenModalStatus({ + open: true, + action: 'edit', + currentData: openVersionInfoModal.currentData + }); + }; + const loadMore = useMemoizedFn((nextPage: number) => { fetchData({ query: { @@ -226,6 +238,7 @@ const BackendList = () => { } > diff --git a/src/pages/dashboard/components/over-view.less b/src/pages/dashboard/components/over-view.less index d93ca077..c3493c3b 100644 --- a/src/pages/dashboard/components/over-view.less +++ b/src/pages/dashboard/components/over-view.less @@ -2,11 +2,12 @@ box-shadow: none !important; :global(.ant-card-body) { - height: 110px; + height: 96px; display: flex; justify-content: space-around; border-radius: var(--ant-border-radius-lg); border: 1px solid var(--ant-color-border); + padding: 16px 24px; } } diff --git a/src/pages/llmodels/components/deploy-builtin-modal.tsx b/src/pages/llmodels/components/deploy-builtin-modal.tsx index e85fe8c3..fb491201 100644 --- a/src/pages/llmodels/components/deploy-builtin-modal.tsx +++ b/src/pages/llmodels/components/deploy-builtin-modal.tsx @@ -177,9 +177,9 @@ const AddModal: React.FC = (props) => { }; const initClusterId = (): number => { - const cluster_id = clusterList?.find( - (item) => item.state === ClusterStatusValueMap.Ready - )?.value; + const cluster_id = + clusterList?.find((item) => item.state === ClusterStatusValueMap.Ready) + ?.value || clusterList?.[0]?.value; return cluster_id as number; }; diff --git a/src/pages/llmodels/components/deploy-modal.tsx b/src/pages/llmodels/components/deploy-modal.tsx index f99279c0..20b8e1d9 100644 --- a/src/pages/llmodels/components/deploy-modal.tsx +++ b/src/pages/llmodels/components/deploy-modal.tsx @@ -443,7 +443,7 @@ const AddModal: FC = (props) => { } const cluster_id = clusterList?.find((item) => item.state === ClusterStatusValueMap.Ready) - ?.value || ''; + ?.value || clusterList?.[0]?.value; return cluster_id; };