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
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
code-assistant-bot
RSK World
code-assistant-bot
Code Assistant Bot - Python + Flask + OpenAI API + Code Generation + Debugging + Code Analysis + GitHub Integration
code-assistant-bot
  • __pycache__
  • static
  • templates
  • utils
  • .env.example755 B
  • .gitignore956 B
  • CHANGELOG.md3.6 KB
  • DEPLOYMENT.md1.9 KB
  • FEATURES.md5 KB
  • GITHUB_RELEASE_INSTRUCTIONS.md3.9 KB
  • LICENSE1.2 KB
  • Procfile44 B
  • README.md10 KB
  • README_DEPLOYMENT.md2.3 KB
  • RELEASE_NOTES.md3.9 KB
  • app.py18.5 KB
  • code-assistant-bot.png1.1 MB
  • config.py3.2 KB
  • requirements.txt851 B
  • run.py1.6 KB
  • runtime.txt15 B
  • vercel.json314 B
  • wsgi.py271 B
README.md.env.example.gitignoreconfig.py
README.md
Raw Download

README.md

# Code Assistant Bot

**AI-powered coding assistant for code generation, debugging, and explanations**

![Code Assistant Bot](code-assistant-bot.png)

**Author:** RSK World
**Founder:** Molla Samser
**Designer & Tester:** Rima Khatun
**Contact:** help@rskworld.in | +91 93305 39277
**Website:** [https://rskworld.in](https://rskworld.in)
**Year:** 2026

---

## ๐Ÿ“‹ Project Overview

Code Assistant Bot is an advanced AI-powered coding assistant that helps developers with:
- **Code Generation** - Generate code from natural language descriptions
- **Debugging Assistance** - Find bugs and get suggestions for fixes
- **Code Explanations** - Understand complex code with detailed explanations
- **Syntax Checking** - Validate syntax across multiple programming languages
- **Code Analysis** - Analyze code quality, complexity, and metrics
- **GitHub Integration** - Search and explore repositories

Perfect for coding platforms, developer tools, and programming education.

---

## ๐Ÿš€ Features

### Core Features
- โœ… **Code Generation** - Generate code in 16+ programming languages
- โœ… **Debugging Help** - Identify and fix code errors
- โœ… **Code Explanations** - Get detailed explanations of code logic
- โœ… **Syntax Validation** - Check syntax errors in real-time
- โœ… **Code Analysis** - Analyze code quality and complexity
- โœ… **GitHub Search** - Search repositories by language and keywords

### Supported Languages
- Python, JavaScript, TypeScript, Java
- C++, C, C#, PHP, Ruby, Go, Rust
- HTML, CSS, SQL, Swift, Kotlin

### Advanced Features
- ๐ŸŽฏ **Intelligent Code Analysis** - Cyclomatic complexity, cognitive complexity
- ๐Ÿ” **Security Scanning** - Detect common security vulnerabilities
- ๐Ÿ“Š **Quality Metrics** - Code quality scoring and suggestions
- ๐ŸŒ **GitHub Integration** - Search and explore repositories
- ๐Ÿ“ฑ **Responsive Design** - Works on all devices
- ๐ŸŽจ **Modern UI** - Beautiful, intuitive interface

---

## ๐Ÿ› ๏ธ Technologies Used

### Backend
- **Python 3.8+** - Core programming language
- **Flask** - Web framework
- **OpenAI API** - AI-powered code processing
- **AST** - Python code analysis
- **Requests** - HTTP client for GitHub API

### Frontend
- **HTML5** - Semantic markup
- **CSS3** - Modern styling with animations
- **JavaScript ES6+** - Interactive functionality
- **Bootstrap 5** - Responsive UI framework
- **Font Awesome** - Icon library
- **Prism.js** - Syntax highlighting

### Development Tools
- **pytest** - Testing framework
- **black** - Code formatting
- **flake8** - Linting
- **python-dotenv** - Environment management

---

## ๐Ÿ“ฆ Installation

### Prerequisites
- Python 3.8 or higher
- pip (Python package manager)
- OpenAI API key

### Step 1: Clone the Repository
```bash
git clone https://github.com/your-repo/code-assistant-bot.git
cd code-assistant-bot
```

### Step 2: Create Virtual Environment
```bash
python -m venv venv

# Windows
venv\Scripts\activate

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

### Step 3: Install Dependencies
```bash
pip install -r requirements.txt
```

### Step 4: Environment Configuration
```bash
# Copy environment template
cp .env.example .env

# Edit .env file with your configuration
# Add your OpenAI API key
OPENAI_API_KEY=your_openai_api_key_here
```

### Step 5: Run the Application
```bash
python app.py
```

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

---

## ๐Ÿ”ง Configuration

### Environment Variables
Create a `.env` file with the following variables:

```env
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# Flask Configuration
SECRET_KEY=your_secret_key_here
FLASK_ENV=development
PORT=5000

# GitHub API Configuration (Optional)
GITHUB_TOKEN=your_github_personal_access_token_here

# Application Configuration
MAX_CODE_LENGTH=10000
RATE_LIMIT_PER_MINUTE=60
LOG_LEVEL=INFO
```

### OpenAI API Setup
1. Visit [OpenAI Platform](https://platform.openai.com/)
2. Create an account or sign in
3. Generate an API key
4. Add the API key to your `.env` file

### GitHub Token Setup (Optional)
1. Visit [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens)
2. Generate a new token with `public_repo` scope
3. Add the token to your `.env` file for higher rate limits

---

## ๐Ÿ“– Usage Guide

### Code Generation
1. Select "Generate Code" from the action dropdown
2. Choose your programming language
3. Describe the code you want to generate
4. Click "Generate Code"

### Debugging
1. Select "Debug Code" from the action dropdown
2. Paste your code in the input area
3. Optionally add any error messages
4. Click "Debug Code"

### Code Explanation
1. Select "Explain Code" from the action dropdown
2. Paste the code you want to understand
3. Click "Explain Code"

### Syntax Checking
1. Select "Check Syntax" from the action dropdown
2. Paste your code
3. Click "Check Syntax"

### GitHub Search
1. Enter search terms in the GitHub search box
2. Optionally filter by programming language
3. Click "Search" to explore repositories

---

## ๐Ÿ—๏ธ Project Structure

```
code-assistant-bot/
โ”œโ”€โ”€ app.py # Main Flask application
โ”œโ”€โ”€ config.py # Configuration settings
โ”œโ”€โ”€ requirements.txt # Python dependencies
โ”œโ”€โ”€ .env.example # Environment template
โ”œโ”€โ”€ utils/ # Utility modules
โ”‚ โ”œโ”€โ”€ __init__.py
โ”‚ โ”œโ”€โ”€ code_analyzer.py # Code analysis utilities
โ”‚ โ”œโ”€โ”€ github_integration.py # GitHub API integration
โ”‚ โ””โ”€โ”€ syntax_checker.py # Syntax checking utilities
โ”œโ”€โ”€ templates/ # HTML templates
โ”‚ โ””โ”€โ”€ index.html # Main frontend interface
โ”œโ”€โ”€ static/ # Static assets
โ”‚ โ”œโ”€โ”€ css/
โ”‚ โ”‚ โ””โ”€โ”€ style.css # Custom styling
โ”‚ โ””โ”€โ”€ js/
โ”‚ โ””โ”€โ”€ app.js # Frontend JavaScript
โ”œโ”€โ”€ tests/ # Test files (optional)
โ””โ”€โ”€ README.md # This file
```

---

## ๐Ÿ”Œ API Endpoints

### Core Endpoints
- `POST /api/generate` - Generate code from prompt
- `POST /api/debug` - Debug code and provide fixes
- `POST /api/explain` - Explain code functionality
- `POST /api/syntax-check` - Check code syntax
- `POST /api/analyze` - Analyze code quality
- `POST /api/github/search` - Search GitHub repositories
- `GET /api/languages` - Get supported languages
- `GET /health` - Health check endpoint

### Request Format
```json
{
"code": "your code here",
"language": "python",
"prompt": "description for code generation",
"error_message": "optional error message for debugging"
}
```

### Response Format
```json
{
"success": true,
"result": "processed result",
"language": "python",
"timestamp": "2026-01-09T22:33:00"
}
```

---

## ๐Ÿงช Testing

### Run Tests
```bash
# Install test dependencies
pip install pytest pytest-flask

# Run all tests
pytest

# Run with coverage
pytest --cov=utils
```

### Manual Testing
1. Start the application: `python app.py`
2. Open browser to `http://localhost:5000`
3. Test each feature through the web interface
4. Verify API endpoints using tools like Postman

---

## ๐Ÿš€ Deployment

### Production Deployment

#### Using Docker
```dockerfile
FROM python:3.9-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 5000

CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
```

#### Using Gunicorn
```bash
# Install gunicorn
pip install gunicorn

# Run production server
gunicorn --bind 0.0.0.0:5000 app:app
```

#### Environment Setup
- Set `FLASK_ENV=production`
- Use a proper WSGI server like Gunicorn
- Configure reverse proxy (Nginx/Apache)
- Set up SSL certificates
- Configure monitoring and logging

---

## ๐Ÿ”’ Security Considerations

### API Key Security
- Never expose OpenAI API keys in frontend code
- Use environment variables for sensitive data
- Rotate API keys regularly
- Monitor API usage for unusual activity

### Input Validation
- Code length is limited to 10,000 characters
- Input sanitization for all user inputs
- Rate limiting to prevent abuse
- Error handling without exposing system details

### Best Practices
- Use HTTPS in production
- Implement proper authentication if needed
- Regular security updates
- Monitor for vulnerabilities

---

## ๐Ÿค Contributing

We welcome contributions! Please follow these guidelines:

### Development Setup
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request

### Code Style
- Follow PEP 8 for Python code
- Use Black for code formatting
- Add comments for complex logic
- Include docstrings for functions

### Commit Messages
- Use clear, descriptive commit messages
- Start with a verb (Fix, Add, Update, etc.)
- Include issue numbers when applicable

---

## ๐Ÿ“ License

This project is part of RSK World's educational resources.

**ยฉ 2026 RSK World. All rights reserved.**

**Developed by:** Molla Samser
**Designed & Tested by:** Rima Khatun

**Contact Information:**
- **Email:** help@rskworld.in
- **Phone:** +91 93305 39277
- **Address:** Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India - 713147
- **Website:** [https://rskworld.in](https://rskworld.in)

---

## ๐ŸŒŸ Acknowledgments

- **OpenAI** - For providing the powerful GPT API
- **GitHub** - For repository search functionality
- **Bootstrap** - For the responsive UI framework
- **Prism.js** - For syntax highlighting
- **Font Awesome** - For beautiful icons

---

## ๐Ÿ“ž Support

For support, questions, or feedback:

- ๐Ÿ“ง **Email:** help@rskworld.in
- ๐ŸŒ **Website:** [https://rskworld.in](https://rskworld.in)
- ๐Ÿ“ฑ **Phone:** +91 93305 39277

---

**Made with โค๏ธ by RSK World**

*Empowering developers with AI-powered tools since 2026*
.env.example
Raw Download
Find: Go to:
# Code Assistant Bot Environment Configuration
# Author: RSK World (https://rskworld.in)
# Founder: Molla Samser
# Designer & Tester: Rima Khatun
# Contact: help@rskworld.in, +91 93305 39277
# Year: 2026

# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# Flask Configuration
SECRET_KEY=your_secret_key_here
FLASK_ENV=development
PORT=5000

# GitHub API Configuration (Optional)
GITHUB_TOKEN=your_github_personal_access_token_here

# Logging Configuration
LOG_LEVEL=INFO
LOG_FILE=code_assistant_bot.log

# Rate Limiting
RATE_LIMIT_PER_MINUTE=60

# Maximum Code Length for Analysis
MAX_CODE_LENGTH=10000

# Database Configuration (if needed for future features)
DATABASE_URL=sqlite:///code_assistant_bot.db
31 linesโ€ข755 B
text
.gitignore
Raw Download
Find: Go to:
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual Environment
venv/
env/
ENV/
env.bak/
venv.bak/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Environment variables
.env
.env.local
.env.*.local

# Logs
*.log
logs/
*.log.*

# Database
*.db
*.sqlite
*.sqlite3

# Flask
instance/
.webassets-cache

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Celery
celerybeat-schedule
celerybeat.pid

# SageMath
*.sage.py

# Spyder
.spyderproject
.spyproject

# Rope
.ropeproject

# mkdocs
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre
.pyre/

# OS
Thumbs.db
.DS_Store

# Project specific
code_assistant_bot.log
*.pyc
.python-version
103 linesโ€ข956 B
text
config.py
Raw Download
Find: Go to:
"""
Configuration file for Code Assistant Bot
Author: RSK World (https://rskworld.in)
Founder: Molla Samser
Designer & Tester: Rima Khatun
Contact: help@rskworld.in, +91 93305 39277
Year: 2026
"""

import os
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

class Config:
    """
    Configuration class for Code Assistant Bot
    """
    
    # Flask Configuration
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
    DEBUG = os.environ.get('FLASK_ENV', 'development') == 'development'
    PORT = int(os.environ.get('PORT', 5000))
    
    # OpenAI Configuration
    OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY')
    OPENAI_MODEL = os.environ.get('OPENAI_MODEL', 'gpt-3.5-turbo')
    OPENAI_MAX_TOKENS = int(os.environ.get('OPENAI_MAX_TOKENS', 1500))
    OPENAI_TEMPERATURE = float(os.environ.get('OPENAI_TEMPERATURE', 0.7))
    
    # GitHub Configuration
    GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
    GITHUB_API_URL = 'https://api.github.com'
    
    # Application Configuration
    MAX_CODE_LENGTH = int(os.environ.get('MAX_CODE_LENGTH', 10000))
    RATE_LIMIT_PER_MINUTE = int(os.environ.get('RATE_LIMIT_PER_MINUTE', 60))
    
    # Logging Configuration
    LOG_LEVEL = os.environ.get('LOG_LEVEL', 'INFO')
    LOG_FILE = os.environ.get('LOG_FILE', 'code_assistant_bot.log')
    
    # Supported Programming Languages
    SUPPORTED_LANGUAGES = [
        'python', 'javascript', 'typescript', 'java', 'cpp', 'c', 'csharp',
        'php', 'ruby', 'go', 'rust', 'html', 'css', 'sql', 'swift', 'kotlin'
    ]
    
    # Code Analysis Configuration
    COMPLEXITY_THRESHOLDS = {
        'low': 5,
        'medium': 10,
        'high': 20
    }
    
    # Security Configuration
    ENABLE_CORS = True
    CORS_ORIGINS = ['*']  # In production, specify allowed origins
    
    # Cache Configuration (for future implementation)
    CACHE_TYPE = 'simple'
    CACHE_DEFAULT_TIMEOUT = 300
    
    # Database Configuration (for future features)
    DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite:///code_assistant_bot.db')
    
    @staticmethod
    def validate_config():
        """
        Validate required configuration values
        """
        errors = []
        
        if not Config.OPENAI_API_KEY:
            errors.append("OPENAI_API_KEY is required")
        
        if errors:
            raise ValueError("Configuration validation failed: " + ", ".join(errors))
        
        return True

class DevelopmentConfig(Config):
    """
    Development configuration
    """
    DEBUG = True
    LOG_LEVEL = 'DEBUG'

class ProductionConfig(Config):
    """
    Production configuration
    """
    DEBUG = False
    LOG_LEVEL = 'WARNING'
    CORS_ORIGINS = ['https://rskworld.in']  # Restrict to your domain in production

class TestingConfig(Config):
    """
    Testing configuration
    """
    TESTING = True
    OPENAI_API_KEY = 'test-key'  # Mock key for testing
    LOG_LEVEL = 'DEBUG'

# Configuration mapping
config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
    'testing': TestingConfig,
    'default': DevelopmentConfig
}
113 linesโ€ข3.2 KB
python

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