fix: do not set default version

This commit is contained in:
jialin
2025-10-16 15:05:21 +08:00
parent e2da7c5f96
commit 1da16a04fe
11 changed files with 53 additions and 19 deletions
@@ -73,6 +73,7 @@ const ClusterForm: React.FC<AddModalProps> = forwardRef(
<SealInput.Input
label={intl.formatMessage({ id: 'common.table.name' })}
required
trim={false}
></SealInput.Input>
</Form.Item>
{provider === ProviderValueMap.DigitalOcean && (
+26 -8
View File
@@ -364,7 +364,7 @@ const AddModal: FC<AddModalProps> = (props) => {
return cluster_id;
};
const handleOnOpen = () => {
const handleOnOpen = async () => {
if (props.deploymentType === 'modelFiles') {
form.current?.form?.setFieldsValue({
...props.initialValues
@@ -377,12 +377,36 @@ const AddModal: FC<AddModalProps> = (props) => {
source: source
});
} else {
let backend = checkOnlyAscendNPU([])
const [backendOptions, gpuOptions] = await Promise.all([
form.current?.getBackendOptions?.({
cluster_id: initClusterId()
}),
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
})
]);
let backend = checkOnlyAscendNPU(gpuOptions)
? backendOptionsMap.ascendMindie
: backendOptionsMap.vllm;
const currentDefaultBackend = backendOptions?.find(
(item: {
value: string;
label: string;
default_backend_param: string[];
default_version: string;
versions: { label: string; value: string }[];
}) => item.value === backend
);
console.log(
'currentDefaultBackend:',
currentDefaultBackend,
props.initialValues
);
form.current?.setFieldsValue?.({
backend,
default_version: currentDefaultBackend?.default_version,
backend_parameters: currentDefaultBackend?.default_backend_param || [],
cluster_id: initClusterId()
});
}
@@ -411,12 +435,6 @@ const AddModal: FC<AddModalProps> = (props) => {
useEffect(() => {
if (open) {
handleOnOpen();
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
});
form.current?.getBackendOptions?.({
cluster_id: initClusterId()
});
} else {
cancelEvaluate();
clearCahceFormValues();
+4 -2
View File
@@ -47,7 +47,7 @@ const BackendFields: React.FC = () => {
return (
backendOptions.find((item) => item.value === backend)?.versions || []
);
}, [backend]);
}, [backend, backendOptions]);
return (
<>
@@ -72,7 +72,9 @@ const BackendFields: React.FC = () => {
<Form.Item name="backend_version">
<AutoComplete
options={backendVersions}
placeholder="enter or select a version"
placeholder={intl.formatMessage({
id: 'models.form.backendVersion.holder'
})}
onBlur={handleBackendVersionOnBlur}
label={intl.formatMessage({ id: 'models.form.backendVersion' })}
description={intl.formatMessage(
+1 -1
View File
@@ -184,7 +184,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
return await getGPUOptionList(params);
},
getBackendOptions: async (params?: { cluster_id: number }) => {
getBackendOptions(params);
return await getBackendOptions(params);
}
};
});
@@ -80,7 +80,9 @@ export const useGenerateGPUOptions = () => {
return gpuSelectorList;
};
const getGPUOptionList = async (params?: { clusterId: number }) => {
const getGPUOptionList = async (params?: {
clusterId: number;
}): Promise<CascaderOption[]> => {
const { clusterId } = params || {};
const [gpuData, workerData] = await Promise.all([
queryGPUList({
@@ -23,9 +23,11 @@ export default function useQueryBackends() {
if (res?.items) {
setBackendOptions(list || []);
}
return list || [];
} catch (error) {
// ignore
setBackendOptions([]);
return [];
}
};