Files
smartmenu-collina/src
Jorem Juárez 0d924e36ef Replace AI pairings with a deterministic local recommendation engine
The cart/consultant suggestion carousel no longer depends on Claude-generated
pairings. It now computes suggestions locally and instantly from the menu
structure + cart — always available, zero API calls, zero cost, no failure point.

- New lib/recommendations.ts: getRecommendations(menu, cartItemIds, opts) — a pure
  function. Section-complement rules (main+no drink -> drinks; food+no dessert ->
  desserts; drink-only -> food/snacks) classified by flexible keywords (es/en,
  whole-word match so 'te'/tea doesn't match 'fuertes'), then featured fill
  (unrepresented sections first, then price desc). Excludes cart items + inactive;
  empty cart -> featured so the carousel is never empty.
- Phase-2 seam: opts.coOccurrence?(cartIds) => Map<productId, score> lets a future
  market-basket signal blend in WITHOUT changing the carousel — it still only calls
  getRecommendations(menu, cart). Documented where it plugs in.
- PublicMenu computes cartSuggestions via getRecommendations (was the pairings map);
  carousel shows whenever there's >=1 suggestion and orders are enabled, in both the
  cart sheet and the consultant. SuggestionCarousel reused unchanged.
- Removed the Claude generation: publish no longer calls generatePairings and the
  'Generar sugerencias' checkbox is gone; deleted lib/pairings.ts. Restaurant.pairings
  column kept (unused, no migration churn).

i18n parity kept. Glassmorphism/mobile-first/safe-areas untouched. Cart, consultant,
SSE, split all intact.

Verified (build passes, no Anthropic import in the carousel/publish path):
1 fresh publish (nothing generated) -> carousel shows; 2 main+no drink -> drinks
surface first; 3 cart items never suggested; 4 empty cart -> featured; 5 zero
Anthropic calls in the carousel flow; 6 carousel in both cart and consultant.
2026-06-15 20:47:20 -06:00
..