Phase 26: P1 architecture refactor — DI container, service layer, async callbacks
- config.py: APIConfig + AppConfig dataclasses, env vars centralized - api_client.py: APIClientProtocol (Protocol) + HTTPAPIClient class, remove module-level globals - services.py: ChatService, DocumentService, TTSService (TTS moved from app.py) - container.py: manual DI container with lazy singleton properties - app.py: all callbacks converted to async, asyncio.run() fully removed, container wired in - .env.example: add TTS_EDGE_VOICE entry - ROADMAP.md: P0/P1 checklist updated to reflect completed work Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from dataclasses import dataclass, field
|
||||
import os
|
||||
|
||||
|
||||
@dataclass
|
||||
class APIConfig:
|
||||
url: str = field(default_factory=lambda: os.getenv("YOULBOT_API_URL", "http://localhost:8000"))
|
||||
token: str = field(default_factory=lambda: os.getenv("YOULBOT_API_TOKEN", ""))
|
||||
timeout: int = 180
|
||||
|
||||
|
||||
@dataclass
|
||||
class AppConfig:
|
||||
api: APIConfig = field(default_factory=APIConfig)
|
||||
whisper_model_size: str = field(default_factory=lambda: os.getenv("WHISPER_MODEL_SIZE", "small"))
|
||||
tts_voice: str = field(default_factory=lambda: os.getenv("TTS_VOICE", "Yuna"))
|
||||
tts_edge_voice: str = field(default_factory=lambda: os.getenv("TTS_EDGE_VOICE", "ko-KR-SunHiNeural"))
|
||||
server_host: str = "0.0.0.0"
|
||||
server_port: int = 7860
|
||||
Reference in New Issue
Block a user