Files
shinalok 974bab7cd8 Phase 28: P3 — Pydantic Settings, dependency-injector IoC, tenacity retry
- config.py: dataclasses → pydantic-settings BaseSettings (flat AppConfig,
  env vars auto-loaded from .env, type-safe validation)
- api_client.py: HTTPAPIClient takes AppConfig directly (APIConfig removed);
  tenacity retry on 5 methods (reset/ingest/list/delete/feedback) —
  retries on 5xx + TransportError, 3 attempts, exponential backoff 1-8s
- container.py: manual DI → dependency_injector DeclarativeContainer with
  providers.Singleton; Container() needs no args
- app.py: container.X → container.X() calls, remove AppConfig import
- requirements.txt: add pydantic-settings, tenacity, dependency-injector

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 05:59:23 +09:00

19 lines
649 B
Python

from pydantic_settings import BaseSettings, SettingsConfigDict
class AppConfig(BaseSettings):
# API (env: YOULBOT_API_URL, YOULBOT_API_TOKEN, YOULBOT_API_TIMEOUT)
youlbot_api_url: str = "http://localhost:8000"
youlbot_api_token: str = ""
youlbot_api_timeout: int = 180
# STT/TTS (env: WHISPER_MODEL_SIZE, TTS_VOICE, TTS_EDGE_VOICE)
whisper_model_size: str = "small"
tts_voice: str = "Yuna"
tts_edge_voice: str = "ko-KR-SunHiNeural"
# 서버 / 로깅
log_level: str = "INFO"
server_host: str = "0.0.0.0"
server_port: int = 7860
model_config = SettingsConfigDict(env_file=".env", extra="ignore")