diff --git a/src/renderer/components/Experiment/Train/ImportRecipeModal.tsx b/src/renderer/components/Experiment/Train/ImportRecipeModal.tsx index 00c22f7bdb3c4939a109da9c429bf44a61bd72c1..5a4c9c8d3899a1d58f35b459e0ff9f33cf41dd8c 100644 --- a/src/renderer/components/Experiment/Train/ImportRecipeModal.tsx +++ b/src/renderer/components/Experiment/Train/ImportRecipeModal.tsx @@ -63,11 +63,11 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) { // For now: Remove the last . and extension from the filename const recipe_name = file.name.replace(/\.[^/.]+$/, ''); - uploadRecipe(recipe_name, recipe_text); + return uploadRecipe(recipe_name, recipe_text); }; // Given a recipe string, uploads to API. - const uploadRecipe = async (recipe_name, recipe_text) => { + const uploadRecipe = async (recipe_name: string, recipe_text: string) => { setUploading(true); //This is for the loading spinner const response = await fetch( chatAPI.Endpoints.Recipes.Import(recipe_name), @@ -86,6 +86,9 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) { }) .then((data) => { console.log('Server response:', data); + if (data?.status == "error") { + alert(data.message); + } }) .catch((error) => { alert(error);