Skip to content

Boburmirzo/smart-shopping-assistant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Smart Shopping Agent with Memori

A complete smart shopping assistant application powered by DigitalOcean AI agents and Memori for persistent memory.

🌟 Features

  • Memory-Enhanced Shopping: Remembers customer preferences and shopping history using Memori
  • DigitalOcean AI Integration: Powered by DigitalOcean's AI platform for intelligent responses
  • Modern Web Interface: Beautiful Next.js frontend with Tailwind CSS
  • Real-time Chat: Interactive chatbot for shopping assistance
  • Product Catalog: Browse and search products with filters
  • RESTful API: FastAPI backend with comprehensive endpoints
  • Persistent Memory: Customer interactions stored and recalled across sessions

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     β”‚    β”‚                     β”‚    β”‚                     β”‚
β”‚    Next.js          β”‚    β”‚    FastAPI          β”‚    β”‚   DigitalOcean AI   β”‚
β”‚    Frontend         │◄────    Backend          │◄────    Platform         β”‚
β”‚                     β”‚    β”‚                     β”‚    β”‚                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚                     β”‚
                           β”‚   Memori Memory     β”‚
                           β”‚   System (SQLite)   β”‚
                           β”‚                     β”‚
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

smart_shopping_digitalocean/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                 # FastAPI application
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   └── .env.example           # Environment configuration template
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   └── page.tsx       # Main page component
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Chatbot.tsx    # Chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatInput.tsx  # Chat input component
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatMessage.tsx # Message display
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductCard.tsx # Product display card
β”‚   β”‚   β”‚   └── ProductGrid.tsx # Product grid layout
β”‚   β”‚   └── lib/
β”‚   β”‚       └── api.ts         # API service
β”‚   β”œβ”€β”€ package.json           # Node.js dependencies
β”‚   └── .env.local            # Frontend environment
└── README.md                 # This file

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • Node.js 18+
  • DigitalOcean AI account with API credentials

1. Backend Setup

cd backend

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your DigitalOcean AI credentials:
# agent_endpoint=your-digitalocean-agent-endpoint
# agent_access_key=your-digitalocean-agent-access-key

# Start the FastAPI server
uvicorn main:app --reload --host 0.0.0.0 --port 8000

2. Frontend Setup

cd frontend

# Install dependencies
npm install

# Start the development server
npm run dev

3. Access the Application

πŸ”§ Configuration

DigitalOcean AI Setup

  1. Create a DigitalOcean AI account
  2. Get your agent endpoint and access key
  3. Set the environment variables in backend/.env:
agent_endpoint=https://your-agent-endpoint.digitalocean.com
agent_access_key=your-agent-access-key

Memory System

The Memori system automatically creates a SQLite database to store conversation history and customer preferences. No additional setup required.

πŸ“‘ API Endpoints

Chat

  • POST /chat - Send message to AI assistant

Products

  • GET /products - Get all products
  • POST /products/search - Search products with filters
  • GET /products/{id} - Get specific product
  • GET /categories - Get product categories

Memory

  • GET /memory/search - Search customer memory (admin)

🎨 Frontend Features

Chat Interface

  • Real-time messaging with the AI assistant
  • Message history with timestamps
  • Loading indicators and error handling
  • Responsive design for all devices

Product Catalog

  • Grid layout with product cards
  • Search functionality
  • Category filtering
  • Product images and ratings
  • Add to cart functionality

Memory Integration

  • Customer preferences remembered across sessions
  • Personalized product recommendations
  • Shopping history recall

πŸ” How It Works

  1. Customer Interaction: User chats with the AI assistant about shopping needs
  2. Memory Search: System searches previous interactions for context
  3. AI Processing: DigitalOcean AI generates personalized responses
  4. Memory Storage: Conversation stored in Memori for future reference
  5. Product Recommendations: AI suggests relevant products from catalog

πŸ› οΈ Development

Adding New Features

  1. Backend: Add new endpoints in main.py
  2. Frontend: Create new components in src/components/
  3. API Integration: Update src/lib/api.ts

Customizing the Product Catalog

Edit the PRODUCT_CATALOG in backend/main.py to add your own products with:

  • Product information
  • Images
  • Categories
  • Descriptions

πŸ› Troubleshooting

Backend Issues

  • Service not initialized: Check DigitalOcean credentials in .env
  • Memory errors: Ensure SQLite database is writable
  • CORS errors: Verify frontend URL in CORS middleware

Frontend Issues

  • API connection failed: Verify backend is running on port 8000
  • Build errors: Check Next.js and TypeScript configuration
  • Styling issues: Ensure Tailwind CSS is properly configured

πŸ“ License

This project is part of the Memori demonstration suite. Please refer to the main Memori license for usage terms.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“ž Support

For issues related to:

  • Memori: Check the main Memori documentation
  • DigitalOcean AI: Consult DigitalOcean AI platform docs
  • This Demo: Create an issue in the repository

Smart Shopping with AI Memory - Making every shopping experience personal! πŸ›οΈπŸ€–

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%