Files
workphone-sdk/sdk/app/config.py
Manus AI 68b4d8f7aa feat(hook): 扩展 ACTION_TO_RPC 映射与 wechat_hook_v2 RPC 实现
同步 agent/app 双端 hook_executor 动作表与 wechat_hook_v2.js exports;
补充 hook 子脚本与 _hook_smoke 冒烟入口,更新 device_modules 探测结果。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 10:02:00 +08:00

53 lines
1.4 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 通道回退
# AI 心跳任务队列0 表示无上限(每周期抽空队列 / 队列不截断)
AI_HEARTBEAT_TASK_BATCH: int = 0
AI_HEARTBEAT_QUEUE_MAXLEN: int = 0
class Config:
env_file = ".env"
extra = "ignore"
settings = Settings()