A powerful Retrieval-Augmented Generation (RAG) chatbot that integrates with Google Drive, allowing users to query their documents using natural language. Built with FastAPI backend and Next.js frontend.
- Google OAuth Authentication - Secure sign-in with Google accounts
- Google Drive Integration - Access and list documents from Google Drive
- Multi-format Support - Works with Google Docs, PDFs, DOCX, TXT, and PPTX files
- RAG Pipeline - Intelligent document querying using ChromaDB and Gemini AI
- Smart Fallback - Falls back to general knowledge when answers aren't found in documents
- Clean UI - Modern, responsive interface built with Next.js and Tailwind CSS
- Text Extraction - Advanced content extraction from various file formats
- Intelligent Chunking - Smart text splitting for optimal retrieval
- Vector Embeddings - Semantic search using sentence transformers
- Knowledge Base Management - Add/remove documents from the AI knowledge base
- Natural Language Queries - Ask questions in plain English
- Contextual Responses - Answers based on your specific documents
- Clean Formatting - Well-formatted responses without markdown artifacts
- Multi-document Support - Query across multiple documents simultaneously
- FastAPI - Modern Python web framework
- ChromaDB - Vector database for embeddings
- Google APIs - Drive and Docs integration
- Gemini 2.0 Flash - Advanced AI model for generation
- Sentence Transformers - Text embedding generation
- Next.js 13+ - React framework with App Router
- Tailwind CSS - Utility-first CSS framework
- Shadcn UI - Modern component library
- TypeScript - Type-safe development
- Docker - Containerized deployment
- Supabase - Optional user management
- Environment Variables - Secure configuration management
- Python 3.8+
- Node.js 16+
- Google Cloud Console project with APIs enabled
- Gemini API key
git clone https://github.com/santoshnaya/codemet-rag-chatbot.git
cd codemet-rag-chatbot-
Go to Google Cloud Console
-
Create a new project or select existing one
-
Enable the following APIs:
- Google Drive API
- Google Docs API
- Google+ API
-
Create OAuth 2.0 credentials:
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth 2.0 Client IDs
- Set Authorized redirect URIs to:
http://localhost:3000/auth/callback
# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Gemini API Configuration
GEMINI_API_KEY=your_gemini_api_key
# Supabase Configuration (Optional)
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_key
# Development Settings
ENVIRONMENT=development# Google OAuth Configuration
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id
# Backend Configuration
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
# Supabase Configuration (Optional)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keycd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtnpm installcd backend
source venv/bin/activate
python main.pynpm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Sign In: Click "Sign in with Google" and authorize the application
- Browse Documents: Navigate to the Documents tab to see your Google Drive files
- Add to Knowledge Base: Select documents and add them to the chatbot's knowledge base
- Start Chatting: Go to the Chat tab and ask questions about your documents
- Get Answers: Receive intelligent responses based on your document content
docker-compose up --builddocker build -f Dockerfile.backend -t rag-chatbot-backend .
docker run -p 8000:8000 rag-chatbot-backenddocker build -f Dockerfile.frontend -t rag-chatbot-frontend .
docker run -p 3000:3000 rag-chatbot-frontend- Connect your GitHub repository to Render
- Set the following configuration:
- Root Directory:
backend - Build Command:
pip install -r requirements.txt - Start Command:
python main.py - Environment Variables: Add all backend environment variables
- Root Directory:
- Connect your GitHub repository to Vercel
- Set the following configuration:
- Framework Preset: Next.js
- Root Directory:
.(root) - Build Command:
npm run build - Environment Variables: Add all frontend environment variables
POST /auth/google- Google OAuth authenticationGET /health- Health check
GET /documents- List user documentsPOST /documents/add- Add documents to knowledge baseDELETE /documents/{id}- Remove document from knowledge base
POST /chat- Chat with documentsGET /debug/knowledge-base- Debug knowledge base content
GET /user/profile- Get user profile
-
Authentication Failed
- Check Google Cloud Console redirect URI:
http://localhost:3000/auth/callback - Ensure APIs are enabled (Drive, Docs, Google+)
- Verify client ID and secret in environment variables
- Check Google Cloud Console redirect URI:
-
Documents Not Loading
- Check Google Drive API permissions
- Verify access token is valid
- Ensure proper scopes are requested
-
Chat Not Working
- Check Gemini API key
- Verify documents are added to knowledge base
- Check backend logs for errors
/debug- OAuth configuration debug/debug-auth- Authentication status and token testing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google APIs for document integration
- Gemini AI for intelligent responses
- ChromaDB for vector storage
- Next.js and FastAPI communities
If you encounter any issues or have questions:
- Check the Issues section
- Create a new issue with detailed information
- Include error logs and environment details
Built with β€οΈ using FastAPI, Next.js, and Google AI