Spaces:
Sleeping
Sleeping
| """Centralized configuration for CodeTribunal.""" | |
| import os | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| load_dotenv(Path(__file__).resolve().parent.parent.parent / ".env") | |
| class TribunalConfig: | |
| """Immutable runtime configuration loaded from environment variables.""" | |
| model_name: str = os.getenv("MODEL_NAME", "zai/glm-5.1") | |
| api_key: str = os.getenv("ZAI_API_KEY", "") | |
| api_base: str = os.getenv("ZAI_API_BASE", "https://api.z.ai/api/coding/paas/v4") | |
| temperature: float = float(os.getenv("TEMPERATURE", "0.3")) | |
| max_tokens: int = int(os.getenv("MAX_TOKENS", "4096")) | |
| grit_timeout: int = int(os.getenv("GRIT_TIMEOUT", "60")) | |
| max_file_size_mb: int = int(os.getenv("MAX_FILE_SIZE_MB", "50")) | |
| max_files: int = int(os.getenv("MAX_FILES", "500")) | |
| evidence_chunk_size: int = int(os.getenv("EVIDENCE_CHUNK_SIZE", "3000")) | |
| max_scan_workers: int = int(os.getenv("MAX_SCAN_WORKERS", "4")) | |
| server_host: str = os.getenv("SERVER_HOST", "0.0.0.0") | |
| server_port: int = int(os.getenv("SERVER_PORT", "7860")) | |
| storage_dir: str = os.getenv("STORAGE_DIR", ".tribunal_data") | |
| def is_configured(self) -> bool: | |
| return bool(self.api_key) | |