45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
"""
|
||
工作手机SDK v3.0 - 配置管理
|
||
"""
|
||
|
||
from pydantic_settings import BaseSettings
|
||
from typing import Optional
|
||
|
||
|
||
class Settings(BaseSettings):
|
||
"""应用配置"""
|
||
|
||
# 环境
|
||
ENV: str = "development"
|
||
DEBUG: bool = True
|
||
|
||
# API密钥
|
||
API_KEY: str = "workphone-secret-key"
|
||
|
||
# MongoDB
|
||
MONGO_URI: str = "mongodb://localhost:27017"
|
||
MONGO_DB: str = "workphone_sdk"
|
||
|
||
# Redis
|
||
REDIS_URL: str = "redis://localhost:6379/1"
|
||
|
||
# AI Agent
|
||
DEEPSEEK_API_KEY: Optional[str] = None
|
||
DEEPSEEK_BASE_URL: str = "https://api.deepseek.com/v1"
|
||
DEEPSEEK_MODEL: str = "deepseek-chat"
|
||
|
||
# WebSocket(需求:5s/10s 可配置)
|
||
WS_HEARTBEAT_INTERVAL: int = 10 # 秒,支持 5/10/30
|
||
WS_TIMEOUT: int = 60 # 秒
|
||
|
||
# 设备命令
|
||
COMMAND_TIMEOUT: int = 30 # 秒,通用指令等待
|
||
MESSAGE_SEND_TIMEOUT: int = 60 # 秒,发消息专用(可配置,避免无限挂起)
|
||
|
||
class Config:
|
||
env_file = ".env"
|
||
extra = "ignore"
|
||
|
||
|
||
settings = Settings()
|