fix: edit model worker selector not remove when manul

This commit is contained in:
jialin
2024-09-13 21:16:31 +08:00
parent 2cd676fd3d
commit e22a137a6f
2 changed files with 19 additions and 10 deletions
+6 -1
View File
@@ -222,7 +222,12 @@ const Models: React.FC<ModelsProps> = ({
const handleModalOk = useCallback( const handleModalOk = useCallback(
async (data: FormData) => { async (data: FormData) => {
try { try {
await updateModel({ data, id: currentData?.id as number }); await updateModel({
data: {
...data
},
id: currentData?.id as number
});
setOpenAddModal(false); setOpenAddModal(false);
message.success(intl.formatMessage({ id: 'common.message.success' })); message.success(intl.formatMessage({ id: 'common.message.success' }));
} catch (error) {} } catch (error) {}
+13 -9
View File
@@ -247,17 +247,21 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
}; };
const handleOk = (formdata: FormData) => { const handleOk = (formdata: FormData) => {
const gpu = _.find(gpuOptions, (item: any) => { if (formdata.scheduleType === 'manual') {
return item.value === formdata.gpu_selector; const gpu = _.find(gpuOptions, (item: any) => {
}); return item.value === formdata.gpu_selector;
if (gpu) { });
onOk({ onOk({
..._.omit(formdata, ['scheduleType']), ..._.omit(formdata, ['scheduleType']),
gpu_selector: { worker_selector: null,
gpu_name: gpu.name, gpu_selector: gpu
gpu_index: gpu.index, ? {
worker_name: gpu.worker_name gpu_name: gpu.name,
} gpu_index: gpu.index,
worker_name: gpu.worker_name
}
: null
}); });
} else { } else {
onOk({ onOk({