feat(shopping): wire dynamic AI recommendations end-to-end (US-8.3)#99
Merged
Conversation
Frontend now fetches /api/recommendations on mount, with refresh button, loading spinner, and error banner. Backend route proxies to a new ai-service /recommend-purchases endpoint that runs a LangGraph flow: analyze wardrobe gaps -> SerpAPI google_shopping (strict retailer whitelist: Nike, Adidas, Zara, ASOS, Uniqlo, H&M, COS, Everlane) -> Tavily fallback -> LLM re-rank with per-pick reasoning. Per-user recommendations are cached in Mongo and invalidated via a wardrobe fingerprint (count + max updatedAt), so suggestions stay stable until the user changes their wardrobe. 30d TTL is GC only. Optional X-Internal-Token shared secret between backend and ai-service gates the new endpoint when AI_SERVICE_TOKEN is set on both sides.
Comment on lines
+579
to
+580
| f"Recommend-purchases for user {req.user_id} — wardrobe={len(req.wardrobe_items)}, " | ||
| f"styles={req.preferences.styles}, budget_max={req.preferences.budget_max}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend now fetches /api/recommendations on mount, with refresh button, loading spinner, and error banner. Backend route proxies to a new ai-service /recommend-purchases endpoint that runs a LangGraph flow: analyze wardrobe gaps -> SerpAPI google_shopping (strict retailer
whitelist: Nike, Adidas, Zara, ASOS, Uniqlo, H&M, COS, Everlane) ->
Tavily fallback -> LLM re-rank with per-pick reasoning.
Per-user recommendations are cached in Mongo and invalidated via a wardrobe fingerprint (count + max updatedAt), so suggestions stay stable until the user changes their wardrobe. 30d TTL is GC only.
Optional X-Internal-Token shared secret between backend and ai-service gates the new endpoint when AI_SERVICE_TOKEN is set on both sides.