Skip to content

Insomniacs-Agentic Search#24

Open
Pavan2coder wants to merge 17 commits into
opensource-for-valkey:mainfrom
345678o:main
Open

Insomniacs-Agentic Search#24
Pavan2coder wants to merge 17 commits into
opensource-for-valkey:mainfrom
345678o:main

Conversation

@Pavan2coder

Copy link
Copy Markdown

No description provided.

345678o and others added 17 commits May 24, 2026 16:28
Backend (new): Express + @xenova/transformers (CLIP) + iovalkey vector search.
Provides POST /api/search/image and /api/debug; seeds ~150 products into a
Valkey HNSW index for KNN similarity lookups.

Frontend: new /search/image page with drag-drop / paste / click upload,
similarity-score badges, category filter chips, and a camera icon in
HeaderOne's search bar to launch it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend (new): Express + ioredis service with NL-driven product search.
  - Catalog mirrors Nocturne & Co. (8 categories x 40 products) seeded into Valkey on startup.
  - Agent: rule-based NLU + optional Gemini parser; planner picks structured + semantic tools; explainer surfaces "not in catalog" verbatim.
  - Search: Valkey ZSETs for price-range, SETs for categories/brands, in-memory hydrate; qToken filter now word-bounded and >=3 chars.
  - image.service.js resolves products to loremflickr -> direct CDN URL, caches in image_cache:* for 7 days; reseed:images script.
  - Cache + session wipes on every startup so code edits aren't masked.

Frontend:
  - Single fetch wrapper lib/api.js used by CategoryPage and ProductPage; both now read the API instead of frontend/src/data/products.js.
  - SearchResultsPage hits /api/agent/search, honors backend's notInCatalog flag, falls back to mockCatalog otherwise.
  - CategoriesPage indexes the 8 Nocturne categories with API-driven previews.
  - ProductImage wrapper + lib/img.js: aspect-ratio container, blur-up fade, srcset, error fallback.
  - Removed all 12 "New" badges from HeaderOne/Two/Three (Pages + Vendors).
  - Header search icon now opens the overlay on every screen size; inline form still navigates to /search.
  - Preconnects added for images.unsplash.com / loremflickr / picsum.

Resolved upstream conflict in App.js: kept Nocturne's /product/:id + NocturneEnhance and my /search + /categories routes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NLU / planner:
  - detectIntent now recognises "expensive / pricier / luxury / flagship" as refine_quality and "less expensive / less than" as refine_budget.
  - detectBudget regex picks up "over £X / above £X / more than £X" and the "more expensive / most expensive" hint phrases.
  - applyBudgetHint recalibrated for the £28–£684 Nocturne range (cheap maxPrice~prevMax*0.6, premium minPrice~200).
  - Refine intents now drop free-text refine-words ("more", "expensive", "cheaper") so the qToken filter doesn't reject products whose hay text never literally contains those words. Sort hint piped through (price-asc for budget, price-desc for quality).
  - search_products tool accepts and forwards sort param.

Search UI:
  - Removed the open/close overlay search box. The middle-header inline form is now always visible on every screen size and fully editable; the search-icon toggle button is gone.
  - Header placeholder hints at NL queries ("more expensive", "under £150", "gift for a friend").

Valkey-backed search:
  - New search-suggest.service.js: tracks every NL search in `search:popular` (ZSET, ZINCRBY) and `search:recent:<sid>` (LIST, LPUSH + LTRIM 10), 30d TTL.
  - On-demand cached `search:terms` SET of product names / categories / tags / brands, refreshed hourly.
  - GET /api/agent/suggestions?q=&sessionId= → prefix + substring matches from terms, sprinkled with popular queries; empty query returns recent + popular.
  - GET /api/agent/popular for top-K most searched queries.
  - SearchSuggestions.jsx component renders a debounced dropdown under the header input. Keyboard navigable (↑/↓/Enter/Esc). Picking a suggestion submits to /search.
  - /api/agent/search fire-and-forget tracks each submitted query.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace Fraunces/JetBrains Mono in nocturne.css with Inter + Plus Jakarta Sans
  for a modern e-commerce look (changes ~150 declarations + the Google Fonts import)
