Skip to content

feat: Add AI recipe generator chat - #1160

Open
vanalmsick wants to merge 1 commit into
TomBursch:mainfrom
vanalmsick:feat/AI_recipe_creator
Open

vanalmsick wants to merge 1 commit into
TomBursch:mainfrom
vanalmsick:feat/AI_recipe_creator

Conversation

@vanalmsick

Copy link
Copy Markdown

Hi @TomBursch, 👋

Thanks for all the work on KitchenOwl. I use it daily, but coming up with new recipes is always a pain, so I built this AI recipe generator chat feature:

Describe what you're in the mood for (or what's in your fridge), and get a complete recipe - title, times, servings, ingredients, and steps - in your household's language, using items you already have. Refine with quick replies or free text, then save via the existing add-recipe form.

Screenshot 2026-09-27 at 13 22 39 Screenshot 2026-09-27 at 13 22 47 Screenshot 2026-09-27 at 13 23 40

What's new

For users

  • Recipes + button gets a third option, ✨ AI (shown only when enabled server-side).
  • Chat starts with suggested prompts; each reply is a recipe preview with quick actions (different recipe, make it vegetarian, more detail, or free-text edits).
  • Add recipe pre-fills the standard form (same flow as URL import).
  • Token usage shown per answer and per session; Stop cancels a slow request.

For self-hosters

  • Reuses the existing LLM config (no new dependencies). New env var: LLM_RECIPE_GENERATION (default true if LLM_MODEL is set) to disable the feature.

How it works

  • New endpoint POST /api/household/<id>/recipe/generate (JWT + household-scoped, stateless, only user/assistant roles accepted, capped at 50 messages × 20k chars).
  • recipe_generation.py calls LiteLLM with a JSON-schema response, falling back to extracting JSON if a provider ignores the schema. Prompt includes household language and existing item names.
  • Ingredients matched to existing items by exact, case-insensitive name; unmatched ones become new items on save; duplicates dropped.
  • /api/health exposes llm_recipe_generation so the app knows whether to show the button.

Known limitations

  • Stop only stops the UI from waiting — the backend call still runs and is billed.
  • Full item list is sent every time; fine for now, may need filtering for very large households.
  • Token counts shown, but not cost in currency.

Testing

  • New backend test covering flag, matching, dedup, usage, and role rejection.
  • Full backend pytest passes (one unrelated timezone-based failure).
  • flutter analyze clean; UI renders at phone/desktop widths.

@vanalmsick vanalmsick changed the title Feature: Add AI recipe generator chat feat: Add AI recipe generator chat Sep 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant