Spaces:
Sleeping
Sleeping
File size: 1,270 Bytes
d973752 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """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")
@dataclass(frozen=True)
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")
@property
def is_configured(self) -> bool:
return bool(self.api_key)
|