from pydantic_settings import BaseSettings from typing import Optional import os from pathlib import Path class Settings(BaseSettings): # FastAPI配置 host: str = "0.0.0.0" port: int = 8000 # Qwen API配置 dashscope_api_key: Optional[str] = None # 微信窗口配置 wechat_window_name: str = "WeChat" # 自动化配置 click_pause: float = 0.5 failsafe: bool = True action_timeout: int = 30 # 重试配置 max_retries: int = 3 retry_base_delay: float = 1.0 # 日志配置 log_level: str = "INFO" log_file: str = "/tmp/wechat_auto.log" # 截图保存目录 screenshot_dir: str = "/tmp/wechat_screenshots" class Config: env_file = str(Path(__file__).parent / ".env") extra = "allow" settings = Settings()