fix: edit model worker selector not remove when manul
This commit is contained in:
@@ -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) {}
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user