mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add model update for success/failure handling
This commit is contained in:
parent
d8437d3036
commit
48a8bd4985
@ -74,27 +74,30 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) {
|
||||
model_name: retrievedModel.model_name,
|
||||
body: values,
|
||||
};
|
||||
updateMainModel(responseBody);
|
||||
|
||||
if (error) {
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdateFailed'),
|
||||
status: 'success',
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdated'),
|
||||
status: 'success',
|
||||
})
|
||||
)
|
||||
);
|
||||
updateMainModel(responseBody)
|
||||
.unwrap()
|
||||
.then((payload) => {
|
||||
checkpointEditForm.setValues(payload as CheckpointModelConfig);
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdated'),
|
||||
status: 'success',
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
checkpointEditForm.reset();
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdateFailed'),
|
||||
status: 'error',
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return modelToEdit ? (
|
||||
|
@ -71,27 +71,30 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) {
|
||||
model_name: retrievedModel.model_name,
|
||||
body: values,
|
||||
};
|
||||
updateMainModel(responseBody);
|
||||
|
||||
if (error) {
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdateFailed'),
|
||||
status: 'error',
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdated'),
|
||||
status: 'success',
|
||||
})
|
||||
)
|
||||
);
|
||||
updateMainModel(responseBody)
|
||||
.unwrap()
|
||||
.then((payload) => {
|
||||
diffusersEditForm.setValues(payload as DiffusersModelConfig);
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdated'),
|
||||
status: 'success',
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
diffusersEditForm.reset();
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
title: t('modelManager.modelUpdateFailed'),
|
||||
status: 'error',
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return modelToEdit ? (
|
||||
|
Loading…
Reference in New Issue
Block a user