🧠 RAG Chatbot

Advanced RAG chatbot with knowledge base integration, vector similarity search, conversation history, streaming responses, hybrid search, analytics dashboard, and feedback system.
Try Interactive Demo

📖 Project Overview

RAG Chatbot is an advanced Python application that implements Retrieval-Augmented Generation architecture for intelligent conversations. This project offers knowledge base integration, vector similarity search, conversation history, streaming responses, hybrid search, analytics dashboard, feedback system, and a beautiful responsive web interface. Perfect for developers, businesses, and organizations looking to build domain-specific chatbots, knowledge management systems, and AI-powered applications.

⚡ Quick Facts

🎯 Type: RAG Chatbot with LangChain & ChromaDB
🤖 Bot Features: AI Assistance, Task Management, Sentiment Analysis, Meeting Summaries, Polls, Channel Analytics
⚡ Setup Time: ~5 minutes
📦 Backend: Python Bot Server
🎨 Frontend: PHP Dashboard, HTML5, CSS3, JavaScript ES6+
🧠 AI API: OpenAI API / LangChain Framework
📱 Responsive: Mobile, Tablet, Desktop
🔧 Technologies: Python, OpenAI API, ChromaDB, LangChain
25+
Files
5000+
Lines of Code
20+
Advanced Features
20+
Bot Commands
Developer: Molla Samser | Website: rskworld.in | Email: help@rskworld.in
Difficulty Level: Beginner - Perfect for developers learning Python, LangChain integration, RAG architecture, AI chatbot development, and knowledge management systems.

✨ Features

Core Features

🤖 RAG Architecture Implementation

Retrieval-Augmented Generation architecture for accurate responses using vector similarity search and knowledge base integration.

⌨️ Command Handling

Easily parse and respond to user commands like /start, /help, /qr, /speak, /translate, /weather, and more.

🔘 Inline Keyboards

Interactive buttons and menus for enhanced user experience with seamless navigation and quick actions.

📁 File Sharing

Capabilities to handle file uploads and downloads for document sharing and media management.

Utility Commands

📱 QR Code Generator

Generate QR codes from any text using the /qr command for quick sharing and information transfer.

🎤 Text to Speech

Convert text to voice notes using the /speak command for hands-free interaction and accessibility.

📄 PDF Creator

Create PDF documents from text using the /pdf command for document generation and sharing.

🌐 Language Translator

Translate text to multiple languages using the /translate command for multilingual communication.

☁️ Weather Info

Get weather information for any city using the /weather command with real-time data.

📝 Text Summarizer

Summarize long text using the /summarize command for quick content understanding.

Advanced Features

🤖 AI Assistant

Intelligent responses using OpenAI API or rule-based system with the /ai command for smart interactions.

⏰ Task Reminders

Set personal reminders using the /remind command for task management and productivity.

🔑 Password Generator

Generate secure random passwords using the /password command for account security.

🔗 URL Shortener

Shorten long URLs using the /shorten command for easy sharing and link management.

🧮 Calculator

Perform mathematical calculations using the /calc command for quick computations.

🔄 Unit Converter

Convert between different units using the /convert command for measurement conversions.

📰 News Fetcher

Get latest news articles using the /news command for staying informed.

🏆 User Leaderboard

View top users by XP using the /leaderboard command for gamification and engagement.

⭐ XP & Leveling System

Users earn XP and level up by using the bot, creating an engaging experience with progression tracking.

👤 User Profiles

View detailed user statistics using the /profile command for personal insights and achievements.

📊 Admin Dashboard

PHP-based dashboard to monitor bot statistics, user data, feedback, and comprehensive analytics.

💬 Group Chat Support

Functionality tailored for both private and group interactions with comprehensive bot features.

🛠️ Technologies

Python

Backend chatbot with RAG architecture

Backend

LangChain Framework

Python framework for LLM orchestration

Framework

OpenAI API

OpenAI API for AI chatbot functionality

Bot API

SQLite

Lightweight database for user data and statistics

Database

PHP

Admin dashboard and web interface

Backend

JavaScript ES6+

