fix: do not set default version
This commit is contained in:
@@ -63,10 +63,13 @@ const SealInput: React.FC<InputProps & SealFormItemProps> = (props) => {
|
||||
};
|
||||
|
||||
const handleOnBlur = (e: any) => {
|
||||
e.target.value = e.target.value?.trim?.();
|
||||
if (!inputRef.current?.input?.value) {
|
||||
setIsFocus(false);
|
||||
}
|
||||
if (!trim) {
|
||||
e.target.value = e.target.value?.trimRight?.();
|
||||
props.onChange?.(e);
|
||||
}
|
||||
props.onBlur?.(e);
|
||||
};
|
||||
|
||||
|
||||
@@ -194,5 +194,6 @@ export default {
|
||||
'models.accessSettings.allowedUsers': 'Allowed users',
|
||||
'models.accessSettings.public.tips':
|
||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
||||
'models.table.button.deploy': 'Deploy Now'
|
||||
'models.table.button.deploy': 'Deploy Now',
|
||||
'models.form.backendVersion.holder': 'Enter or select a version'
|
||||
};
|
||||
|
||||
@@ -191,7 +191,8 @@ export default {
|
||||
'models.accessSettings.allowedUsers': 'Allowed users',
|
||||
'models.accessSettings.public.tips':
|
||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
||||
'models.table.button.deploy': 'Deploy Now'
|
||||
'models.table.button.deploy': 'Deploy Now',
|
||||
'models.form.backendVersion.holder': 'Enter or select a version'
|
||||
};
|
||||
|
||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||
@@ -224,6 +225,7 @@ export default {
|
||||
// 28. 'models.accessSettings.authed': 'Authenticated',
|
||||
// 29. 'models.accessSettings.allowedUsers': 'Allowed users',
|
||||
// 30. 'models.accessSettings.public.tips': 'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
||||
// 31. 'models.table.button.deploy': 'Deploy Now'
|
||||
// 31. 'models.table.button.deploy': 'Deploy Now',
|
||||
// 32. 'models.form.backendVersion.holder': 'Enter or select a version'
|
||||
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -194,7 +194,8 @@ export default {
|
||||
'models.accessSettings.allowedUsers': 'Allowed users',
|
||||
'models.accessSettings.public.tips':
|
||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
||||
'models.table.button.deploy': 'Deploy Now'
|
||||
'models.table.button.deploy': 'Deploy Now',
|
||||
'models.form.backendVersion.holder': 'Enter or select a version'
|
||||
};
|
||||
|
||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||
@@ -219,5 +220,6 @@ export default {
|
||||
// 20. 'models.accessSettings.authed': 'Authenticated',
|
||||
// 21. 'models.accessSettings.allowedUsers': 'Allowed users',
|
||||
// 22. 'models.accessSettings.public.tips': 'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
||||
// 23. 'models.table.button.deploy': 'Deploy Now'
|
||||
// 23. 'models.table.button.deploy': 'Deploy Now',
|
||||
// 24. 'models.form.backendVersion.holder': 'Enter or select a version'
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -184,5 +184,6 @@ export default {
|
||||
'models.accessSettings.allowedUsers': '指定用户',
|
||||
'models.accessSettings.public.tips':
|
||||
'公开后,任何人无需认证即可访问,可能存在数据泄露风险。',
|
||||
'models.table.button.deploy': '立即部署'
|
||||
'models.table.button.deploy': '立即部署',
|
||||
'models.form.backendVersion.holder': '输入或选择一个版本'
|
||||
};
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 [];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user