fix(backend): rendering issue
This commit is contained in:
@ -93,10 +93,13 @@ async function extractUsingAI(
|
||||
|
||||
const recipe = await openai.extractRecipe(markdown);
|
||||
|
||||
if (isValidRecipe(recipe)) {
|
||||
return recipe;
|
||||
if (recipe) {
|
||||
if ("errorMessages" in recipe) {
|
||||
throw new Error("Failed to extract recipe: " + recipe.errorMessages[0]);
|
||||
} else {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
async function processCreateRecipeFromUrl(
|
||||
@ -172,13 +175,6 @@ async function processCreateRecipeFromUrl(
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipe) {
|
||||
console.error("Failed to parse recipe");
|
||||
streamResponse.enqueue("failed to parse recipe");
|
||||
streamResponse.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
const newRecipe: Recipe = {
|
||||
type: "recipe",
|
||||
id,
|
||||
|
Reference in New Issue
Block a user