Frontend interactivity and API integration

Frontend

HTML5/CSS3

Modern web interface and styling

UI

OpenAI API

Optional AI integration for advanced features

AI API

OpenWeatherMap API

Optional weather data integration

Weather API

📦 Installation Guide - Step by Step

⏱️ Installation Time: ~5 minutes

Follow these simple steps to set up the RAG Chatbot on your system.

📋 Prerequisites

🐍 Python 3.8+

Python 3.8 or higher required for the RAG Chatbot server

Download: Python

🔑 OpenAI API Key

Get your API key from OpenAI (required for AI functionality)

Get Key: OpenAI API

🌐 Modern Web Browser

Chrome, Edge, Safari, or Firefox for the frontend interface

🌐 Internet Connection

Required for OpenAI API calls and CDN resources

🚀 Step-by-Step Installation

📌 Step 1: Download or Clone the Project

Option A: Download ZIP

  1. Download the project ZIP file from the repository
  2. Extract it to your desired location (e.g., C:\Projects\rag-chatbot or ~/Projects/rag-chatbot)
  3. Navigate to the extracted folder

Option B: Clone with Git

git clone https://github.com/rskworld/rag-chatbot.git
cd rag-chatbot
✅ Step 2: Install Python Dependencies

Install required Python packages using pip.

# Install dependencies
pip install -r requirements.txt
🔑 Step 3: Set Up Bot Token

Configure your OpenAI API key in the environment file.

  1. Copy env.example to .env
  2. Edit .env and add your OpenAI API key: OPENAI_API_KEY=your_api_key_here
  3. Get your API key from OpenAI Platform
  4. Optional: Add ADMIN_ID=your_slack_user_id for admin features
🚀 Step 4: Start the Bot

Start the RAG chatbot server.

# Start RAG chatbot
python app.py

# Or use the start script
# Windows: run.bat
# Linux/Mac: ./run.sh
🌐 Step 5: Access Admin Dashboard (Optional)

Open the PHP dashboard in your browser to monitor bot statistics.

Method 1: Direct File Opening

  1. Open dashboard.php in your browser

Method 2: Using Local Web Server (Recommended)

# In a new terminal, start HTTP server
python -m http.server 8000

# Then open: http://localhost:8000/dashboard.php

✅ Installation Complete!

Congratulations! You've successfully set up the RAG Chatbot. The chatbot is ready to use with all features including:

  • RAG architecture with LangChain for AI chatbot functionality
  • Command handling for /help, /task-create, /task-list, /set-reminder, /summarize-meeting, /poll, /weather, and more
  • AI assistance with adaptive personalities (Professional, Casual, Technical, Friendly, Formal)
  • Task management with priorities and due dates
  • Smart reminders, meeting summaries, channel analytics, interactive polls
  • Weather info, language translator, notes, quotes, standup templates
  • Sentiment analysis, multi-language support, productivity automation
  • Admin dashboard for bot statistics and user management
  • Team collaboration tools and workspace integration

Next Steps:

  1. Ensure the bot is running (Step 4)
  2. Open your browser and navigate to the chatbot interface
  3. Use /help command to see all available commands
  4. Try commands like /task-create, /task-list, /set-reminder, /summarize-meeting, /poll, /weather, and more!
  5. Access the admin dashboard to view bot statistics

🔧 Troubleshooting Installation

❌ Bot Token Issues

Solution: Ensure your .env file contains a valid OPENAI_API_KEY. Get your key from OpenAI Platform.

❌ Bot Not Starting

Solution: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt, ensure bot token is correct.

❌ Connection Errors

Solution: Verify server is running, check internet connection, ensure OpenAI API is accessible, verify API key is valid and active.

❌ Import Errors

Solution: Reinstall dependencies, check virtual environment is activated, verify all packages in requirements.txt are installed.

📚 Usage Guide - Step by Step

🎯 Getting Started with RAG Chatbot

Step-by-Step Usage Instructions

📝 Step 1: Start Bot

  1. Ensure bot is running: python bot.py
  2. Check bot logs for connection status
  3. You should see: Bot started successfully or similar message

