diff --git a/frontend/src/pages/AddRecipe.jsx b/frontend/src/pages/AddRecipe.jsx
index b2f9a19..f6c9029 100644
--- a/frontend/src/pages/AddRecipe.jsx
+++ b/frontend/src/pages/AddRecipe.jsx
@@ -7,6 +7,21 @@ import StepList from '../components/StepList';
const CATEGORIES = ['Frühstück', 'Hauptgericht', 'Dessert', 'Snack', 'Getränk', 'Sonstiges'];
+function parseIngredient(raw) {
+ if (typeof raw !== 'string') return raw;
+ const m = raw.match(/^([\d½¼¾⅓⅔.,–\-]+\s*(?:g|kg|ml|l|EL|TL|Stück|Packung|Prise|Bund|Dose|Scheibe|cm|dick)?)\s*(.*)/i);
+ if (m) {
+ const amount = m[1].trim();
+ const rest = m[2].trim();
+ const unitMatch = rest.match(/^((?:g|kg|ml|l|EL|TL|Stück|Packung|Prise|Bund|Dose|Scheibe|dick)s?)\s+(.*)/i);
+ if (unitMatch) {
+ return { amount, unit: unitMatch[1], name: unitMatch[2] };
+ }
+ return { amount, unit: '', name: rest };
+ }
+ return { amount: '', unit: '', name: raw };
+}
+
function detectSource(url) {
if (/tiktok\.com\//.test(url)) return 'tiktok';
return null;
@@ -55,7 +70,7 @@ export default function AddRecipe() {
setName(data.extracted.name || '');
setDescription(data.extracted.description || '');
setCategory(data.extracted.category || 'Sonstiges');
- setIngredients(data.extracted.ingredients || []);
+ setIngredients((data.extracted.ingredients || []).map(parseIngredient));
setSteps(data.extracted.steps || []);
} else {
setName(data.tiktok?.title || '');
@@ -157,8 +172,8 @@ export default function AddRecipe() {
- KI (Ollama) nicht erreichbar.{' '}
- Starte Ollama oder füll die Felder manuell aus.
+ KI nicht erreichbar.{' '}
+ Prüfe den API-Key oder füll die Felder manuell aus.
>
)}