""" 配置文件模板 系统配置和环境设置 """ { "system": { "name": "HuggingFace Spaces 自动修复系统", "version": "1.0.0", "log_level": "INFO", "debug": false }, "huggingface": { "api_token": "${HF_TOKEN}", "base_url": "https://huggingface.co/api", "rate_limit": { "requests_per_minute": 60, "burst_limit": 10 }, "timeout": { "api_timeout": 30, "build_timeout": 1800, "log_timeout": 60 } }, "monitoring": { "check_interval": 60, "max_concurrent_spaces": 10, "retry_attempts": 3, "retry_delay": 30, "health_check": { "enabled": true, "port_check": 7860, "timeout": 10, "retries": 3 } }, "error_analysis": { "confidence_threshold": 0.7, "max_errors_per_analysis": 20, "context_lines": 10, "pattern_matching": { "enabled": true, "case_sensitive": false, "max_matches": 50 }, "context_analysis": { "enabled": true, "analyzers": [ "dockerfile_syntax", "dependency_install", "environment_config", "port_conflict", "permission_error", "network_connection", "timeout_error", "resource_exceeded" ] } }, "repair_strategies": { "max_attempts_per_error": 3, "success_rate_threshold": 0.6, "risk_tolerance": "medium", "backup_enabled": true, "strategies": { "dockerfile_syntax": { "enabled": true, "priority": 1, "auto_apply": true, "risk_level": "medium" }, "dependency_install": { "enabled": true, "priority": 2, "auto_apply": true, "risk_level": "low", "fallback_sources": [ "https://pypi.tuna.tsinghua.edu.cn/simple", "https://mirrors.aliyun.com/pypi/simple", "https://pypi.douban.com/simple" ] }, "environment_config": { "enabled": true, "priority": 3, "auto_apply": true, "risk_level": "low" }, "port_conflict": { "enabled": true, "priority": 4, "auto_apply": true, "risk_level": "medium", "alternative_ports": [7861, 7862, 7863, 8080, 8000] }, "permission_error": { "enabled": true, "priority": 5, "auto_apply": false, "risk_level": "high" }, "network_connection": { "enabled": true, "priority": 6, "auto_apply": false, "risk_level": "medium" }, "timeout_error": { "enabled": true, "priority": 7, "auto_apply": true, "risk_level": "low" }, "resource_exceeded": { "enabled": true, "priority": 8, "auto_apply": false, "risk_level": "high" } } }, "file_operations": { "backup": { "enabled": true, "directory": "./backups", "max_backups": 10, "compression": true }, "git": { "enabled": true, "auto_commit": true, "commit_message_prefix": "[Auto-Repair]", "branch_name": "auto-repair", "push_immediately": true }, "modification": { "dry_run": false, "confirm_changes": false, "max_file_size_mb": 10 } }, "database": { "type": "sqlite", "path": "./data/repair_system.db", "backup_enabled": true, "backup_interval_hours": 24, "retention_days": 30 }, "notifications": { "enabled": true, "channels": { "email": { "enabled": false, "smtp_server": "", "smtp_port": 587, "username": "", "password": "", "recipients": [] }, "webhook": { "enabled": true, "url": "${WEBHOOK_URL}", "timeout": 10, "retry_attempts": 3 }, "slack": { "enabled": false, "webhook_url": "", "channel": "#alerts" } }, "events": { "repair_success": true, "repair_failed": true, "space_error": true, "build_completed": false, "system_error": true } }, "security": { "max_file_access_attempts": 3, "allowed_file_extensions": [".py", ".js", ".json", ".yml", ".yaml", ".md", ".txt"], "forbidden_paths": ["/etc", "/proc", "/sys", "/dev"], "scan_for_secrets": true, "secret_patterns": [ "password", "token", "api_key", "secret", "credential" ] }, "performance": { "max_concurrent_repairs": 5, "queue_size": 100, "worker_threads": 4, "cache_size_mb": 100, "timeout_per_repair": 600 }, "logging": { "level": "INFO", "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "file": "./logs/repair_system.log", "max_file_size_mb": 50, "backup_count": 5, "console_output": true } }