🌐 Step 2: Open Chatbot

  1. Open your web browser and navigate to the chatbot
  2. Invite the bot to your workspace
  3. Start using the bot in any channel
  4. You can use the bot with:
    • Slash commands (/help, /task-create, etc.)
    • Mention @BotAssistant for AI assistance
    • Command list and help information

💬 Step 3: Try Bot Commands

  1. Basic Commands: Try /start, /help, /features, /profile
  2. Utility Commands: Try /qr, /speak, /translate, /pdf, /weather
  3. Advanced Commands: Try /ai, /remind, /password, /shorten, /calc, /convert, /news
  4. Try These Examples:
    • /qr Hello World - Generate QR code
    • /speak Hello - Convert text to speech
    • /translate en Hello - Translate text
    • /weather London - Get weather info
    • /ai What is Python? - Ask AI assistant
    • /calc 2+2 - Calculate
    • /password 16 - Generate password
  5. View Responses: Bot will respond with formatted text, inline keyboards, and interactive features

⚙️ Step 4: Explore Features

Try out the bot features:

  • Inline Keyboards: Use interactive buttons for quick actions
  • User Profiles: Check your profile with /profile command
  • Leaderboard: View top users with /leaderboard command
  • Task Reminders: Set reminders with /remind command
  • File Sharing: Upload and download files through the bot
  • Group Support: Use bot in group chats for shared features
  • Admin Features: Use /stats and /broadcast commands (admin only)
  • XP System: Earn XP and level up by using bot commands

📊 Step 5: Access Admin Dashboard

Monitor bot statistics and user data:

  • Dashboard: Open dashboard.php in your browser
  • Statistics: View bot usage, user count, command statistics
  • User Management: View user profiles, XP, levels, and activity
  • Feedback: View and manage user feedback
  • Leaderboard: View top users and rankings
  • Export Data: Export bot database and statistics

💻 Using RAG Chatbot API

You can integrate RAG Chatbot into your own applications:

# Python RAG Chatbot example from rag_chatbot import RAGChatbot # Initialize the chatbot chatbot = RAGChatbot() # Add knowledge to the base chatbot.add_to_knowledge("Python is a programming language.") # Query the chatbot response = chatbot.query("What is Python?") print(response) # Output: Python is a programming language. def main(): application = Application.builder().token("YOUR_BOT_TOKEN").build() application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command)) application.run_polling() if __name__ == '__main__': main()
# Python example - Send message import requests def send_message(chat_id, text): url = f"https://api.telegram.org/bot{YOUR_BOT_TOKEN}/sendMessage" data = {"chat_id": chat_id, "text": text} response = requests.post(url, json=data) return response.json()

📊 Features Usage

🤖 AI Assistant

Mention @BotAssistant in any channel for AI-powered assistance with adaptive personalities

📋 Task Management

Use /task-create and /task-list commands to manage tasks with priorities and due dates

⏰ Smart Reminders

Use /set-reminder command to set reminders with natural language time parsing

📝 Meeting Summaries

Use /summarize-meeting command to generate AI-powered summaries from channel conversations

📊 Channel Analytics

Use /manage-channel command to get comprehensive channel health reports and analytics

📊 Interactive Polls

Use /poll command to create interactive polls for team decisions

🌐 Language Translator

Use /translate command to translate text to multiple languages

☁️ Weather Info

Use /weather command to get weather information for any city

💬 Quick Notes

Use /note command to create and save quick notes

💡 Motivational Quotes

Use /quote command to get random motivational quotes

🎲 Random Generator

Use /random command to generate random numbers or choose from options

📋 Standup Templates

Use /standup command to get daily standup format templates

⚙️ Bot Settings

Use /bot-settings command to configure bot personality and language preferences

📊 Sentiment Analysis

VADER-powered sentiment detection for message analysis (POSITIVE, NEGATIVE, NEUTRAL, URGENT)

🌍 Multi-language Support

Support for multiple languages: English, Hindi, Spanish, French, German

💼 Adaptive Personalities

Switch between Professional, Casual, Technical, Friendly, and Formal AI modes

