How hoangle10ck-sys/smart-shopping-ai-part01 works
Smart Shopping AI is a Vietnamese-language shopping assistant with Demo, historical Research Catalog, and configurable Live search modes. The principal workflow turns a shopper’s request into generated queries, retrieved and normalized product offers, filtered and ranked recommendations, and persisted evidence-backed snapshots shown in the frontend. Separate branches cover product detail, comparison, feedback, history, catalog research, and optional marketplace collection. The README documents the broad workflow; source excerpts establish selected internal calls and application routing, so unsampled service-to-service links are omitted where not documented.
Main entry points: main.py FastAPI application · recommendation_service.py Recommendation orchestration · page.tsx Results view · search_service.py Search orchestration
Components 31
Shopping interface
- Shopping pages
frontend/app/page.tsx - Results view
frontend/app/results/[sessionId]/page.tsx - Product detail
frontend/app/products/[productId]/page.tsx - Comparison view
frontend/app/compare/[comparisonId]/page.tsx - History view
frontend/app/history/page.tsx - Browser API client
frontend/lib/api.ts
API and request handling
- FastAPI application
backend/app/main.py - Requirement handling
backend/app/api/routes/requirements.py - Search endpoint
backend/app/api/routes/search.py - Recommendation endpoint
backend/app/api/routes/recommendations.py - Research catalog
backend/app/api/routes/research.py - Comparison endpoint
backend/app/api/routes/comparison.py - Feedback endpoint
backend/app/api/routes/feedback.py - History endpoint
backend/app/api/routes/history.py
Product discovery
- Query generation
backend/app/services/llm/query_generator.py - Search orchestration
backend/app/services/search/search_service.py - Search providers
backend/app/services/search/tavily_provider.py - Product extraction
backend/app/services/extraction/product_extraction_service.py - Normalization
backend/app/services/normalization/product_normalizer.py
Recommendation and evidence
- Recommendation orchestration
backend/app/services/recommendation/recommendation_service.py - Scoring and matching
backend/app/services/scoring/scoring_engine.py - AI explanation
backend/app/services/llm/explanation_service.py - Recommendation snapshot
backend/app/models/recommendation_snapshot.py
Catalog and persistence
- Normalize and persist
backend/app/services/normalization/normalization_service.py - Product deduplication
backend/app/services/dedup/product_deduplicator.py - Marketplace collectors
backend/app/services/collectors/catalog_ingestion.py - SQLite database
backend/app/core/database.py - Search cache
backend/app/services/search/cached_search_service.py
Other components
- Shopper
- Tavily search
- OpenAI / Gemini
Connections 37
- Shopper → Shopping pages: enters request
README.md - Shopping pages → Browser API client: submits request
README.md - Browser API client → FastAPI application: calls API
README.md - FastAPI application → Requirement handling: registers routes
backend/app/main.py - FastAPI application → Search endpoint: registers routes
backend/app/main.py - FastAPI application → Recommendation endpoint: registers routes
backend/app/main.py - FastAPI application → Research catalog: registers routes
backend/app/main.py - FastAPI application → Comparison endpoint: registers routes
backend/app/main.py - FastAPI application → Feedback endpoint: registers routes
backend/app/main.py - FastAPI application → History endpoint: registers routes
backend/app/main.py - Requirement handling → Query generation: generates queries
README.md - Query generation → Search orchestration: provides queries
README.md - Search orchestration → Search providers: dispatches searches
backend/app/services/search/search_service.py - Search providers → Tavily search: queries
- Search orchestration → Product extraction: extracts candidates
backend/app/services/search/search_service.py - Product extraction → Normalization: normalizes candidates
backend/app/services/extraction/product_extraction_service.py - Normalization → Normalize and persist: normalizes records
backend/app/services/normalization/normalization_service.py - Normalize and persist → Product deduplication: deduplicates products
backend/app/services/normalization/normalization_service.py - Normalize and persist → SQLite database: persists offers
backend/app/services/normalization/normalization_service.py - Search endpoint → Recommendation orchestration: runs recommendations
README.md - Recommendation endpoint → Recommendation orchestration: serves recommendations
README.md - Recommendation orchestration → Scoring and matching: scores candidates
backend/app/services/recommendation/recommendation_service.py - Recommendation orchestration → AI explanation: requests explanations
backend/app/services/recommendation/recommendation_service.py - AI explanation → OpenAI / Gemini: requests generation
- Recommendation orchestration → Recommendation snapshot: persists snapshot
README.md - Recommendation snapshot → SQLite database: stored in
README.md - Recommendation orchestration → Results view: returns results
README.md - Results view → Product detail: opens detail
README.md - Results view → Comparison view: compares products
README.md - Shopping pages → Research catalog: searches catalog
README.md - Research catalog → Results view: shows catalog results
README.md - Comparison endpoint → Comparison view: serves comparison
README.md - History endpoint → History view: serves history
README.md - Feedback endpoint → Results view: records feedback
README.md - Search orchestration → Search cache: reuses live snapshots
backend/app/services/search/cached_search_service.py - Marketplace collectors → Normalize and persist: normalizes ingestion
backend/app/services/collectors/catalog_ingestion.py - Marketplace collectors → SQLite database: records crawl runs
backend/app/services/collectors/catalog_ingestion.py