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
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
config.py
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
🚀 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