📊 Admin Dashboard

Access dashboard.php to monitor bot statistics and user data

🚀 Advanced Features & Capabilities

The RAG Chatbot includes advanced AI capabilities and interactive features. Here's what you can do:

⌨️ Command Handling

Easy parsing and response to user commands

The bot easily parses and responds to user commands like /start, /help, /qr, /speak, /translate, /weather, /ai, /remind, /password, /shorten, /calc, /convert, /news, /summarize, and more. Each command provides specific functionality for enhanced user experience.

🔘 Inline Keyboards

Interactive buttons and menus

Interactive buttons and menus for enhanced user experience. Users can navigate through bot features using inline keyboards, making interactions seamless and intuitive.

📊 User Management & XP System

XP system and user leaderboard

Users earn XP and level up by using the bot, creating an engaging experience with progression tracking. View top users with /leaderboard and check your profile with /profile command.

📱 Utility Commands

QR code, PDF, translator, weather, and more

The bot includes multiple utility commands for QR code generation, PDF creation, language translation, weather information, text-to-speech, password generation, URL shortening, calculations, unit conversion, news fetching, and text summarization.

💡 Interactive Features: All features are interactive and responsive. The bot supports both private and group chats, with comprehensive command handling and inline keyboards for optimal user experience.

💻 Code Examples

Basic RAG Chatbot Integration

# Python RAG Chatbot - app.py from flask import Flask, request, jsonify from rag_chatbot import RAGChatbot app = Flask(__name__) chatbot = RAGChatbot() @app.route('/query', methods=['POST']) def query(): data = request.json response = chatbot.query(data['message']) return jsonify({'response': response}) async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text('Available commands: /start, /help, /qr, /speak') def main(): token = os.getenv('SLACK_BOT_TOKEN') application = Application.builder().token(token).build() application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command)) application.run_polling() if __name__ == '__main__': main()

Command Handler Example

# Python example - QR Code command from telegram import Update from telegram.ext import CommandHandler import qrcode import io async def qr_command(update: Update, context: ContextTypes.DEFAULT_TYPE): text = ' '.join(context.args) if context.args else 'Hello World' qr = qrcode.QRCode(version=1, box_size=10, border=5) qr.add_data(text) qr.make(fit=True) img = qr.make_image(fill_color="black", back_color="white") bio = io.BytesIO() img.save(bio, 'PNG') bio.seek(0) await update.message.reply_photo(photo=bio, caption=f'QR Code for: {text}') # Register command application.add_handler(CommandHandler("qr", qr_command))

Complete RAG Chatbot Example

# RAG Chatbot Class from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.ext import Application, CommandHandler, CallbackQueryHandler class TelegramBot: def __init__(self, token): self.token = token self.application = Application.builder().token(token).build() self.setup_handlers() def setup_handlers(self): self.application.add_handler(CommandHandler("start", self.start)) self.application.add_handler(CommandHandler("help", self.help)) self.application.add_handler(CallbackQueryHandler(self.button_callback)) async def start(self, update: Update, context): keyboard = [ [InlineKeyboardButton("Help", callback_data='help')], [InlineKeyboardButton("Features", callback_data='features')] ] reply_markup = InlineKeyboardMarkup(keyboard) await update.message.reply_text('Welcome!', reply_markup=reply_markup) async def button_callback(self, update: Update, context): query = update.callback_query await query.answer() await query.edit_message_text(text=f"Selected: {query.data}") # Usage bot = TelegramBot('YOUR_BOT_TOKEN') bot.application.run_polling()

Configuration Example

# Bot config - config.py import os class Config: SLACK_BOT_TOKEN = os.getenv('SLACK_BOT_TOKEN') ADMIN_ID = int(os.getenv('ADMIN_ID', 0)) DATABASE_PATH = 'bot.db' OPENAI_API_KEY = os.getenv('OPENAI_API_KEY', '') # Optional WEATHER_API_KEY = os.getenv('WEATHER_API_KEY', '') # Optional # Bot settings MAX_MESSAGE_LENGTH = 4096 COMMAND_PREFIX = '/' ENABLE_LOGGING = True
# .env file example SLACK_BOT_TOKEN=your_bot_token_here ADMIN_ID=123456789 OPENAI_API_KEY=sk-your-key-here # Optional WEATHER_API_KEY=your_weather_key # Optional

