Configuration Guide

Learn how to customize SmartPaste AI with YAML configuration files

Configuration File Structure

SmartPaste AI uses YAML configuration files to customize its behavior. The default configuration file is config.yaml, but you can specify a custom path using the -c flag.

Example Configuration

# SmartPaste AI Configuration
app:
  # Clipboard monitoring interval (seconds)
  check_interval: 1.0
  
  # Output directory for processed content
  output_dir: "smartpaste_data"
  
  # Enable/disable auto-saving to files
  auto_save: true
  
  # Maximum content length to process (characters)
  max_content_length: 50000

# Content Handlers Configuration
handlers:
  # URL Content Handler
  url:
    enabled: true
    # Timeout for web requests (seconds)
    timeout: 10
    # User agent for web scraping
    user_agent: "SmartPaste AI/1.0"
    # Generate summaries for web content
    generate_summary: true
    # Extract keywords from content
    extract_keywords: true
    # Maximum summary length (characters)
    max_summary_length: 500

  # Number and Unit Conversion Handler
  number:
    enabled: true
    # Temperature conversions
    temperature_units: ["celsius", "fahrenheit", "kelvin"]
    # Length conversions
    length_units: ["meters", "feet", "inches", "centimeters"]
    # Weight conversions
    weight_units: ["kilograms", "pounds", "ounces", "grams"]
    # Volume conversions
    volume_units: ["liters", "gallons", "milliliters", "cups"]

  # Text Analysis Handler
  text:
    enabled: true
    # Minimum text length for processing
    min_length: 50
    # Enable language detection
    detect_language: true
    # Generate text summaries
    generate_summary: true
    # Extract keywords from text
    extract_keywords: true
    # Calculate readability scores
    calculate_readability: true

  # Image OCR Handler
  image:
    enabled: true
    # OCR engine settings (requires pytesseract)
    ocr_engine: "tesseract"
    # OCR language (use 'eng' for English)
    ocr_language: "eng"
    # Preprocessing options
    preprocess_image: true
    # Minimum confidence threshold
    confidence_threshold: 60

# Logging Configuration
logging:
  # Log level: DEBUG, INFO, WARNING, ERROR
  level: "INFO"
  # Log file path (optional)
  file: null
  # Include timestamps in logs
  include_timestamp: true

# Advanced Settings
advanced:
  # Enable concurrent processing
  concurrent_processing: false
  # Maximum number of worker threads
  max_workers: 4
  # Cache processed content
  enable_caching: true
  # Cache expiration time (hours)
  cache_expiration: 24

Configuration Sections

Application Settings

Handler Configuration

Each content handler can be individually configured:

URL Handler

Number Handler

Text Handler

Image Handler

Environment Variables

You can also configure SmartPaste AI using environment variables:

# Set configuration file path
export SMARTPASTE_CONFIG="/path/to/config.yaml"

# Set output directory
export SMARTPASTE_OUTPUT_DIR="/path/to/output"

# Set log level
export SMARTPASTE_LOG_LEVEL="DEBUG"

# Disable specific handlers
export SMARTPASTE_DISABLE_IMAGE_HANDLER="true"

Runtime Configuration

Some settings can be modified at runtime using command-line arguments:

# Use custom configuration file
smartpaste -c /path/to/custom-config.yaml

# Enable verbose logging
smartpaste -v

# Show version and exit
smartpaste --version

Configuration Validation

SmartPaste AI validates your configuration on startup and will show helpful error messages if there are issues. Common validation errors include:

Best Practices