fix: edit model worker selector not remove when manul

main
jialin 1 year ago
parent 2cd676fd3d
commit e22a137a6f

@ -222,7 +222,12 @@ const Models: React.FC<ModelsProps> = ({
const handleModalOk = useCallback(
async (data: FormData) => {
try {
await updateModel({ data, id: currentData?.id as number });
await updateModel({
data: {
...data
},
id: currentData?.id as number
});
setOpenAddModal(false);
message.success(intl.formatMessage({ id: 'common.message.success' }));
} catch (error) {}

@ -247,17 +247,21 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
};
const handleOk = (formdata: FormData) => {
const gpu = _.find(gpuOptions, (item: any) => {
return item.value === formdata.gpu_selector;
});
if (gpu) {
if (formdata.scheduleType === 'manual') {
const gpu = _.find(gpuOptions, (item: any) => {
return item.value === formdata.gpu_selector;
});
onOk({
..._.omit(formdata, ['scheduleType']),
gpu_selector: {
gpu_name: gpu.name,
gpu_index: gpu.index,
worker_name: gpu.worker_name
}
worker_selector: null,
gpu_selector: gpu
? {
gpu_name: gpu.name,
gpu_index: gpu.index,
worker_name: gpu.worker_name
}
: null
});
} else {
onOk({

Loading…
Cancel
Save