🔗 RAG Chatbot API Integration

RAG Chatbot API Integration

The application integrates with OpenAI API for robust AI functionality. The backend uses Python with LangChain and ChromaDB to handle RAG operations and knowledge retrieval, while the frontend uses Flask for the web interface.

Available APIs & Technologies

API/Technology Type Description
OpenAI API AI API OpenAI's API for AI model access
LangChain Python Framework Python framework for LLM orchestration
SQLite Database Lightweight database for user data and statistics
OpenAI API AI API Optional AI integration for /ai command
OpenWeatherMap API Weather API Optional weather data for /weather command

Bot Command Handlers

# Python RAG Chatbot - chatbot.py from telegram import Update from telegram.ext import Application, CommandHandler, ContextTypes async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): """Handle /start command""" await update.message.reply_text( 'Welcome! Use /help to see available commands.' ) async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE): """Handle /help command""" help_text = """ Available commands: /start - Start the bot /help - Show this help message /qr - Generate QR code /speak - Convert text to speech /translate - Translate text /weather - Get weather info /ai - Ask AI assistant """ await update.message.reply_text(help_text) async def qr_command(update: Update, context: ContextTypes.DEFAULT_TYPE): """Handle /qr command""" text = ' '.join(context.args) if context.args else 'Hello World' # Generate QR code logic here await update.message.reply_text(f'QR Code for: {text}') # Register handlers def setup_handlers(application): application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command)) application.add_handler(CommandHandler("qr", qr_command))
# Python example - Inline Keyboard from telegram import InlineKeyboardButton, InlineKeyboardMarkup async def show_menu(update: Update, context: ContextTypes.DEFAULT_TYPE): keyboard = [ [InlineKeyboardButton("QR Code", callback_data='qr')], [InlineKeyboardButton("Translate", callback_data='translate')], [InlineKeyboardButton("Weather", callback_data='weather')] ] reply_markup = InlineKeyboardMarkup(keyboard) await update.message.reply_text( 'Choose an option:', reply_markup=reply_markup )

Bot Setup

# Check Bot Connection import requests def check_bot_connection(token): url = f"https://api.telegram.org/bot{token}/getMe" response = requests.get(url) if response.status_code == 200: data = response.json() if data['ok']: bot_info = data['result'] print(f"Bot connected: @{bot_info['username']}") return True return False # Recommended setup: # - Backend: Python 3.8+ with LangChain & ChromaDB # - Database: SQLite for user data # - Frontend: PHP for admin dashboard # - Optional: OpenAI API for AI features

⚙️ Configuration

Configuration in this application is handled through environment variables and settings files:

Environment Variables

Create a .env file in the project root (copy from env.example):

# .env file SLACK_BOT_TOKEN=your_bot_token_here ADMIN_ID=123456789 OPENAI_API_KEY=sk-your-key-here # Optional for /ai command WEATHER_API_KEY=your_weather_key # Optional for /weather command

Note: Get your API key from OpenAI Platform. Never commit your .env file to version control.

Python Configuration (config.py)

The config.py file contains configuration settings:

# config.py import os class Config: SLACK_BOT_TOKEN = os.getenv('SLACK_BOT_TOKEN') ADMIN_ID = int(os.getenv('ADMIN_ID', 0)) DATABASE_PATH = 'bot.db' OPENAI_API_KEY = os.getenv('OPENAI_API_KEY', '') # Optional WEATHER_API_KEY = os.getenv('WEATHER_API_KEY', '') # Optional # Bot settings MAX_MESSAGE_LENGTH = 4096 COMMAND_PREFIX = '/' ENABLE_LOGGING = True

Database Configuration

The bot uses SQLite database for user data:

