diff --git a/config/routes.ts b/config/routes.ts
index 003df2c5..3f1c0ed5 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -115,7 +115,7 @@ export default [
defaultIcon: 'icon-backend',
access: 'canSeeAdmin',
subMenu: ['/models/backends/create'],
- component: './backends/list'
+ component: './backends/index'
}
]
},
diff --git a/src/components/collapse-container/index.tsx b/src/components/collapse-container/index.tsx
index 67af3c51..8255755c 100644
--- a/src/components/collapse-container/index.tsx
+++ b/src/components/collapse-container/index.tsx
@@ -79,6 +79,11 @@ export interface CollapsibleContainerProps {
variant?: 'outlined' | 'borderless' | undefined;
className?: string;
children?: React.ReactNode;
+ styles?: {
+ body?: React.CSSProperties;
+ header?: React.CSSProperties;
+ content?: React.CSSProperties;
+ };
}
export default function CollapsibleContainer({
@@ -94,6 +99,7 @@ export default function CollapsibleContainer({
variant = 'borderless',
className = '',
collapsible,
+ styles: cardStyles,
children
}: CollapsibleContainerProps) {
const { styles } = useStyles();
@@ -169,7 +175,11 @@ export default function CollapsibleContainer({
variant={variant}
styles={{
body: {
- padding: 0
+ padding: 0,
+ ...cardStyles?.body
+ },
+ header: {
+ ...cardStyles?.header
}
}}
title={renderTitle()}
@@ -181,7 +191,7 @@ export default function CollapsibleContainer({
overflow: 'hidden'
}}
>
-
{children}
+ {children}
);
diff --git a/src/locales/en-US/backends.ts b/src/locales/en-US/backends.ts
index e4eeb76e..7bd6fa91 100644
--- a/src/locales/en-US/backends.ts
+++ b/src/locales/en-US/backends.ts
@@ -1,3 +1,26 @@
export default {
- 'backends.title': 'Inference Backends'
+ 'backends.title': 'Inference Backends',
+ 'backend.button.add': 'Add Backend',
+ 'backend.button.edit': 'Edit Backend',
+ 'backend.versions': 'Version List',
+ 'backend.defaultVersion': 'Default Version',
+ 'backend.version': 'Version',
+ 'backend.imageName': 'Image Name',
+ 'backend.runCommand': 'Execution Command',
+ 'backend.framework': 'Framework',
+ 'backend.builtin': 'Built-in',
+ 'backend.custom': 'Custom',
+ 'backend.isDefault': 'Default',
+ 'backend.availableFrameworks': 'Available Frameworks',
+ 'backend.addVersion': 'Add Version',
+ 'backend.filter.framework': 'Filter by Framework',
+ 'backend.export.yaml': 'Export YAML',
+ 'backend.mode.form': 'Form Mode',
+ 'backend.mode.yaml': 'YAML Mode',
+ 'backend.form.healthCheckPath': 'Health Check Path',
+ 'backend.form.defaultExecuteCommand': 'Default Execution Command',
+ 'backend.form.defaultBackendParameters': 'Default Backend Parameters',
+ 'backend.form.versionConfig': 'Versions Config',
+ 'backend.form.addParameter': 'Add Parameter',
+ 'backend.form.noVersion': 'No versions added'
};
diff --git a/src/locales/ja-JP/backends.ts b/src/locales/ja-JP/backends.ts
index e4eeb76e..7bd6fa91 100644
--- a/src/locales/ja-JP/backends.ts
+++ b/src/locales/ja-JP/backends.ts
@@ -1,3 +1,26 @@
export default {
- 'backends.title': 'Inference Backends'
+ 'backends.title': 'Inference Backends',
+ 'backend.button.add': 'Add Backend',
+ 'backend.button.edit': 'Edit Backend',
+ 'backend.versions': 'Version List',
+ 'backend.defaultVersion': 'Default Version',
+ 'backend.version': 'Version',
+ 'backend.imageName': 'Image Name',
+ 'backend.runCommand': 'Execution Command',
+ 'backend.framework': 'Framework',
+ 'backend.builtin': 'Built-in',
+ 'backend.custom': 'Custom',
+ 'backend.isDefault': 'Default',
+ 'backend.availableFrameworks': 'Available Frameworks',
+ 'backend.addVersion': 'Add Version',
+ 'backend.filter.framework': 'Filter by Framework',
+ 'backend.export.yaml': 'Export YAML',
+ 'backend.mode.form': 'Form Mode',
+ 'backend.mode.yaml': 'YAML Mode',
+ 'backend.form.healthCheckPath': 'Health Check Path',
+ 'backend.form.defaultExecuteCommand': 'Default Execution Command',
+ 'backend.form.defaultBackendParameters': 'Default Backend Parameters',
+ 'backend.form.versionConfig': 'Versions Config',
+ 'backend.form.addParameter': 'Add Parameter',
+ 'backend.form.noVersion': 'No versions added'
};
diff --git a/src/locales/ru-RU/backends.ts b/src/locales/ru-RU/backends.ts
index e4eeb76e..7bd6fa91 100644
--- a/src/locales/ru-RU/backends.ts
+++ b/src/locales/ru-RU/backends.ts
@@ -1,3 +1,26 @@
export default {
- 'backends.title': 'Inference Backends'
+ 'backends.title': 'Inference Backends',
+ 'backend.button.add': 'Add Backend',
+ 'backend.button.edit': 'Edit Backend',
+ 'backend.versions': 'Version List',
+ 'backend.defaultVersion': 'Default Version',
+ 'backend.version': 'Version',
+ 'backend.imageName': 'Image Name',
+ 'backend.runCommand': 'Execution Command',
+ 'backend.framework': 'Framework',
+ 'backend.builtin': 'Built-in',
+ 'backend.custom': 'Custom',
+ 'backend.isDefault': 'Default',
+ 'backend.availableFrameworks': 'Available Frameworks',
+ 'backend.addVersion': 'Add Version',
+ 'backend.filter.framework': 'Filter by Framework',
+ 'backend.export.yaml': 'Export YAML',
+ 'backend.mode.form': 'Form Mode',
+ 'backend.mode.yaml': 'YAML Mode',
+ 'backend.form.healthCheckPath': 'Health Check Path',
+ 'backend.form.defaultExecuteCommand': 'Default Execution Command',
+ 'backend.form.defaultBackendParameters': 'Default Backend Parameters',
+ 'backend.form.versionConfig': 'Versions Config',
+ 'backend.form.addParameter': 'Add Parameter',
+ 'backend.form.noVersion': 'No versions added'
};
diff --git a/src/locales/zh-CN/backends.ts b/src/locales/zh-CN/backends.ts
index a2ae7ed9..a20c8468 100644
--- a/src/locales/zh-CN/backends.ts
+++ b/src/locales/zh-CN/backends.ts
@@ -1,3 +1,26 @@
export default {
- 'backends.title': '推理后端'
+ 'backends.title': '推理后端',
+ 'backend.button.add': '添加后端',
+ 'backend.button.edit': '编辑后端',
+ 'backend.versions': '版本列表',
+ 'backend.defaultVersion': '默认版本',
+ 'backend.version': '版本',
+ 'backend.imageName': '镜像名称',
+ 'backend.runCommand': '执行命令',
+ 'backend.framework': '框架',
+ 'backend.builtin': '内置',
+ 'backend.custom': '自定义',
+ 'backend.isDefault': '默认',
+ 'backend.availableFrameworks': '可用框架',
+ 'backend.addVersion': '添加版本',
+ 'backend.filter.framework': '按框架过滤',
+ 'backend.export.yaml': '导出 YAML',
+ 'backend.mode.form': '表单模式',
+ 'backend.mode.yaml': 'YAML 模式',
+ 'backend.form.healthCheckPath': '健康检查路径',
+ 'backend.form.defaultExecuteCommand': '默认执行命令',
+ 'backend.form.defaultBackendParameters': '默认后端参数',
+ 'backend.form.versionConfig': '版本配置',
+ 'backend.form.addParameter': '添加参数',
+ 'backend.form.noVersion': '尚未添加版本'
};
diff --git a/src/pages/backends/components/add-modal.tsx b/src/pages/backends/components/add-modal.tsx
index 8b86d2ea..5ad8d893 100644
--- a/src/pages/backends/components/add-modal.tsx
+++ b/src/pages/backends/components/add-modal.tsx
@@ -67,7 +67,6 @@ const AddModal: React.FC = (props) => {
};
const onFinish = (values: FormData) => {
- console.log('Form values:', values);
const versionConfigs = values.version_configs?.reduce(
(acc: Record, curr) => {
if (curr.version_no) {
@@ -176,12 +175,12 @@ const AddModal: React.FC = (props) => {
onChange={(value) => setActiveKey(value as string)}
options={[
{
- label: 'Form',
+ label: intl.formatMessage({ id: 'backend.mode.form' }),
value: 'form',
icon:
},
{
- label: 'YAML',
+ label: intl.formatMessage({ id: 'backend.mode.yaml' }),
value: 'yaml',
icon:
}
@@ -207,7 +206,7 @@ const AddModal: React.FC = (props) => {
items={[
{
key: 'form',
- label: 'Form',
+ label: intl.formatMessage({ id: 'backend.mode.form' }),
children: (
= (props) => {
},
{
key: 'yaml',
- label: 'YAML',
+ label: intl.formatMessage({ id: 'backend.mode.yaml' }),
children: (
= ({ data, onSelect }) => {
+ const intl = useIntl();
+
const handleOnSelect = (item: any) => {
onSelect?.({ action: item.key, data: data });
};
const handleClick = () => {
- onSelect?.({ action: 'edit', data: data });
+ onSelect?.({ action: 'view_versions', data: data });
};
const renderIcon = () => {
@@ -133,28 +151,30 @@ const BackendCard: React.FC = ({ data, onSelect }) => {
e.stopPropagation();
};
- const renderDrivers = () => {
- if (data.is_build_in) {
- const backendList = _.get(
- data,
- [
- 'build_in_version_configs',
- data.default_version,
- 'build_in_frameworks'
- ],
- []
- );
+ const renderFrameworks = () => {
+ const frameworks = _.keys(data.framework_index_map || {});
- return (
- <>
-
-
- Supported Frameworks:
+ return (
+
+
+
+
+ {intl.formatMessage({ id: 'backend.availableFrameworks' })}:{' '}
-
-
- {_.take(backendList, 3).map((item: string) => {
- return (
+
+
+
+ {_.take(frameworks, 3).map((item: string) => {
+ return (
+
+
= ({ data, onSelect }) => {
>
{item}
- );
- })}
-
-
- >
- );
- }
- return (
- <>
-
-
- Default Image:
-
-
-
- {_.get(data, [
- 'version_configs',
- data.default_version,
- 'image_name'
- ])}
-
-
- >
+
+
+ );
+ })}
+
+
);
};
@@ -194,7 +197,7 @@ const BackendCard: React.FC = ({ data, onSelect }) => {
clickable={true}
hoverable={true}
disabled={false}
- height={160}
+ height={140}
ghost
header={
+ }
+ value={defaultVersion}
+ notFoundContent={
+
+ }
+ placeholder={intl.formatMessage({ id: 'backend.version' })}
+ options={validVersions}
+ style={{ width: 200, fontWeight: 400 }}
+ allowClear
+ onChange={handleDefaultChange}
+ />
+ )}
+
-
- Versions Config
-
-
- {buildInVersionConfigs?.map((item: any, index: number) => (
- <>
-
-
-
-
- >
- ))}
- {version_configs?.map((item: any, index: number) => (
- <>
-
- Version:
- {item.version_no}
-
- }
- subtitle={
- item.image_name && (
-
- Image:
-
- {item.image_name}
-
-
- )
- }
- onToggle={(open) => onToggle(open, index)}
- deleteBtn={false}
- right={
-
- e.stopPropagation()}
- >
- {!currentData?.is_build_in && (
-
-
- handleSetDefaultVersion(e, index)
- }
- >
- Default Version
-
-
- )}
-
- {(version_configs.length > 1 || currentData?.is_build_in) && (
-
- )}
-
- }
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {index < version_configs.length - 1 && (
-
+ {(
+ fields: Array<{ key: React.Key; name: number }>,
+ { add, remove }
+ ) => {
+ const versionConfigs = form.getFieldValue('version_configs');
+ return fields?.map(({ key, name }) => (
+
- )}
- >
- ))}
+ >
+
+
+ {intl.formatMessage({ id: 'backend.version' })}:
+
+ {versionConfigs[name]?.version_no}
+ {versionConfigs[name]?.is_default && (
+
+ {intl.formatMessage({ id: 'backend.isDefault' })}
+
+ )}
+
+ }
+ onToggle={(open) => onToggle(open, name)}
+ deleteBtn={false}
+ right={
+
+ e.stopPropagation()}
+ >
+ {!currentData?.is_build_in && (
+
+ )}
+
+ {(fields.length > 1 || currentData?.is_build_in) && (
+
+ )}
+
+ }
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ));
+ }}
+
>
);
diff --git a/src/pages/backends/list.tsx b/src/pages/backends/index.tsx
similarity index 89%
rename from src/pages/backends/list.tsx
rename to src/pages/backends/index.tsx
index af02e927..bae65489 100644
--- a/src/pages/backends/list.tsx
+++ b/src/pages/backends/index.tsx
@@ -17,7 +17,7 @@ import {
} from './apis';
import AddModal from './components/add-modal';
import BackendCardList from './components/backend-list';
-import ViewBuiltinVersionsModal from './components/view-builtin-versions-modal';
+import VersionInfoModal from './components/version-info-modal';
import { json2Yaml, yaml2Json } from './config';
import { FormData, ListItem } from './config/types';
import useExportYAML from './hooks/use-export-yaml';
@@ -54,11 +54,10 @@ const BackendList = () => {
action: PageActionType;
currentData?: Partial;
}>({ open: false, action: 'create' });
- const [openViewBuiltinVersionsModal, setOpenViewBuiltinVersionsModal] =
- useState<{
- open: boolean;
- currentData?: Partial;
- }>({ open: false });
+ const [openVersionInfoModal, setOpenVersionInfoModal] = useState<{
+ open: boolean;
+ currentData?: Partial;
+ }>({ open: false });
// build_in_version_configs is read-only, but needs to be included when updating
const handleOnSubmit = async (values: FormData) => {
@@ -133,10 +132,9 @@ const BackendList = () => {
});
} else if (item.action === 'export') {
// Export YAML action
- console.log('Export YAML for:', item.data);
exportYAML(item.data);
} else if (item.action === 'view_versions') {
- setOpenViewBuiltinVersionsModal({
+ setOpenVersionInfoModal({
open: true,
currentData: item.data
});
@@ -156,13 +154,14 @@ const BackendList = () => {
extra={[]}
>
{
open={openModalStatus.open}
title={
openModalStatus.action === 'create'
- ? 'Create Backend'
- : 'Edit Backend'
+ ? intl.formatMessage({ id: 'backend.button.add' })
+ : intl.formatMessage({ id: 'backend.button.edit' })
}
>
-
- setOpenViewBuiltinVersionsModal({
+ setOpenVersionInfoModal({
open: false,
currentData: undefined
})
}
- >
+ >
);
diff --git a/src/pages/cluster-management/components/support-gpus.tsx b/src/pages/cluster-management/components/support-gpus.tsx
index a0aa045f..a3439b21 100644
--- a/src/pages/cluster-management/components/support-gpus.tsx
+++ b/src/pages/cluster-management/components/support-gpus.tsx
@@ -35,7 +35,7 @@ const SupportedHardware: React.FC = ({
const supportedHardPlatforms = [
{
- label: 'Nvidia',
+ label: 'NVIDIA',
value: 'cuda',
description: '',
key: 'cuda',
diff --git a/src/pages/llmodels/apis/index.ts b/src/pages/llmodels/apis/index.ts
index cf3f5af9..7131cacc 100644
--- a/src/pages/llmodels/apis/index.ts
+++ b/src/pages/llmodels/apis/index.ts
@@ -399,7 +399,7 @@ export async function evaluationsModelSpec(
};
}
-export async function queryBackendList() {
+export async function queryBackendList(params?: { cluster_id: number }) {
return request<{
items: {
backend_name: string;
@@ -410,6 +410,7 @@ export async function queryBackendList() {
versions: string[];
}[];
}>(BACKEND_LIST_API, {
- method: 'GET'
+ method: 'GET',
+ params
});
}
diff --git a/src/pages/llmodels/components/deploy-builtin-modal.tsx b/src/pages/llmodels/components/deploy-builtin-modal.tsx
index d31f768b..1e8b091b 100644
--- a/src/pages/llmodels/components/deploy-builtin-modal.tsx
+++ b/src/pages/llmodels/components/deploy-builtin-modal.tsx
@@ -245,6 +245,7 @@ const AddModal: React.FC = (props) => {
return result;
};
+ // TODO need check the backend is available
const handleSetBackendOptions = () => {
const backendGroup = _.groupBy(specListRef.current, 'backend');
@@ -495,6 +496,9 @@ const AddModal: React.FC = (props) => {
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
});
+ form.current?.getBackendOptions?.({
+ cluster_id: initClusterId()
+ });
}, 100);
}
return () => {
@@ -596,7 +600,6 @@ const AddModal: React.FC = (props) => {
isGGUF={isGGUF}
formKey={deployFormKeyMap.catalog}
sourceDisable={false}
- backendOptions={backendList}
sourceList={sourceList}
clusterList={clusterList}
onBackendChange={handleBackendChange}
diff --git a/src/pages/llmodels/components/deploy-modal.tsx b/src/pages/llmodels/components/deploy-modal.tsx
index c1db2b83..51c98a0c 100644
--- a/src/pages/llmodels/components/deploy-modal.tsx
+++ b/src/pages/llmodels/components/deploy-modal.tsx
@@ -10,7 +10,7 @@ import styled from 'styled-components';
import ColumnWrapper from '../../_components/column-wrapper';
import { defaultFormValues, deployFormKeyMap, modelSourceMap } from '../config';
import { backendOptionsMap } from '../config/backend-parameters';
-import { BackendOption, FormData, SourceType } from '../config/types';
+import { FormData, SourceType } from '../config/types';
import DataForm from '../forms';
import {
MessageStatus,
@@ -63,7 +63,6 @@ type AddModalProps = {
width?: string | number;
initialValues?: any;
deploymentType?: 'modelList' | 'modelFiles';
- backendOptions: BackendOption[];
clusterList: Global.BaseOption<
number,
{ provider: string; state: string | number }
@@ -326,15 +325,17 @@ const AddModal: FC = (props) => {
return;
}
if (data.local_path || props.source !== modelSourceMap.local_path_value) {
+ // TODO confirm wheather it is gguf by model file not by backend
handleOnValuesChange?.({
changedValues: {},
- allValues:
- backend === backendOptionsMap.llamaBox
- ? data
- : _.omit(data, [
- 'cpu_offloading',
- 'distributed_inference_across_workers'
- ]),
+ // allValues:
+ // backend === backendOptionsMap.llamaBox
+ // ? data
+ // : _.omit(data, [
+ // 'cpu_offloading',
+ // 'distributed_inference_across_workers'
+ // ]),
+ allValues: data,
source: props.source
});
}
@@ -413,6 +414,9 @@ const AddModal: FC = (props) => {
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
});
+ form.current?.getBackendOptions?.({
+ cluster_id: initClusterId()
+ });
} else {
cancelEvaluate();
clearCahceFormValues();
@@ -542,7 +546,6 @@ const AddModal: FC = (props) => {
onOk={handleOnOk}
ref={form}
isGGUF={isGGUF}
- backendOptions={props.backendOptions}
onBackendChange={handleBackendChange}
onValuesChange={onValuesChange}
>
diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx
index 7203d132..22dcb7c8 100644
--- a/src/pages/llmodels/components/table-list.tsx
+++ b/src/pages/llmodels/components/table-list.tsx
@@ -42,7 +42,6 @@ import {
modelCategoriesMap,
modelSourceMap
} from '../config';
-import { backendOptionsMap } from '../config/backend-parameters';
import {
ButtonList,
categoryToPathMap,
@@ -57,7 +56,6 @@ import {
} from '../config/types';
import useFormInitialValues from '../hooks/use-form-initial-values';
import useModelsColumns from '../hooks/use-models-columns';
-import useQueryBackends from '../hooks/use-query-backends';
import APIAccessInfoModal from './api-access-info';
import DeployModal from './deploy-modal';
import Instances from './instances';
@@ -124,7 +122,6 @@ const Models: React.FC = ({
loadend,
total
}) => {
- const { backendOptions } = useQueryBackends();
const { generateFormValues, clusterList, getClusterList } =
useFormInitialValues();
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
@@ -401,7 +398,7 @@ const Models: React.FC = ({
const initialValues = generateFormValues(row, []);
setUpdateFormInitials({
data: initialValues,
- isGGUF: row.backend === backendOptionsMap.llamaBox
+ isGGUF: false
});
setCurrentData(row);
setOpenAddModal(true);
@@ -693,7 +690,6 @@ const Models: React.FC = ({
clusterList={clusterList}
onCancel={handleModalCancel}
onOk={handleModalOk}
- backendOptions={backendOptions}
>
= ({
isGGUF={openDeployModal.isGGUF}
hasLinuxWorker={openDeployModal.hasLinuxWorker}
clusterList={clusterList}
- backendOptions={backendOptions}
onCancel={handleDeployModalCancel}
onOk={handleCreateModel}
>
diff --git a/src/pages/llmodels/components/update-modal.tsx b/src/pages/llmodels/components/update-modal.tsx
index 0c06f055..4d25e8a8 100644
--- a/src/pages/llmodels/components/update-modal.tsx
+++ b/src/pages/llmodels/components/update-modal.tsx
@@ -12,7 +12,7 @@ import {
updateIgnoreFields
} from '../config';
import { backendOptionsMap } from '../config/backend-parameters';
-import { BackendOption, FormData } from '../config/types';
+import { FormData } from '../config/types';
import { generateGPUSelector } from '../config/utils';
import DataForm from '../forms';
import { useCheckCompatibility } from '../hooks';
@@ -26,7 +26,6 @@ type AddModalProps = {
data: FormData;
isGGUF: boolean;
};
- backendOptions: BackendOption[];
clusterList: Global.BaseOption<
number,
{ provider: string; state: string | number }
@@ -326,7 +325,6 @@ const UpdateModal: React.FC = (props) => {
onOk={handleOk}
ref={formRef}
isGGUF={isGGUF}
- backendOptions={props.backendOptions}
onBackendChange={handleAsyncBackendChange}
onValuesChange={handleManulOnValuesChange}
>
diff --git a/src/pages/llmodels/config/backend-parameters/index.ts b/src/pages/llmodels/config/backend-parameters/index.ts
index 0e8be436..8c230a19 100644
--- a/src/pages/llmodels/config/backend-parameters/index.ts
+++ b/src/pages/llmodels/config/backend-parameters/index.ts
@@ -4,9 +4,9 @@ import vllmParameters from './vllm-parameters';
export const backendOptionsMap = {
llamaBox: 'llama-box',
- vllm: 'vllm',
+ vllm: 'vLLM',
voxBox: 'vox-box',
- ascendMindie: 'ascend-mindie',
+ ascendMindie: 'MindIE',
custom: 'custom'
};
diff --git a/src/pages/llmodels/forms/index.tsx b/src/pages/llmodels/forms/index.tsx
index 1d212689..c0d26c02 100644
--- a/src/pages/llmodels/forms/index.tsx
+++ b/src/pages/llmodels/forms/index.tsx
@@ -22,6 +22,7 @@ import CatalogFrom from './catalog';
import LocalPathSource from './local-path-source';
import OnlineSource from './online-source';
// import AdvanceConfig from './advance-config';
+import useQueryBackends from '../hooks/use-query-backends';
import AdvanceConfig from './advance-config';
import Performance from './performance';
@@ -33,7 +34,6 @@ interface DataFormProps {
isGGUF: boolean;
formKey: DeployFormKey;
sourceDisable?: boolean;
- backendOptions: BackendOption[];
sourceList?: Global.BaseOption[];
clusterList: Global.BaseOption[];
fields?: string[];
@@ -50,7 +50,6 @@ const DataForm: React.FC = forwardRef((props, ref) => {
formKey,
initialValues,
sourceDisable = true,
- backendOptions = [],
sourceList,
clusterList = [],
fields = ['source'],
@@ -58,6 +57,7 @@ const DataForm: React.FC = forwardRef((props, ref) => {
onValuesChange,
onOk
} = props;
+ const { backendOptions, getBackendOptions } = useQueryBackends();
const { getGPUOptionList, gpuOptions } = useGenerateGPUOptions();
const { getRuleMessage } = useAppUtils();
const [form] = Form.useForm();
@@ -111,6 +111,7 @@ const DataForm: React.FC = forwardRef((props, ref) => {
const handleClusterChange = (value: number) => {
getGPUOptionList({ clusterId: value });
+ getBackendOptions({ cluster_id: value });
};
const handleOnValuesChange = async (changedValues: any, allValues: any) => {
@@ -147,6 +148,9 @@ const DataForm: React.FC = forwardRef((props, ref) => {
},
getGPUOptionList: async (params: { clusterId: number }) => {
return await getGPUOptionList(params);
+ },
+ getBackendOptions: async (params?: { cluster_id: number }) => {
+ getBackendOptions(params);
}
};
});
diff --git a/src/pages/llmodels/hooks/use-query-backends.ts b/src/pages/llmodels/hooks/use-query-backends.ts
index 1cc3adda..b580775e 100644
--- a/src/pages/llmodels/hooks/use-query-backends.ts
+++ b/src/pages/llmodels/hooks/use-query-backends.ts
@@ -1,14 +1,13 @@
import { backendOptionsAtom } from '@/atoms/models';
import { useAtom } from 'jotai';
-import { useEffect } from 'react';
import { queryBackendList } from '../apis';
export default function useQueryBackends() {
const [backendOptions, setBackendOptions] = useAtom(backendOptionsAtom);
- const getBackendOptions = async () => {
+ const getBackendOptions = async (params?: { cluster_id: number }) => {
try {
- const res = await queryBackendList();
+ const res = await queryBackendList(params);
const list = res?.items?.map((item) => {
return {
value: item.backend_name,
@@ -30,10 +29,6 @@ export default function useQueryBackends() {
}
};
- useEffect(() => {
- getBackendOptions();
- }, []);
-
return {
backendOptions,
getBackendOptions
diff --git a/src/pages/resources/components/model-files.tsx b/src/pages/resources/components/model-files.tsx
index f7916359..1b8261b6 100644
--- a/src/pages/resources/components/model-files.tsx
+++ b/src/pages/resources/components/model-files.tsx
@@ -17,7 +17,6 @@ import { SourceType } from '@/pages/llmodels/config/types';
import DownloadModal from '@/pages/llmodels/download';
import useCheckBackend from '@/pages/llmodels/hooks/use-check-backend';
import { useGenerateWorkerOptions } from '@/pages/llmodels/hooks/use-form-initial-values';
-import useQueryBackends from '@/pages/llmodels/hooks/use-query-backends';
import useRecognizeAudio from '@/pages/llmodels/hooks/use-recognize-audio';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl, useNavigate } from '@umijs/max';
@@ -67,7 +66,6 @@ const ModelFiles = () => {
watch: true,
contentForDelete: 'resources.modelfiles.modelfile'
});
- const { backendOptions } = useQueryBackends();
const intl = useIntl();
const { showSuccess } = useAppUtils();
const [downloadModalStatus, setDownlaodMoalStatus] = useState<{
@@ -347,7 +345,6 @@ const ModelFiles = () => {
workerOptions={readyWorkers}
>