fix: photo import language + no-recipe-recognized handling (v0.29.0)

importFromPhoto() accepted a locale param but silently discarded it
(named _locale, never read) — now builds a language instruction the
same way generate-recipe.ts does for text generation.

The AI output schema had no way to signal "couldn't find a recipe in
this image" — generateObject would always fabricate a title/fields.
Added a `found` boolean the model sets to false in that case; the
route now returns 422 instead of creating a garbage recipe and
sending the user into the editor with it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-14 13:45:52 +02:00
parent 21c541e115
commit d8bc077f47
11 changed files with 40 additions and 8 deletions
+1
View File
@@ -152,6 +152,7 @@
"cookAction": "Cook",
"adaptConstraintPlaceholder": "e.g. Make it vegan, lower the calories, use pantry staples only, gluten-free…",
"photoImportFailed": "Failed to import recipe from photo.",
"photoNoRecipeFound": "No recipe could be recognized in that photo. Try a clearer picture of the ingredients or instructions.",
"importFromPhoto": "Import from Photo",
"urlImportTitle": "Import recipe from URL",
"urlImportDescription": "Paste a recipe URL and AI will extract the ingredients and instructions.",
+1
View File
@@ -152,6 +152,7 @@
"drinksTypeHot": "Chaud",
"cookAction": "Cuisiner",
"photoImportFailed": "Échec de l'importation de la recette depuis la photo.",
"photoNoRecipeFound": "Aucune recette reconnue sur cette photo. Essayez une image plus nette des ingrédients ou des instructions.",
"importFromPhoto": "Importer depuis une photo",
"urlImportTitle": "Importer une recette depuis une URL",
"urlImportDescription": "Collez l'URL d'une recette et l'IA en extraira les ingrédients et les instructions.",