# database.py import sqlite3 class Database: def __init__(self, db_path='bot.db'): self.conn = sqlite3.connect(db_path) self.create_tables() def create_tables(self): cursor = self.conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS users ( user_id INTEGER PRIMARY KEY, username TEXT, first_name TEXT, xp INTEGER DEFAULT 0, level INTEGER DEFAULT 1 ) ''') self.conn.commit()

Runtime Configuration

Configure bot settings through environment variables or config file:

  • API Key: Required - Get from OpenAI Platform
  • Model: Optional - Specify OpenAI model (default: gpt-3.5-turbo)
  • OpenAI API Key: Optional - For /ai command functionality
  • Weather API Key: Optional - For /weather command functionality
  • Database Path: SQLite database file path (default: bot.db)
  • Logging: Enable/disable bot logging

All settings are configured through environment variables or config.py file.

📁 Project Structure

rag-chatbot
rag-chatbot/
├── bot.py             # Main bot file with command handlers
├── handlers.py        # Command and message handlers
├── database.py        # SQLite database operations
├── utils.py           # Utility functions
├── config.py          # Python configuration settings
├── setup.py           # Setup helper script
├── requirements.txt   # Python dependencies
├── dashboard.php      # Admin dashboard (PHP)
├── index.html         # Web landing page
├── project_info.php   # Project information API
├── assets/            # CSS and JS assets
│   ├── css/
│   └── js/
├── README.md          # Project overview and quick start guide
├── PROJECT_STATUS.md  # Project status and structure
├── SETUP.md           # Setup instructions
├── CHANGELOG.md       # Changelog
├── RELEASE_NOTES.md   # Release notes
├── LICENSE            # MIT License file
└── LICENSE.txt        # License text

Note: Edit config.py and .env to configure bot token and settings.

📄 Detailed File Descriptions

📄 index.html

Purpose: Main HTML file with chatbot interface. Contains the complete UI structure and layout.

Key Features:

  • Chat messages container with markdown support
  • Input area with text, voice, and file upload
  • Control buttons (Sessions, History, Export, Dark Mode, Settings)
  • Settings panel for model configuration
  • Statistics panel for API usage
  • Code syntax highlighting

🎨 styles.css

Purpose: CSS styling with modern design. Contains all visual styles and animations.

Key Features:

  • Modern gradient backgrounds
  • Responsive design
  • Dark mode support
  • Smooth animations
  • Mobile-friendly layout

🤖 bot.py

Purpose: Main chatbot file with RAG architecture implementation. Core AI logic and initialization.

Key Features:

  • RAG Chatbot API integration
  • Bot initialization and polling
  • Command handler registration
  • Error handling and logging
  • Database initialization

⌨️ handlers.py

Purpose: Command and message handlers for bot functionality.

Key Features:

  • Command handlers (/start, /help, /qr, /speak, etc.)
  • Message handlers and callbacks
  • Inline keyboard handlers
  • File handling and processing
  • User interaction management

💾 database.py

Purpose: SQLite database operations for user data and statistics.

Key Features:

  • User data management
  • XP and leveling system
  • Statistics tracking
  • Leaderboard queries
  • Database initialization

⚙️ config.py

Purpose: Python configuration settings and constants.

Key Features:

  • Bot token configuration
  • Admin ID settings
  • API key management
  • Configuration management
  • Environment variable handling

🛠️ utils.py

Purpose: Utility functions for bot operations.

Key Features:

  • QR code generation
  • Text-to-speech conversion
  • PDF creation
  • Language translation
  • Weather data fetching
  • Password generation
  • URL shortening

📊 dashboard.php

Purpose: PHP-based admin dashboard for bot statistics.

Key Features:

  • Bot statistics display
  • User management
  • Leaderboard visualization
  • Feedback management
  • Data export functionality

📖 README.md

Purpose: Project overview and quick start guide. Provides introduction, features, installation instructions, and usage examples.

Contents:

  • Project description
  • Features list
  • Installation guide
  • Usage instructions
  • Browser compatibility
  • Support information

📝 RELEASE_NOTES.md

Purpose: Release notes. Documents features, changes, and updates in the current version.

Contents:

  • Release information
  • Feature list
  • Technical details
  • Changelog

