diff --git a/api/index.php b/api/index.php index d90b842..0e5f1ee 100644 --- a/api/index.php +++ b/api/index.php @@ -3631,7 +3631,7 @@ Convert the recipe text below to a JSON object. Return ONLY the JSON, no markdow Fields: - title: string - meal: one of "colazione","pranzo","cena","dolce","succo" (infer from context, default "pranzo") -- servings: integer (default 2 if not mentioned) +- persons: integer (number of servings/people, default 2 if not mentioned) - prep_time: string or null - cook_time: string or null - ingredients: array of {"name":"...","qty":"...","qty_number":0.0,"unit":"g|ml|pz|conf|kg|l","from_pantry":true} diff --git a/assets/js/app.js b/assets/js/app.js index 4ce3a2b..a51828c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -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);