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) => {
|
const handleOnBlur = (e: any) => {
|
||||||
e.target.value = e.target.value?.trim?.();
|
|
||||||
if (!inputRef.current?.input?.value) {
|
if (!inputRef.current?.input?.value) {
|
||||||
setIsFocus(false);
|
setIsFocus(false);
|
||||||
}
|
}
|
||||||
|
if (!trim) {
|
||||||
|
e.target.value = e.target.value?.trimRight?.();
|
||||||
|
props.onChange?.(e);
|
||||||
|
}
|
||||||
props.onBlur?.(e);
|
props.onBlur?.(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -194,5 +194,6 @@ export default {
|
|||||||
'models.accessSettings.allowedUsers': 'Allowed users',
|
'models.accessSettings.allowedUsers': 'Allowed users',
|
||||||
'models.accessSettings.public.tips':
|
'models.accessSettings.public.tips':
|
||||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
'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.allowedUsers': 'Allowed users',
|
||||||
'models.accessSettings.public.tips':
|
'models.accessSettings.public.tips':
|
||||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
'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) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
@@ -224,6 +225,7 @@ export default {
|
|||||||
// 28. 'models.accessSettings.authed': 'Authenticated',
|
// 28. 'models.accessSettings.authed': 'Authenticated',
|
||||||
// 29. 'models.accessSettings.allowedUsers': 'Allowed users',
|
// 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.',
|
// 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 ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -194,7 +194,8 @@ export default {
|
|||||||
'models.accessSettings.allowedUsers': 'Allowed users',
|
'models.accessSettings.allowedUsers': 'Allowed users',
|
||||||
'models.accessSettings.public.tips':
|
'models.accessSettings.public.tips':
|
||||||
'When set to public, anyone can access this model without authentication, which may lead to data exposure risks.',
|
'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) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
@@ -219,5 +220,6 @@ export default {
|
|||||||
// 20. 'models.accessSettings.authed': 'Authenticated',
|
// 20. 'models.accessSettings.authed': 'Authenticated',
|
||||||
// 21. 'models.accessSettings.allowedUsers': 'Allowed users',
|
// 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.',
|
// 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 ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -184,5 +184,6 @@ export default {
|
|||||||
'models.accessSettings.allowedUsers': '指定用户',
|
'models.accessSettings.allowedUsers': '指定用户',
|
||||||
'models.accessSettings.public.tips':
|
'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
|
<SealInput.Input
|
||||||
label={intl.formatMessage({ id: 'common.table.name' })}
|
label={intl.formatMessage({ id: 'common.table.name' })}
|
||||||
required
|
required
|
||||||
|
trim={false}
|
||||||
></SealInput.Input>
|
></SealInput.Input>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{provider === ProviderValueMap.DigitalOcean && (
|
{provider === ProviderValueMap.DigitalOcean && (
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
return cluster_id;
|
return cluster_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnOpen = () => {
|
const handleOnOpen = async () => {
|
||||||
if (props.deploymentType === 'modelFiles') {
|
if (props.deploymentType === 'modelFiles') {
|
||||||
form.current?.form?.setFieldsValue({
|
form.current?.form?.setFieldsValue({
|
||||||
...props.initialValues
|
...props.initialValues
|
||||||
@@ -377,12 +377,36 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
source: source
|
source: source
|
||||||
});
|
});
|
||||||
} else {
|
} 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.ascendMindie
|
||||||
: backendOptionsMap.vllm;
|
: 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?.({
|
form.current?.setFieldsValue?.({
|
||||||
backend,
|
backend,
|
||||||
|
default_version: currentDefaultBackend?.default_version,
|
||||||
|
backend_parameters: currentDefaultBackend?.default_backend_param || [],
|
||||||
cluster_id: initClusterId()
|
cluster_id: initClusterId()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -411,12 +435,6 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
handleOnOpen();
|
handleOnOpen();
|
||||||
form.current?.getGPUOptionList?.({
|
|
||||||
clusterId: initClusterId()
|
|
||||||
});
|
|
||||||
form.current?.getBackendOptions?.({
|
|
||||||
cluster_id: initClusterId()
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
cancelEvaluate();
|
cancelEvaluate();
|
||||||
clearCahceFormValues();
|
clearCahceFormValues();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const BackendFields: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
backendOptions.find((item) => item.value === backend)?.versions || []
|
backendOptions.find((item) => item.value === backend)?.versions || []
|
||||||
);
|
);
|
||||||
}, [backend]);
|
}, [backend, backendOptions]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -72,7 +72,9 @@ const BackendFields: React.FC = () => {
|
|||||||
<Form.Item name="backend_version">
|
<Form.Item name="backend_version">
|
||||||
<AutoComplete
|
<AutoComplete
|
||||||
options={backendVersions}
|
options={backendVersions}
|
||||||
placeholder="enter or select a version"
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'models.form.backendVersion.holder'
|
||||||
|
})}
|
||||||
onBlur={handleBackendVersionOnBlur}
|
onBlur={handleBackendVersionOnBlur}
|
||||||
label={intl.formatMessage({ id: 'models.form.backendVersion' })}
|
label={intl.formatMessage({ id: 'models.form.backendVersion' })}
|
||||||
description={intl.formatMessage(
|
description={intl.formatMessage(
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
return await getGPUOptionList(params);
|
return await getGPUOptionList(params);
|
||||||
},
|
},
|
||||||
getBackendOptions: async (params?: { cluster_id: number }) => {
|
getBackendOptions: async (params?: { cluster_id: number }) => {
|
||||||
getBackendOptions(params);
|
return await getBackendOptions(params);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ export const useGenerateGPUOptions = () => {
|
|||||||
return gpuSelectorList;
|
return gpuSelectorList;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGPUOptionList = async (params?: { clusterId: number }) => {
|
const getGPUOptionList = async (params?: {
|
||||||
|
clusterId: number;
|
||||||
|
}): Promise<CascaderOption[]> => {
|
||||||
const { clusterId } = params || {};
|
const { clusterId } = params || {};
|
||||||
const [gpuData, workerData] = await Promise.all([
|
const [gpuData, workerData] = await Promise.all([
|
||||||
queryGPUList({
|
queryGPUList({
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ export default function useQueryBackends() {
|
|||||||
if (res?.items) {
|
if (res?.items) {
|
||||||
setBackendOptions(list || []);
|
setBackendOptions(list || []);
|
||||||
}
|
}
|
||||||
|
return list || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ignore
|
// ignore
|
||||||
setBackendOptions([]);
|
setBackendOptions([]);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user