- Add prominent rounded search bar to /shop with image-search shortcut
- Add text-filter search bar on /search/image (filters results by name)
- Swap CategoryPage and ProductPage BottleArt SVG bottles for real category-
  mapped product images

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The home page (HomePageOne) uses HeaderOne and HomePageThree uses HeaderThree;
my earlier rewrite only touched HeaderTwo, so the search input never appeared
on the home page.

  - HeaderOne and HeaderThree: removed the .search-box overlay form and its
    toggle icon; wired the inline middle-header form with useNavigate, value/
    onChange, and the Valkey-backed SearchSuggestions dropdown. Placeholder
    hints at NL queries.
  - nocturne.css had `display: none !important` on `.header-middle
    .search-form` / `.search-category` / `.form-location-wrapper` — replaced
    with `display: flex !important` and reasonable min/max widths so the
    inline search is visible at every screen size now that the overlay is
    gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nocturne.css styled BOTH .search-category.style-two and the inner
.search-form__wrapper as brass pills, so the bar rendered as two concentric
pills with the submit button floating in the gap. Now only the OUTER
.search-form / .search-category container has the border, background, and
fixed height; the inner wrapper is a transparent flex child holding the
input and the absolutely-positioned submit button. Single clean pill on
every header variant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	backend/.env.example
#	backend/.gitignore
#	backend/README.md
#	backend/package-lock.json
#	backend/package.json
#	frontend/src/App.js
#	frontend/src/components/HeaderOne.jsx
#	frontend/src/pages/CategoryPage.jsx
#	frontend/src/pages/ProductPage.jsx
NLU: added 'athletic', 'office', 'casual' themes so "sports", "running shoes",
"hoodies", "tee", "track jacket" route to the closest real Nocturne categories
(footwear, gaming, streetwear) instead of dead-ending. CATEGORY_HINTS gift-ideas
now includes "candle", "candles", "pen", "pens", "fountain pen".

Planner: when a theme is detected, theme keywords are stripped from the free-
text query before search_products is called. Otherwise the qToken filter would
reject every product (none of them literally contain "sports" or "hoodies"
in their text). Fixed a duplicate-declaration of hasTheme that briefly broke
the planner build.

Frontend: SearchResultsPage no longer ships hardcoded "Sports / Stationery /
Food / Headphones" chips. It pulls the live category list from
GET /api/categories on mount; the chips now reflect the real Nocturne
categories.

README: rewrote the top-level README, backend README, and frontend README in
a tone meant for a hackathon judge or a teammate joining late. No emojis.
Includes screenshot placeholders (screenshot1.png, screenshot2.png) at the
repo root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop in the actual catalogue and search-results captures referenced from
the top-level README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pantry is six honest edibles — olive oil, single-origin coffee, oolong tea,
wildflower honey, a dark-chocolate tasting set, and a brass spice tin —
priced £18–£48. Mirrored on the frontend CATEGORIES list so the slim
category strip picks it up.

The qToken filter previously rejected "groceries"/"food" because the literal
words appear in no product hay. The planner default branch now strips
category-hint keywords (not just theme keywords) from the free-text when a
category was matched, so the structured filter does the work alone.

Verified:
  groceries  -> 6 pantry items
  food       -> 6 pantry items
  coffee     -> Whole-bean Coffee
  honey      -> Wildflower Honey
  olive oil  -> Cold-Pressed Olive Oil
  tea        -> Tea, Oolong
  chocolate  -> Dark Chocolate Tasting Set

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Rename backend/server.js, seed.js, lib/*.js to .mjs so the ES-module
  visual search code runs alongside the CommonJS agentic backend
- Update internal import paths to .mjs
- Move /shop search bar above the breadcrumb so it sits at the top center
- Add frontend/.env pointing REACT_APP_SEARCH_API at the visual search
  server on port 4100 (separate from the agentic backend on 4000)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	backend/README.md
#	frontend/src/components/HeaderOne.jsx
#	frontend/src/styles/nocturne.css
The previous merge commit accidentally baked conflict markers into the
search button rule. Keeping the Inter / Plus Jakarta Sans variant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants