Build custom AI chatbots trained on your documents in minutes. Modern UI powered by Next.js + ShadCN, intelligent backend with Flask + Google Gemini.
- Modern UI: Beautiful, responsive interface with ShadCN UI components
- 4-Step Wizard: Easy chatbot creation process
- Document Upload: Support for PDF, DOCX, and TXT files
- RAG Pipeline: Retrieval-Augmented Generation with FAISS + Google Gemini
- Real-time Chat: Interactive messaging interface
- Dashboard: Manage all your chatbots in one place
- AI-Powered: Smart system prompt generation
- TypeScript: Full type safety across the frontend
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Modern utility-first styling
- ShadCN UI - Beautiful, accessible components
- React Hook Form + Zod - Form handling and validation
- Flask 3.0 - Python web framework
- LangChain - RAG pipeline orchestration
- Google Gemini API - Large language model
- FAISS - Vector similarity search
- Sentence Transformers - Local embeddings
- SQLite - Database
- Node.js 18+ and npm
- Python 3.9+
- Google Gemini API Key (Get one here)
- 2GB+ RAM (for embedding model)
git clone <your-repo-url>
cd Yanck-mvp# Install Python dependencies
pip install -r requirements.txt# Create .env file
cp .env.example .envEdit .env and add your Gemini API key:
# Flask Configuration
FLASK_ENV=development
FLASK_SECRET_KEY=your-secret-key-here # Change this!
# Gemini API (REQUIRED)
GEMINI_API_KEY=your-gemini-api-key-here
# Model Configuration (Optional - defaults provided)
EMBEDDING_MODEL=all-MiniLM-L6-v2
CHUNK_SIZE=500
CHUNK_OVERLAP=50
# File Upload (Optional - defaults provided)
MAX_FILE_SIZE_MB=50
MAX_FILES_PER_CHATBOT=10
UPLOAD_FOLDER=./data/uploads
# Vector Store (Optional - defaults provided)
VECTOR_STORE_PATH=./data/vector_stores
# Database (Optional - defaults provided)
DATABASE_PATH=./data/chatbots.dbpython init_db.pypython run.pyBackend will run on http://localhost:5000
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Create .env.local file
echo "NEXT_PUBLIC_API_URL=http://localhost:5000/api" > .env.local
# Start Next.js dev server
npm run devFrontend will run on http://localhost:3000
Visit http://localhost:3000 and start creating chatbots!
- Click "Create Chatbot" from the landing page or dashboard
- Step 1: Set name and system prompt (or use AI generation)
- Step 2: Upload your documents (PDF, DOCX, TXT)
- Step 3: Test your chatbot with sample questions
- Step 4: Deploy and start chatting!
- Dashboard: View all your chatbots
- Search: Filter chatbots by name or description
- Delete: Remove chatbots with confirmation
- Chat: Click any chatbot to start a conversation
- Ask questions about your uploaded documents
- View conversation history
- See which documents are loaded
- Get AI-powered responses based on your content
rag-chatbot-platform/
βββ app.py # Flask application factory
βββ run.py # Application entry point
βββ init_db.py # Database initialization script
βββ requirements.txt # Python dependencies
βββ .env.example # Example environment configuration
βββ .env # Your environment configuration (not in git)
β
βββ models/ # Data models and managers
β βββ database.py # Database utilities
β βββ embedding_manager.py
β βββ vector_store_manager.py
β
βββ services/ # Business logic
β βββ chatbot_service.py
β βββ document_service.py
β βββ query_service.py
β
βββ routes/ # API and web routes
β βββ api_routes.py # REST API endpoints
β βββ web_routes.py # Web page routes
β
βββ templates/ # HTML templates
β βββ base.html
β βββ index.html
β βββ create_step1.html
β βββ create_step2.html
β βββ create_step3.html
β βββ create_step4.html
β βββ chat.html
β
βββ static/ # Static assets
β βββ css/
β β βββ styles.css
β βββ js/
β βββ wizard.js
β βββ chat.js
β
βββ data/ # Application data (created on first run)
βββ chatbots.db # SQLite database
βββ uploads/ # Uploaded documents
βββ vector_stores/ # FAISS vector indices
POST /api/chatbot- Create new chatbotGET /api/chatbot/<id>/status- Get chatbot statusDELETE /api/chatbot/<id>- Delete chatbot
POST /api/chatbot/<id>/documents- Upload documents
POST /api/chatbot/<id>/query- Submit query to chatbot
You can change the embedding model in .env:
# Faster, smaller (384 dimensions) - Default
EMBEDDING_MODEL=all-MiniLM-L6-v2
# Higher quality, larger (768 dimensions)
EMBEDDING_MODEL=all-mpnet-base-v2Adjust how documents are split:
CHUNK_SIZE=500 # Characters per chunk
CHUNK_OVERLAP=50 # Overlap between chunksMAX_FILE_SIZE_MB=50 # Max size per file
MAX_FILES_PER_CHATBOT=10 # Max files per chatbotMake sure you've set your Gemini API key in the .env file:
GEMINI_API_KEY=your-actual-api-key-hereThis usually means insufficient memory. Try:
- Closing other applications
- Using a smaller model:
EMBEDDING_MODEL=all-MiniLM-L6-v2
Reduce file size or increase the limit in .env:
MAX_FILE_SIZE_MB=100Change the port in .env or via environment variable:
FLASK_PORT=8000Run the test suite:
# Run all tests
python -m pytest
# Run specific test file
python -m pytest test_chatbot_service.py
# Run with verbose output
python -m pytest -vDebug mode is enabled by default when FLASK_ENV=development:
FLASK_ENV=development
python run.py- Update models in
models/ - Add business logic in
services/ - Create routes in
routes/ - Add templates in
templates/ - Update tests
- Never commit
.envfile - It contains sensitive API keys - Change
FLASK_SECRET_KEYin production - Validate all file uploads - The app checks file types and sizes
- Use HTTPS in production
- Implement authentication for production use
For production deployment, consider:
-
Use a production WSGI server (Gunicorn, uWSGI)
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 app:app
-
Use PostgreSQL instead of SQLite
-
Implement user authentication
-
Add rate limiting
-
Use cloud storage for uploaded files (AWS S3, etc.)
-
Set up monitoring (Sentry, CloudWatch)
-
Use environment-specific configs
[Your License Here]
For issues and questions, please open an issue on GitHub.
- Built with Flask
- Powered by LangChain
- Embeddings by Sentence Transformers
- LLM by Google Gemini