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
- check_interval: How often to check the clipboard for changes (in seconds)
- output_dir: Directory where processed content files are saved
- auto_save: Whether to automatically save processed content to files
- max_content_length: Maximum length of content to process
Handler Configuration
Each content handler can be individually configured:
URL Handler
- enabled: Enable/disable URL processing
- timeout: Maximum time to wait for web page loading
- user_agent: User agent string for web requests
- generate_summary: Create automatic summaries of web content
- extract_keywords: Extract relevant keywords from web pages
Number Handler
- enabled: Enable/disable number and unit conversion
- *_units: Specify which unit types to convert for each category
Text Handler
- min_length: Minimum text length required for processing
- detect_language: Enable automatic language detection
- generate_summary: Create text summaries
- extract_keywords: Extract important keywords
Image Handler
- enabled: Enable/disable OCR processing
- ocr_language: Language code for OCR recognition
- confidence_threshold: Minimum confidence for OCR results
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:
- Invalid YAML syntax
- Missing required fields
- Invalid data types (e.g., string instead of number)
- Invalid file paths
- Unsupported handler options
Best Practices
- Start with the example configuration and modify as needed
- Keep separate configurations for development and production
- Use version control for your configuration files
- Test configuration changes in a development environment first
- Document any custom settings for your team