⚖️ LICENSE

Purpose: License file. Contains the license text and copyright information.

License Type: MIT License

Copyright: © 2026 RSK World

🚫 .gitignore

Purpose: Git ignore rules. Specifies files and directories that should not be tracked by version control.

Excluded Items:

  • IDE configuration files
  • OS-specific files
  • Log files
  • Build artifacts

📊 File Statistics

25+
Total Files
8
Core Files
9
Documentation Files
5000+
Lines of Code
20+
Advanced Features
20+
Bot Commands

📌 File Organization

Frontend Files: index.html, dashboard.php, assets/css/style.css, assets/js/script.js

Backend Files: bot.py, handlers.py, database.py, utils.py, config.py, setup.py

Documentation: README.md, PROJECT_STATUS.md, CHANGELOG.md, SETUP.md, RELEASE_NOTES.md

Configuration: config.py, .env, .gitignore

Scripts: run.bat, run.sh, start.bat (if available)

Full-Stack: Python RAG Chatbot + Flask Web Interface with ChromaDB vector database

🚀 Advanced Features Details

1. RAG Architecture Implementation

Retrieval-Augmented Generation architecture for accurate responses. Combines vector similarity search with knowledge base retrieval for context-aware answers.

2. Command Handling

Easily parse and respond to user commands like /start, /help, /qr, /speak, /translate, /weather, /ai, /remind, /password, /shorten, /calc, /convert, /news, /summarize, and more.

3. Inline Keyboards

Interactive buttons and menus for enhanced user experience. Users can navigate through bot features using inline keyboards for seamless interactions.

4. Utility Commands

Multiple utility commands including QR code generation, text-to-speech, PDF creation, language translation, weather information, password generation, URL shortening, calculations, unit conversion, news fetching, and text summarization.

5. AI Assistant

Intelligent responses using OpenAI API or rule-based system with the /ai command for smart interactions and assistance.

6. User Management & XP System

Users earn XP and level up by using the bot, creating an engaging experience with progression tracking. View top users with /leaderboard and check your profile with /profile command.

7. Task Reminders

Set personal reminders using the /remind command for task management and productivity with scheduled notifications.

8. File Sharing

Capabilities to handle file uploads for document processing and knowledge base expansion through the web interface.

9. Group Chat Support

Functionality tailored for both private and group interactions with comprehensive bot features available in group chats.

10. Admin Dashboard

PHP-based dashboard to monitor bot statistics, user data, feedback, and comprehensive analytics with export functionality.

11. Database Management

SQLite database for user data, statistics, XP tracking, and leaderboard management with efficient data storage and retrieval.

12. Customization & Configuration

Easy configuration through environment variables and config files. Customize bot behavior, commands, and features according to your needs.

🔧 Troubleshooting

Bot Token Issues

  • Ensure your .env file contains a valid SLACK_BOT_TOKEN
  • Get your API key from OpenAI Platform
  • Check that the bot token is correctly formatted and not expired
  • Make sure the .env file is in the project root directory
  • Restart the bot after updating the token

Bot Not Starting Issues

  • Bot not starting: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt
  • Import errors: Ensure virtual environment is activated, reinstall dependencies
  • Connection errors: Check internet connection, verify OpenAI API is accessible
  • Token errors: Verify bot token is valid and bot is not blocked
  • Database errors: Check SQLite database permissions and file path

Command Issues

  • Commands not working: Ensure handlers are properly registered in bot.py
  • Command not found: Check command spelling and ensure it's registered
  • Permission errors: Verify admin commands are restricted to admin users
  • API errors: Check optional API keys (OpenAI, Weather) if using /ai or /weather commands

Common Issues

  • Bot token not found: Create .env file from env.example and add your bot token
  • Module not found: Install dependencies with pip install -r requirements.txt
  • Database errors: Check SQLite database file permissions and path
  • File handling errors: Check file size limits and supported formats
  • Dashboard not loading: Verify PHP is installed and dashboard.php is accessible

📋 Requirements

