my-app-565 / config.py
AiCoderv2's picture
Deploy Gradio app with multiple files
d79890b verified
# Configuration constants
# API endpoints
GITHUB_API_BASE = "https://api.github.com"
HF_API_BASE = "https://huggingface.co"
# Supported file extensions for text processing
SUPPORTED_EXTENSIONS = {
# Programming languages
'.py', '.js', '.ts', '.jsx', '.tsx', '.java', '.cpp', '.c', '.cs', '.go', '.rs',
'.php', '.rb', '.swift', '.kt', '.scala', '.r', '.m', '.sh', '.bash', '.zsh',
'.fish', '.ps1', '.bat', '.sql', '.html', '.htm', '.xml', '.css', '.scss',
'.sass', '.less', '.json', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.conf',
'.md', '.rst', '.txt', '.log', '.dockerfile', '.gitignore', '.gitattributes',
'.editorconfig', '.eslintrc', '.prettierrc', '.babelrc', '.tsconfig',
# Configuration files
'.env', '.env.example', '.env.local', '.env.development', '.env.production',
'package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml',
'requirements.txt', 'Pipfile', 'poetry.lock', 'pyproject.toml',
'Cargo.toml', 'Cargo.lock', 'go.mod', 'go.sum', 'composer.json',
'composer.lock', 'Gemfile', 'Gemfile.lock', 'pom.xml', 'build.gradle',
'CMakeLists.txt', 'Makefile', 'Dockerfile', 'docker-compose.yml',
# Documentation
'.md', '.rst', '.txt', '.adoc', '.tex', '.bib',
# Data formats
'.json', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.conf',
'.csv', '.tsv', '.xml', '.rss', '.atom',
# Scripts
'.sh', '.bash', '.zsh', '.fish', '.ps1', '.bat', '.cmd',
'.py', '.pl', '.rb', '.lua', '.tcl', '.awk', '.sed',
}
# Size limits
MAX_FILE_SIZE = 10 * 1024 * 1024 # 10MB default
MAX_TOTAL_SIZE = 100 * 1024 * 1024 # 100MB default
CHUNK_SIZE = 50000 # Characters per chunk
# File patterns to exclude by default
DEFAULT_EXCLUDE_PATTERNS = [
"*.git*",
"*.log",
"node_modules/**",
"__pycache__/**",
".DS_Store",
"Thumbs.db",
"*.tmp",
"*.temp",
"*.swp",
"*.swo",
"*~",
".vscode/**",
".idea/**",
"*.pyc",
"*.pyo",
"*.pyd",
".Python",
"build/**",
"dist/**",
"*.egg-info/**",
".pytest_cache/**",
".coverage",
"htmlcov/**",
".tox/**",
"*.cover",
"coverage.xml",
"*.cover",
".hypothesis/**",
".mypy_cache/**",
"dmypy.json",
dmypy.json",
".pytest_cache/**",
"nosetests.xml",
"coverage.xml",
"*.cover",
".hypothesis/**",
".cache/**",
"*.pid",
"*.seed",
"*.pid.lock",
".nyc_output",
".grunt",
".bower",
".lock-wscript",
"build/Release",
"jspm_packages/",
"typings",
".npm",
".eslintcache",
".stylelintcache",
"*.tsbuildinfo",
".rsync_user",
".vscode-test",
]
# File patterns to include by default
DEFAULT_INCLUDE_PATTERNS = [
"*.py",
"*.js",
"*.ts",
"*.jsx",
"*.tsx",
"*.java",
"*.cpp",
"*.c",
"*.cs",
"*.go",
"*.rs",
"*.php",
"*.rb",
"*.swift",
"*.kt",
"*.scala",
"*.r",
"*.m",
"*.sh",
"*.bash",
"*.zsh",
"*.fish",
"*.ps1",
"*.bat",
"*.sql",
"*.html",
"*.htm",
"*.xml",
"*.css",
"*.scss",
"*.sass",
"*.less",
"*.json",
"*.yaml",
"*.yml",
"*.toml",
"*.ini",
"*.cfg",
"*.conf",
"*.md",
"*.rst",
"*.txt",
"*.dockerfile",
"*.gitignore",
"*.gitattributes",
"*.editorconfig",
"*.eslintrc",
"*.prettierrc",
"*.babelrc",
"*.tsconfig",
"package.json",
"requirements.txt",
"Pipfile",
"poetry.lock",
"pyproject.toml",
"Cargo.toml",
"go.mod",
"composer.json",
"Gemfile",
"pom.xml",
"build.gradle",
"CMakeLists.txt",
"Makefile",
"Dockerfile",
"docker-compose.yml",
]
# Language comment patterns for cleaning
COMMENT_PATTERNS = {
'python': [r'#.*$', r'""".*?"""', r"'''.*?'''"],
'javascript': [r'//.*$', r'/\*.*?\*/'],
'java': [r'//.*$', r'/\*.*?\*/'],
'cpp': [r'//.*$', r'/\*.*?\*/'],
'c': [r'//.*$', r'/\*.*?\*/'],
'cs': [r'//.*$', r'/\*.*?\*/'],
'go': [r'//.*$', r'/\*.*?\*/'],
'rs': [r'//.*$', r'/\*.*?\*/'],
'php': [r'//.*$', r'#.*$', r'/\*.*?\*/'],
'ruby': [r'#.*$', r'=begin.*?=end'],
'shell': [r'#.*$'],
'sql': [r'--.*$', r'/\*.*?\*/'],
'html': [r'<!--.*?-->'],
'xml': [r'<!--.*?-->'],
'css': [r'/\*.*?\*/'],
}
# Token estimation multipliers for different languages
TOKEN_MULTIPLIERS = {
'python': 0.25,
'javascript': 0.3,
'java': 0.25,
'cpp': 0.25,
'c': 0.25,
'cs': 0.25,
'go': 0.25,
'rs': 0.25,
'php': 0.3,
'ruby': 0.25,
'shell': 0.3,
'sql': 0.25,
'html': 0.2,
'xml': 0.2,
'css': 0.25,
'json': 0.15,
'yaml': 0.2,
'markdown': 0.2,
'text': 0.25,
'default': 0.25,
}
# Rate limiting
MAX_REQUESTS_PER_MINUTE = 60
REQUEST_TIMEOUT = 30
# UI Configuration
THEME_COLORS = {
'primary': '#3070f0',
'secondary': '#64748b',
'success': '#10b981',
'warning': '#f59e0b',
'error': '#ef4444',
'background': '#ffffff',
'surface': '#f8fafc',
'text': '#1e293b',
'text_secondary': '#64748b',
}
# Progress tracking
PROGRESS_STEPS = [
(0.0, "Initializing..."),
(0.1, "Fetching repository information..."),
(0.2, "Scanning files..."),
(0.3, "Processing files..."),
(0.5, "Analyzing content..."),
(0.7, "Generating output..."),
(0.9, "Finalizing..."),
(1.0, "Complete!"),
]