Files
workphone-sdk/sdk/app/config.py
Manus AI 42fe10401a 1
1
2026-05-24 17:50:04 +08:00

54 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
工作手机SDK v3.0 - 配置管理
"""
try:
from pydantic_settings import BaseSettings
except ImportError: # NAS / pydantic v1 降级
from pydantic 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 # 秒,发消息专用(可配置,避免无限挂起)
WECHAT_BACKEND_ONLY: bool = True # 微信动作仅允许后端 Hook不允许 UI 通道回退
WECHAT_WS_HOOK_ONLY: bool = True # 微信仅 WebSocket Agent + Frida禁止服务端 ADB 直连/ u2 降级
# AI 心跳任务队列0 表示无上限(每周期抽空队列 / 队列不截断)
AI_HEARTBEAT_TASK_BATCH: int = 0
AI_HEARTBEAT_QUEUE_MAXLEN: int = 0
class Config:
env_file = ".env"
extra = "ignore"
settings = Settings()