kiwi/app/services/recipe
pyr0ball e57f46f4b6 feat(streaming): add native SSE fallback for L3/L4 recipe generation (closes #126)
Two-phase streaming architecture:
  Phase 1 (sync thread): IngredientClassifier builds element profiles +
    gap list from SQLite — thread-safe, no async context needed
  Phase 2 (async): LLMRecipeGenerator.stream_generate() yields tokens via
    cf-orch warm vllm (existing /stream-token path) or AsyncOpenAI against
    Ollama if the coordinator is unavailable

Backend (app/services/recipe/llm_recipe.py):
  - stream_generate() async generator; _try_alloc_for_stream() sync helper
  - _stream_openai_compat() static method handles __auto__ model resolution
  - LLMRecipeGenerator(None) is safe for streaming (store not used)

Endpoint (app/api/endpoints/recipes.py):
  - ?stream=true on POST /recipes/suggest returns StreamingResponse
  - X-Accel-Buffering: no prevents nginx buffering without nginx.conf edits

Frontend (api.ts, recipes.ts, RecipesView.vue):
  - suggestRecipeStream() uses fetch + ReadableStream (POST; EventSource
    only supports GET)
  - streamSuggest() action in recipes store builds request internally
  - RecipesView.streamRecipe() silently falls back to native SSE when
    cf-orch token fetch fails rather than surfacing an error
2026-05-11 11:32:54 -07:00
..
__init__.py feat: ElementClassifier -- ingredient element tagging with heuristic fallback 2026-03-30 22:59:46 -07:00
assembly_recipes.py fix: save, shopping list, and route ordering for Build Your Own 2026-04-14 14:48:30 -07:00
browse_counts_cache.py feat(recipe-tags): merge accepted community tags into browse counts + FTS fallback 2026-04-22 12:37:44 -07:00
browser_domains.py fix: wire browse domains to inferred_tag vocabulary, fix can_be leak in dietary 2026-04-27 11:38:37 -07:00
element_classifier.py fix(ui): compact recipe cards, batch ingredient classifier queries 2026-04-27 14:56:00 -07:00
grocery_links.py feat(shopping): locale-aware grocery links with region settings UI 2026-04-21 15:05:28 -07:00
llm_recipe.py feat(streaming): add native SSE fallback for L3/L4 recipe generation (closes #126) 2026-05-11 11:32:54 -07:00
locale_config.py feat(browser): expand cuisine taxonomy to 13 categories + 105 subcategories 2026-04-21 10:15:58 -07:00
recipe_engine.py feat(filters): split time filter into hands-on and total time (kiwi#52) 2026-04-27 16:03:27 -07:00
recipe_scanner.py feat: recipe scanner — photo to structured recipe (kiwi#9) 2026-04-27 08:23:01 -07:00
reranker.py feat: cross-encoder reranker for recipe suggestions (kiwi#117) 2026-04-24 16:39:51 -07:00
sensory.py feat: sensory profile filter — texture/smell/noise filtering for Browse and Find (kiwi#51) 2026-04-24 09:47:48 -07:00
staple_library.py fix: staple library — consistent tofu_firm slug, load error handling, typed yield_formats, expanded test coverage 2026-03-30 23:10:51 -07:00
style_adapter.py feat: recipe engine Phase 3 — StyleAdapter, LLM levels 3-4, user settings 2026-03-31 14:15:18 -07:00
style_classifier.py feat(recipes): LLM style classifier (#27) + cooked leftovers shelf-life (#112) 2026-04-25 23:18:16 -07:00
substitution_engine.py fix: wire recipe corpus to cloud per-user DBs via SQLite ATTACH (#102) 2026-04-18 14:21:56 -07:00
tag_inferrer.py feat(tags): add meal type inference from recipe titles (#125) 2026-04-27 12:24:31 -07:00
time_effort.py feat(browse): active time estimation, prep scaling, required-ingredient filter 2026-04-27 07:13:12 -07:00