from __future__ import annotations import os from pathlib import Path from functools import lru_cache BASE_DIR = Path(__file__).resolve().parents[3] STATIC_DIR = BASE_DIR / "static" AUDIO_DIR = STATIC_DIR / "audio" MODEL_CACHE_DIR = BASE_DIR / "tmp" / "models" FRONTEND_DIR = BASE_DIR / "frontend" TMP_DIR = BASE_DIR / "tmp" # Ensure required directories exist for directory in (STATIC_DIR, AUDIO_DIR, MODEL_CACHE_DIR, TMP_DIR, FRONTEND_DIR): directory.mkdir(parents=True, exist_ok=True) class Settings: app_name: str = "VoxSum Studio API" static_dir: Path = STATIC_DIR audio_dir: Path = AUDIO_DIR frontend_dir: Path = FRONTEND_DIR tmp_dir: Path = TMP_DIR model_cache_dir: Path = MODEL_CACHE_DIR max_audio_files: int = int(os.environ.get("VOXSUM_MAX_AUDIO_FILES", "20")) transcription_chunk_size: int = 100 @lru_cache(maxsize=1) def get_settings() -> Settings: return Settings()