feat: refactor page components for improved readability and structure#23
Open
saikumarjetti wants to merge 1 commit into
Open
feat: refactor page components for improved readability and structure#23saikumarjetti wants to merge 1 commit into
saikumarjetti wants to merge 1 commit into
Conversation
- Updated HomePageTwo, ProductDetailsPageOne, ProductDetailsPageTwo, ShopPage, VendorDetailsPage, VendorPage, VendorTwoDetailsPage, VendorTwoPage, and WishlistPage to enhance code organization by removing unnecessary imports and comments. - Introduced Zustand stores for authentication, cart management, chat functionality, cursor state, and server-sent events to streamline state management across the application. - Implemented error handling and loading states in the cart and chat stores to improve user experience during asynchronous operations.
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.
Title: Polish demo: clear chat, expanded catalog, agent guardrails
Description:
Tightens the shopping demo across three surfaces and ships an architecture brief that puts Valkey front and center.
What changed
Clear chat history from the assistant panel. New DELETE /api/agent/messages route, optimistic frontend store action, and a chat.cleared SSE event so all open tabs reset together.
Catalog expansion. ~24 new products across every leaf category with deliberately spread ratings (3.8 to 4.8) and real image URLs wired to the bundled theme thumbnails.
Agent clarification rule. Vague single-word queries ("phones", "laptops") now trigger a short follow-up with concrete options instead of an arbitrary search.
GotoTop removed from 18 page components and
Animation.jsx
; react-scroll-to-top dependency dropped.
ARCHITECTURE.md
— short brief on pub/sub, SSE, vector embeddings, similarity search, and the WebMCP-style action layer.
Valkey features showcased
This demo leans on Valkey for two load-bearing roles:
Feature Where What it does
Pub/Sub
bus.js
,
valkey.js
Per-user channel user::events carries cart.updated, chat.*, and ui.command. Two connections (cmd + sub) per the Redis protocol. Sub-millisecond fanout drives the multi-device sync and the AI's virtual cursor.
Vector store
vectorStore.js
, seedEmbeddings.js embeddings:vectors HASH (productId → base64 Float32) + embeddings:meta HASH (model, dim, count, builtAt). Atomic single-key HSET for the full index, in-process cache invalidated by meta.builtAt.
Semantic similarity
semanticSearch.js
Cosine over L2-normalized 384-d vectors collapses to a dot product. Powers the agent's semantic_search tool for descriptive queries ("something to keep my coffee warm"). Drop-in path to FT.SEARCH KNN when Valkey Search is enabled.
Pub/Sub → SSE bridge
stream.js
,
stream.js
One EventSource per signed-in user. Hello snapshot on connect, 25s heartbeat, refcounted subscriptions so multiple tabs share one Valkey subscriber.
Graceful degradation
bus.js
Falls back to an in-process EventEmitter if Valkey is unreachable, so the dev server never hard-fails.