Public Access
feat(backend): recipe enrichment with side dishes & detailed instructions
- Add SideDish/SideDishIngredient schemas and recipe.side_dishes JSONB column
- Add recipe_enrichment.py service using Ollama LLM to:
- Rewrite vague instructions with specific temps, quantities, timing, sauce breakdowns
- Suggest 1-2 complementary side dishes with ingredients & prep notes
- Wire enrichment into recipe_ingestion.py discovery pipeline
- Add admin trigger endpoint /api/recipes/{id}/enrich for on-demand enrichment
- Migration 0014: Add side_dishes JSONB to recipe table
- Fix schemas/__init__.py imports: restore RecipeBase/Create/Read exports, add datetime/date for PydanticOptional compatibility
- Deployed to docker-willester and migrated to alembic 0014
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
@@ -14,6 +14,18 @@ class RecipeIngredientRef(BaseModel):
|
||||
notes: Optional[str] = None
|
||||
|
||||
|
||||
class SideDishIngredient(BaseModel):
|
||||
name: str
|
||||
qty: float
|
||||
unit: Optional[str] = None
|
||||
|
||||
|
||||
class SideDish(BaseModel):
|
||||
name: str
|
||||
ingredients: List[SideDishIngredient]
|
||||
prep_notes: Optional[str] = None
|
||||
|
||||
|
||||
class RecipeBase(BaseModel):
|
||||
name: str = Field(min_length=1, max_length=300)
|
||||
description: Optional[str] = None
|
||||
@@ -49,6 +61,7 @@ class RecipeUpdate(BaseModel):
|
||||
calories_per_serving: Optional[int] = None
|
||||
ingredients: Optional[List[RecipeIngredientRef]] = None
|
||||
instructions: Optional[List[str]] = None
|
||||
side_dishes: Optional[List[SideDish]] = None
|
||||
|
||||
|
||||
class RecipeRead(RecipeBase):
|
||||
@@ -56,6 +69,7 @@ class RecipeRead(RecipeBase):
|
||||
external_source: Optional[str] = None
|
||||
external_id: Optional[str] = None
|
||||
discovery_reason: Optional[str] = None
|
||||
side_dishes: List[SideDish] = Field(default_factory=list)
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user