fix: use 'persons' field (not 'servings') in chatToRecipe for renderRecipe compatibility

This commit is contained in:
dadaloop82
2026-05-10 14:54:29 +00:00
parent 06cba1ea71
commit 2f04543de3
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -12440,6 +12440,9 @@ async function chatTransferToRecipes(btn, replyText) {
return;
}
const recipe = result.recipe;
// Normalize field names: renderRecipe expects `persons`, Gemini might return `servings`
if (!recipe.persons && recipe.servings) recipe.persons = recipe.servings;
if (!recipe.persons) recipe.persons = 2;
await saveRecipeToArchive(recipe);
_cachedRecipe = { meal: recipe.meal || 'pranzo', recipe };
renderRecipe(recipe);