Skip to content

Add user cooking context for personalized recipe generation#70

Merged
windoze95 merged 3 commits intomainfrom
feat/cooking-skills
Apr 5, 2026
Merged

Add user cooking context for personalized recipe generation#70
windoze95 merged 3 commits intomainfrom
feat/cooking-skills

Conversation

@windoze95
Copy link
Copy Markdown
Owner

Summary

  • Add CookingContext field to Personalization model -- free-form text where users describe their kitchen equipment, skill level, cuisine preferences, and ingredient substitutions
  • Inject cooking context into AI system prompts for generate, regenerate, and fork recipe flows via a new {{.CookingContext}} template variable
  • Expose cooking_context in the personalization API (read and update) so clients can set it

Details

The field is optional and backward-compatible: empty string means no injection, so existing users get the same behavior as before. No migration file needed -- GORM AutoMigrate handles adding the column.

The cooking context flows through the full stack:

  1. Model (Personalization.CookingContext) -- stored in DB
  2. Service response (PersonalizationResponse.CookingContext) -- returned via API
  3. Handler (UpdatePersonalization) -- accepts cooking_context in request body
  4. AI request (RecipeRequest.CookingContext) -- carries context to provider
  5. Prompt templates (prompts.yaml) -- injected after dietary requirements
  6. Provider (anthropic.go) -- passes to template rendering

Test plan

  • go build ./... compiles cleanly
  • go test ./... all tests pass
  • Verify new column appears after AutoMigrate
  • Set cooking context via PUT /personalization and confirm it persists
  • Generate a recipe with cooking context set and verify prompt includes it
  • Generate a recipe with empty cooking context and verify no extra text in prompt
  • Test regenerate and fork flows with cooking context

🤖 Generated with Claude Code

Inject free-form cooking preferences (equipment, skill level, cuisine
preferences, ingredient substitutions) into AI recipe prompts, enabling
more personalized recipe generation without changing the existing
dietary requirements flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddd7c48e54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/handlers/user.go
windoze95 and others added 2 commits April 4, 2026 20:54
The UpdatePersonalization repository method copied UnitSystem,
Requirements, and UID but omitted CookingContext, silently dropping
the value on every update.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep middleware wrapping from main (R5) and add CookingContext
template parameter from cooking-skills (R8) inside each closure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@windoze95 windoze95 merged commit 426b98c into main Apr 5, 2026
1 check passed
@windoze95 windoze95 deleted the feat/cooking-skills branch April 5, 2026 02:01
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