Backend Requirements: - Python 3.8 or higher - LangChain & ChromaDB libraries - SQLite database - python-dotenv for environment variables Frontend Requirements (Admin Dashboard): - PHP 7.4 or higher - Modern Web Browser (Chrome, Edge, Safari, Firefox) - JavaScript ES6+ support API Requirements: - OpenAI API Key (get from OpenAI platform) - Active internet connection for OpenAI API calls - Optional: OpenAI API Key (for /ai command) - Optional: OpenWeatherMap API Key (for /weather command) Python Dependencies (see requirements.txt): - LangChain Framework - python-dotenv - qrcode (for QR code generation) - gtts (for text-to-speech) - reportlab (for PDF creation) - googletrans (for translation) - requests (for API calls) Optional Dependencies: - openai (for AI assistant features) - pyowm (for weather features)

Browser Compatibility: Chrome, Edge, Safari, or Firefox for admin dashboard.

Python Version: Python 3.8 or higher required for bot server.

Internet Connection: Required for OpenAI API calls and optional integrations.

🎯 Use Cases

💻 Code Assistance

Get help with coding, debugging, and programming questions

📚 Education & Learning

Learn new concepts, get explanations, and study assistance

📊 Content Analysis

Analyze documents, summarize text, and extract key information

🧮 Problem Solving

Solve complex problems, math equations, and reasoning tasks

✍️ Content Creation

Writing assistance, creative content, and text generation

💬 Customer Support

Build intelligent customer support chatbots and assistants

📎 Document Analysis

Upload and analyze images, PDFs, and documents

🌐 Web Integration

Integrate RAG Chatbot API into web applications and services

💬 Support

For support, questions, or more projects:

📄 License

This project is provided as-is for educational and development purposes.

MIT License - See LICENSE file for details.

📂 Demo Folder Structure

The demo/ folder contains demonstration and documentation files for this project.

demo/ ├── index.html # This comprehensive documentation page ├── demo.html # Interactive demo interface for testing RAG Chatbot ├── style.css # CSS styling for documentation and demo └── script.js # JavaScript for scroll, navigation, and interactions
Try Interactive Demo

📄 Demo Files Description

📄 index.html

Purpose: Comprehensive project documentation and information page. This HTML file contains all details about the RAG Chatbot project.

Contents:

  • Complete project overview
  • All features documentation
  • Installation instructions
  • Usage examples
  • Code examples
  • RAG Chatbot API integration reference
  • Configuration details
  • Detailed file and folder descriptions
  • Project structure
  • Troubleshooting guide
  • Support information

Features:

  • Self-contained HTML with external CSS
  • Responsive design
  • Modern, beautiful UI
  • Well-organized sections
  • Easy navigation with smooth scrolling

🎨 style.css

Purpose: CSS stylesheet file with modern styling for the documentation page.

Features:

  • Modern gradient backgrounds
  • Responsive design
  • Beautiful typography
  • Smooth animations
  • Sticky navigation
  • Scroll progress bar

📜 script.js

Purpose: JavaScript file with interactive features for the documentation page.

Features:

  • Scroll progress bar
  • Back to top button
  • Smooth scrolling navigation
  • Active navigation highlighting
  • Copy to clipboard functionality

🎮 demo.html

Purpose: Interactive demo interface showcasing RAG Chatbot features.

Features:

  • Interactive chat interface
  • Sample RAG Chatbot responses
  • Quick action buttons
  • Feature showcase panel
  • Statistics tracking
  • Beautiful, responsive UI
  • Demo message types (code, explain, creative, math, etc.)

Usage: Open demo.html in your browser to try the interactive demo!

💡 About the Demo Folder

The demo/ folder contains demonstration and documentation files for the RAG Chatbot project:

  • Documentation: index.html - Comprehensive HTML documentation page explaining the entire project
  • Interactive Demo: demo.html - Live interactive demo showcasing RAG Chatbot features
  • Styling: style.css - CSS stylesheet with modern design
  • Scripts: script.js - JavaScript for scroll, navigation, and interactive features

Note: To view the documentation, open demo/index.html in your browser. To try the interactive demo, open demo.html. Both pages are self-contained and work independently.