diff --git a/src/components/seal-form/components/not-found-content.tsx b/src/components/seal-form/components/not-found-content.tsx index 63e95c40..e1312d3c 100644 --- a/src/components/seal-form/components/not-found-content.tsx +++ b/src/components/seal-form/components/not-found-content.tsx @@ -35,6 +35,7 @@ const NotFoundContent: React.FC<{ {notFoundContent || ( diff --git a/src/locales/zh-CN/no-result.ts b/src/locales/zh-CN/no-result.ts index 5f8c68ed..1e69f503 100644 --- a/src/locales/zh-CN/no-result.ts +++ b/src/locales/zh-CN/no-result.ts @@ -22,9 +22,9 @@ export default { 'noresult.cluster.title': '暂无集群', 'noresult.cluster.subTitle': '尚未添加任何集群。', 'noresult.cluster.nofound': '未找到匹配的集群', - 'noresult.credentials.title': '暂无凭据', - 'noresult.credentials.subTitle': '尚未添加任何凭据。', - 'noresult.credentials.nofound': '未找到匹配的凭据', + 'noresult.credentials.title': '暂无凭证', + 'noresult.credentials.subTitle': '尚未添加任何凭证。', + 'noresult.credentials.nofound': '未找到匹配的凭证', 'noresult.users.title': '暂无用户', 'noresult.users.subTitle': '尚未添加任何用户。', 'noresult.users.nofound': '未找到匹配的用户', diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 1f19a173..9e123808 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -608,7 +608,7 @@ const Models: React.FC = ({ > } placeholder={intl.formatMessage({ id: 'common.filter.name' })} - style={{ width: 160 }} + style={{ width: 200 }} size="large" allowClear onChange={handleNameChange} diff --git a/src/pages/llmodels/forms/index.tsx b/src/pages/llmodels/forms/index.tsx index 638f8d32..3751ec82 100644 --- a/src/pages/llmodels/forms/index.tsx +++ b/src/pages/llmodels/forms/index.tsx @@ -30,6 +30,8 @@ import BasicForm from './basic'; import Performance from './performance'; import ScheduleTypeForm from './schedule-type'; +const baseRequiredFields = ['name', 'source']; + const advancedRequiredFields = ['backend', 'image_name', 'run_command']; const scheduleRequiredFields = ['gpu_selector']; @@ -96,24 +98,31 @@ const DataForm: React.FC = forwardRef((props, ref) => { const scheduleType = Form.useWatch('scheduleType', form); const [target, setTarget] = React.useState('basic'); + const TABKeysMap = { + BASIC: 'basic', + SCHEDULING: 'scheduling', + PERFORMANCE: 'performance', + ADVANCED: 'advanced' + }; + const segmentOptions = [ { - value: 'basic', + value: TABKeysMap.BASIC, label: intl.formatMessage({ id: 'common.title.basicInfo' }), field: 'name' }, { - value: 'scheduling', + value: TABKeysMap.SCHEDULING, label: intl.formatMessage({ id: 'models.form.scheduling' }), field: 'scheduleType' }, { - value: 'performance', + value: TABKeysMap.PERFORMANCE, label: intl.formatMessage({ id: 'models.form.performance' }), field: 'extended_kv_cache.enabled' }, { - value: 'advanced', + value: TABKeysMap.ADVANCED, label: intl.formatMessage({ id: 'resources.form.advanced' }), field: 'categories' } @@ -266,6 +275,12 @@ const DataForm: React.FC = forwardRef((props, ref) => { setActiveKey(Array.isArray(keys) ? keys : [keys]); }; + const handleTargetChange = async (val: any) => { + setTarget(val); + + await scrollToSegment(val, { offsetTop: SegmentedTop.offsetTop }); + }; + const handleOnFinishFailed = (errorInfo: any) => { const { errorFields } = errorInfo; if (errorFields && errorFields.length > 0) { @@ -283,16 +298,35 @@ const DataForm: React.FC = forwardRef((props, ref) => { scheduleRequiredFields.includes(name) ); + const isBaseRequired = names.some((name: string) => + baseRequiredFields.includes(name) + ); + if (isScheduleRequired) { - collapseKeys.push('scheduling'); + collapseKeys.push(TABKeysMap.SCHEDULING); } if (isPerformanceRequired) { - collapseKeys.push('performance'); + collapseKeys.push(TABKeysMap.PERFORMANCE); } if (isAdvancedRequired) { - collapseKeys.push('advanced'); + collapseKeys.push(TABKeysMap.ADVANCED); + } + + if (isBaseRequired) { + handleTargetChange(TABKeysMap.BASIC); + } else if (isScheduleRequired) { + handleTargetChange(TABKeysMap.SCHEDULING); + } else if (isPerformanceRequired) { + handleTargetChange(TABKeysMap.PERFORMANCE); + } else if (isAdvancedRequired && formKey === DeployFormKeyMap.CATALOG) { + handleTargetChange(TABKeysMap.ADVANCED); + } else if ( + isAdvancedRequired && + formKey === DeployFormKeyMap.DEPLOYMENT + ) { + handleTargetChange(TABKeysMap.BASIC); } setActiveKey((prev: string[]) => [ @@ -301,12 +335,6 @@ const DataForm: React.FC = forwardRef((props, ref) => { } }; - const handleTargetChange = async (val: any) => { - setTarget(val); - - await scrollToSegment(val, { offsetTop: SegmentedTop.offsetTop }); - }; - useImperativeHandle(ref, () => { return { form: form, @@ -408,19 +436,19 @@ const DataForm: React.FC = forwardRef((props, ref) => { onChange={handleOnCollapseChange} items={[ { - key: 'scheduling', + key: TABKeysMap.SCHEDULING, label: intl.formatMessage({ id: 'models.form.scheduling' }), forceRender: true, children: }, { - key: 'performance', + key: TABKeysMap.PERFORMANCE, label: intl.formatMessage({ id: 'models.form.performance' }), forceRender: true, children: }, { - key: 'advanced', + key: TABKeysMap.ADVANCED, label: intl.formatMessage({ id: 'resources.form.advanced' }), forceRender: true, children: diff --git a/src/pages/llmodels/user-models.tsx b/src/pages/llmodels/user-models.tsx index 279df5e6..2c6346d2 100644 --- a/src/pages/llmodels/user-models.tsx +++ b/src/pages/llmodels/user-models.tsx @@ -172,19 +172,10 @@ const UserModels: React.FC = () => { }, [dataSource.dataList, status]); return ( - + = ({ platform }) => { - const intl = useIntl(); - const labels = useMemo( - () => ({ - step1: intl.formatMessage({ id: 'resources.worker.add.step1' }), - step2: intl.formatMessage({ id: 'resources.worker.add.step2' }), - step2Tips: intl.formatMessage({ id: 'resources.worker.add.step2.tips' }), - step3: intl.formatMessage({ id: 'resources.worker.add.step3' }), - linuxOrMac: intl.formatMessage({ id: 'resources.worker.linuxormaxos' }) - }), - [intl] - ); - return ( -
-

- 1.{' '} - {intl.formatMessage( - { id: 'resources.register.install.title' }, - { os: platform.os } - )} -

- - - -

- 2. -

- -
- - - -
-
-

- 3. {labels.step2}{' '} - -

- -
- - {registerWorkerSteps.map((step, index) => ( - - {index + 1}.{' '} - - - ))} - -
-
-

4. {labels.step3}

-
- ); -}; - -export default AddWorkerMacOS; diff --git a/src/pages/resources/components/container-install.tsx b/src/pages/resources/components/container-install.tsx deleted file mode 100644 index e822ea47..00000000 --- a/src/pages/resources/components/container-install.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { GPUStackVersionAtom } from '@/atoms/user'; -import { getAtomStorage } from '@/atoms/utils'; -import HighlightCode from '@/components/highlight-code'; -import CommandViewer from '@/pages/_components/command-viewer'; -import { useIntl } from '@umijs/max'; -import { Radio } from 'antd'; -import React from 'react'; -import { addWorkerGuide, containerInstallOptions } from '../config'; -import './styles/installation.less'; - -type ViewModalProps = { - registrationInfo: { - token: string; - image: string; - server_url: string; - }; -}; - -const npuOptions = [ - { label: '910B', value: 'npu' }, - { label: '310P', value: 'npu310p' } -]; - -const AddWorker: React.FC = (props) => { - const { registrationInfo } = props || {}; - const intl = useIntl(); - - const origin = window.location.origin; - const [activeKey, setActiveKey] = React.useState('cuda'); - const [npuKey, setNpuKey] = React.useState('npu'); - const versionInfo = getAtomStorage(GPUStackVersionAtom); - - const code = React.useMemo(() => { - let version = versionInfo?.version; - if (!version || !versionInfo.isProduction) { - version = 'main'; - } - - let commandCode = addWorkerGuide[activeKey]; - - if (npuKey === 'npu310p' && activeKey === 'npu') { - commandCode = addWorkerGuide[npuKey]; - } - - const tag = activeKey === 'cuda' ? version : `${version}-${activeKey}`; - - return commandCode?.registerWorker({ - server: registrationInfo.server_url || origin, - tag: tag, - image: registrationInfo.image, - token: registrationInfo.token || '${token}', - workerip: '${workerip}' - }); - }, [ - versionInfo, - activeKey, - registrationInfo.token, - registrationInfo.server_url, - npuKey - ]); - - const handleOnChange = (value: string | number) => { - setNpuKey(value as string); - }; - - return ( -
-

- 1. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '} - -

-
- setActiveKey(e.target.value)} - size="small" - /> -
- {activeKey === 'npu' && ( -
- )} - {activeKey === 'npu' ? ( - - ) : ( - - )} -

- 2. {intl.formatMessage({ id: 'resources.worker.add.step3' })} -

-
- ); -}; - -export default AddWorker; diff --git a/src/pages/resources/components/gpus.tsx b/src/pages/resources/components/gpus.tsx index 14aa7c18..1ab31413 100644 --- a/src/pages/resources/components/gpus.tsx +++ b/src/pages/resources/components/gpus.tsx @@ -18,6 +18,7 @@ const GPUList: React.FC = () => { extraStatus, handlePageChange, handleTableChange, + handleQueryChange, handleSearch, handleNameChange } = useTableFetch({ @@ -44,6 +45,13 @@ const GPUList: React.FC = () => { } }; + const handleClusterChange = (value: number) => { + handleQueryChange({ + page: 1, + cluster_id: value + }); + }; + const renderEmpty = (type?: string) => { if (type !== 'Table') return; return ( @@ -79,13 +87,16 @@ const GPUList: React.FC = () => { = (props) => { - const intl = useIntl(); - - const origin = window.location.origin; - - const labels = useMemo( - () => ({ - step1: intl.formatMessage({ id: 'resources.worker.add.step1' }), - step2: intl.formatMessage({ id: 'resources.worker.add.step2' }), - step2Tips: intl.formatMessage({ id: 'resources.worker.add.step2.tips' }), - step3: intl.formatMessage({ id: 'resources.worker.add.step3' }), - linuxOrMac: intl.formatMessage({ id: 'resources.worker.linuxormaxos' }) - }), - [intl] - ); - - return ( -
-

- 1. -

-

{labels.linuxOrMac}

- -

Windows

- -

- 2. {labels.step2}{' '} - -

-

{labels.linuxOrMac}

- -

Windows

- -

3. {labels.step3}

-
- ); -}; - -export default AddWorker; diff --git a/src/pages/resources/components/workers.tsx b/src/pages/resources/components/workers.tsx index c8833130..51959a72 100644 --- a/src/pages/resources/components/workers.tsx +++ b/src/pages/resources/components/workers.tsx @@ -226,19 +226,7 @@ const Workers: React.FC = () => { return ( <> - - ]} - > + { setWorkerDetailStatus({ currentData: null, open: false }) } /> + );