How deeparajasabeson/ecommerce-ai-assistant works
This repository implements a React chat interface backed by a FastAPI e-commerce API and an Azure AI Foundry multi-agent assistant. The main workflow is customer prompt → chat request → orchestrator routing → specialist agent tools → REST endpoints → PostgreSQL-backed repositories, with the response and agent label returned to the UI. Product, order, shipping, customer, and payment APIs are also exposed independently. Payment chat is documented as a fixed Cash on Delivery response rather than a specialist-agent flow. Some subsystem links rely on README documentation because their source was not sampled.
Main entry points: repositories.py Repository providers · main.py FastAPI app · api_client.py E-commerce API client · App.tsx Chat app
Components 28
Chat interface
- Chat app
frontend/src/App.tsx - Chat input
frontend/src/components/ChatInput.tsx - Conversation view
frontend/src/components/ChatMessages.tsx - Agent sidebar
frontend/src/components/Sidebar.tsx - Chat client
frontend/src/services/chatService.ts
Chat and routing
- Chat endpoint
backend/app/routes/chat.py - Orchestrator service
backend/app/services/orchestrator_service.py
AI agents and tools
- Query orchestrator
backend/ai/orchestrator/intelligent.py - Specialist agents
backend/ai/agents - Agent runtime
backend/ai/agents/base.py - Tool definitions
backend/ai/tools/definitions.py - Tool executors
backend/ai/tools/executors.py - E-commerce API client
backend/ai/tools/api_client.py
Store API
- FastAPI app
backend/main.py - Product API
backend/app/routes/product.py - Order API
backend/app/routes/order.py - Shipping API
backend/app/routes/shipping.py - Customer API
backend/app/routes/customer.py - Payment API
backend/app/routes/payment.py
Persistence
- Repository providers
backend/app/data/repositories.py - Product repository
backend/app/data/product_repository.py - Order repository
backend/app/data/order_repository.py - Shipping repository
backend/app/data/shipping_repository.py - Customer repository
backend/app/data/customer_repository.py - PostgreSQL pool
backend/app/database.py
Other components
- Customer
- PostgreSQL
- Azure AI Foundry
Connections 37
- Customer → Chat app: enters prompt
- Chat app → Chat input: renders
frontend/src/App.tsx - Chat app → Conversation view: renders
frontend/src/App.tsx - Chat app → Agent sidebar: renders
frontend/src/App.tsx - Chat app → Chat client: sends query
frontend/src/App.tsx - Chat client → Chat endpoint: POSTs query
- Chat endpoint → Orchestrator service: routes query
backend/app/routes/chat.py - Orchestrator service → Query orchestrator: routes query
backend/app/services/orchestrator_service.py - Orchestrator service → Specialist agents: initializes
backend/app/services/orchestrator_service.py - Query orchestrator → Specialist agents: dispatches query
backend/ai/orchestrator/intelligent.py - Specialist agents → Agent runtime: extends runtime
backend/ai/agents/order.py - Agent runtime → Tool definitions: registers tools
backend/ai/agents/order.py - Agent runtime → Tool executors: loads callbacks
backend/ai/agents/base.py - Tool executors → E-commerce API client: calls API methods
backend/ai/tools/executors.py - E-commerce API client → Product API: requests products
- E-commerce API client → Order API: requests orders
- E-commerce API client → Shipping API: requests shipping
- E-commerce API client → Customer API: requests customers
- E-commerce API client → Payment API: requests payments
backend/ai/tools/api_client.py - FastAPI app → Product API: registers router
backend/main.py - FastAPI app → Order API: registers router
backend/main.py - FastAPI app → Shipping API: registers router
backend/main.py - FastAPI app → Customer API: registers router
backend/main.py - FastAPI app → Payment API: registers router
backend/main.py - FastAPI app → Chat endpoint: registers router
backend/main.py - Product API → Repository providers: uses dependency
backend/app/routes/product.py - Order API → Repository providers: uses dependency
backend/app/routes/order.py - Shipping API → Repository providers: uses dependency
backend/app/routes/shipping.py - Customer API → Repository providers: uses dependency
backend/app/routes/customer.py - Payment API → Repository providers: uses dependency
backend/app/routes/payment.py - Repository providers → Product repository: provides
backend/app/data/repositories.py - Repository providers → Order repository: provides
backend/app/data/repositories.py - Repository providers → Shipping repository: provides
backend/app/data/repositories.py - Repository providers → Customer repository: provides
backend/app/data/repositories.py - FastAPI app → PostgreSQL pool: initializes pool
backend/main.py - PostgreSQL pool → PostgreSQL: opens connections
backend/app/database.py - Specialist agents → Azure AI Foundry: uses agents
backend/ai/agents/base.py