help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
educational-tutor-bot
/
utils
RSK World
educational-tutor-bot
Educational Tutor Bot - Python + Flask + OpenAI API + AI Tutor + Learning Management + Progress Tracking
utils
  • ai_helper.py15 KB
  • database.py13.5 KB
style.cssREADME.md
static/css/style.css
Raw Download
Find: Go to:
/*
Educational Tutor Bot Stylesheet - Modern Design
Author: RSK World (https://rskworld.in)
Founded by: Molla Samser
Designer & Tester: Rima Khatun
Contact: info@rskworld.com, +91 93305 39277
Year: 2026
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.demo-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
}

.demo-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.demo-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.demo-header p {
    font-size: 16px;
    opacity: 0.9;
}

.demo-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.chat-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.features-panel {
    flex: 1;
    background: #f9f9f9;
    overflow-y: auto;
    padding: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message.bot .message-content {
    background: white;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message-meta {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-badge {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #667eea;
}

.send-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.send-button:hover {
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quick-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.quick-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.features-panel h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
}

.feature-item {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.feature-item h4 {
    color: #764ba2;
    margin-bottom: 8px;
    font-size: 14px;
}

.feature-item p {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

.loading {
    display: none;
    text-align: center;
    padding: 10px;
    color: #667eea;
}

.loading.show {
    display: block;
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.demo-footer {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
}

.demo-footer a {
    color: #667eea;
    text-decoration: none;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    z-index: 1001;
    transition: width 0.1s;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    .demo-content {
        flex-direction: column;
    }

    .features-panel {
        max-height: 300px;
    }

    .demo-header h1 {
        font-size: 24px;
    }

    .demo-header p {
        font-size: 14px;
    }

    .message-content {
        max-width: 85%;
    }
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.features-panel::-webkit-scrollbar {
    width: 8px;
}

.features-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.features-panel::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.features-panel::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
410 lines•7.3 KB
css
README.md
Raw Download

README.md

# Educational Tutor Bot

![Educational Tutor Bot](https://img.shields.io/badge/Version-1.0.0-blue.svg)
![Python](https://img.shields.io/badge/Python-3.8+-green.svg)
![Flask](https://img.shields.io/badge/Flask-2.3.3-red.svg)
![License](https://img.shields.io/badge/License-MIT-yellow.svg)

**AI-powered educational chatbot for tutoring, Q&A, and learning assistance**

---

## 📚 Project Information

**Author:** RSK World (https://rskworld.in)
**Founded by:** Molla Samser
**Designer & Tester:** Rima Khatun
**Contact:** info@rskworld.com | +91 93305 39277
**Year:** 2026

---

## 🎯 Features

- **Subject Tutoring**: Get help in Mathematics, Science, History, English, Computer Science, and more
- **Q&A Support**: Ask questions and get detailed, educational answers
- **Concept Explanations**: Understand complex topics with clear, step-by-step explanations
- **Learning Resources**: Receive curated learning materials and study suggestions
- **Progress Tracking**: Monitor your learning progress across different subjects
- **Difficulty Levels**: Choose between Beginner, Intermediate, and Advanced levels
- **Chat History**: Review your past conversations and learning sessions
- **Responsive Design**: Works seamlessly on desktop, tablet, and mobile devices

---

## 🛠️ Technologies Used

- **Backend**: Python 3.8+, Flask 2.3.3
- **AI/ML**: OpenAI API (GPT-3.5-turbo)
- **Database**: SQLite3
- **Frontend**: HTML5, CSS3, JavaScript, Bootstrap 5
- **NLP**: Natural Language Processing for educational content
- **Icons**: Font Awesome 6.0

---

## 📋 Prerequisites

- Python 3.8 or higher
- OpenAI API key
- Git (for cloning)

---

## 🚀 Installation & Setup

### 1. Clone the Repository

```bash
git clone https://github.com/rskworld/educational-tutor-bot.git
cd educational-tutor-bot
```

### 2. Create Virtual Environment

```bash
python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate
```

### 3. Install Dependencies

```bash
pip install -r requirements.txt
```

### 4. Environment Configuration

```bash
# Copy the example environment file
cp .env.example .env

# Edit .env file and add your OpenAI API key
OPENAI_API_KEY=your_actual_openai_api_key_here
```

### 5. Create Data Directory

```bash
mkdir -p data logs
```

### 6. Run the Application

```bash
python app.py
```

The application will be available at `http://localhost:5000`

---

## 🎮 Usage

1. **Open your browser** and navigate to `http://localhost:5000`
2. **Select your subject** from the dropdown menu (optional)
3. **Choose difficulty level** - Beginner, Intermediate, or Advanced
4. **Start asking questions** in the chat interface
5. **View your progress** by clicking the "View Progress" button
6. **Check chat history** to review previous conversations

---

## 📁 Project Structure

```
educational-tutor-bot/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── README.md # Project documentation
├── templates/
│ └── index.html # Main HTML template
├── static/
│ ├── css/
│ │ └── style.css # Custom styles
│ └── js/
│ └── script.js # JavaScript functionality
├── data/
│ └── tutor_bot.db # SQLite database (auto-created)
└── utils/
└── (helper functions)
```

---

## 🔧 Configuration

### Environment Variables

- `OPENAI_API_KEY`: Your OpenAI API key (required)
- `FLASK_ENV`: Environment (development/production)
- `SECRET_KEY`: Flask secret key
- `HOST`: Server host (default: 0.0.0.0)
- `PORT`: Server port (default: 5000)

### Supported Subjects

- Mathematics
- Science (Physics, Chemistry, Biology)
- History
- English
- Computer Science
- Geography
- Literature
- General Knowledge

---

## 📊 API Endpoints

- `GET /`: Main application page
- `POST /chat`: Send message and get AI response
- `GET /progress`: Get user learning progress
- `GET /history`: Get chat history

---

## 🗄️ Database Schema

The application uses SQLite with three main tables:

1. **users**: User session information
2. **learning_sessions**: Learning progress tracking
3. **chat_history**: Conversation history

---

## 🎨 Customization

### Adding New Subjects

1. Add subject to `SUPPORTED_SUBJECTS` in `config.py`
2. Add custom system prompt to `SYSTEM_PROMPTS` in `config.py`
3. Update the subject dropdown in `templates/index.html`

### Modifying AI Behavior

Edit the system prompts in `config.py` to customize the AI tutor's personality and teaching style.

---

## 🐛 Troubleshooting

### Common Issues

1. **OpenAI API Error**: Make sure your API key is valid and has sufficient credits
2. **Database Error**: Ensure the `data` directory exists and is writable
3. **Port Already in Use**: Change the PORT in `.env` file or stop conflicting services

### Getting Help

- Email: support@rskworld.com
- Phone: +91 93305 39277
- Website: https://rskworld.in

---

## 🤝 Contributing

We welcome contributions! Please follow these steps:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

---

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## 🙏 Acknowledgments

- **OpenAI** for providing the GPT API
- **Flask** team for the excellent web framework
- **Bootstrap** for the responsive UI components
- **Font Awesome** for the beautiful icons

---

## 📞 Contact

**RSK World**
Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

📧 Email: info@rskworld.com
📞 Phone: +91 93305 39277
🌐 Website: https://rskworld.in

---

**© 2026 RSK World. All rights reserved.**
*Content used for educational purposes only.*

---

*"Empowering education through AI technology"* 🎓
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer