Features: - VideoLearningAgent for automated video watching on Douyin/Kuaishou/TikTok - Web dashboard UI for video learning sessions - Real-time progress tracking with screenshot capture - App detection using get_current_app() for accurate recording - Session management with pause/resume/stop controls Technical improvements: - Simplified video detection logic using direct app detection - Full base64 hash for sensitive screenshot change detection - Immediate stop when target video count is reached - Fixed circular import issues with ModelConfig Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
"""
|
|
Dashboard configuration settings.
|
|
"""
|
|
|
|
import os
|
|
from typing import List
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
# Load .env file
|
|
load_dotenv()
|
|
|
|
|
|
class DashboardConfig:
|
|
"""Dashboard configuration."""
|
|
|
|
# Server settings
|
|
HOST: str = os.getenv("DASHBOARD_HOST", "0.0.0.0")
|
|
PORT: int = int(os.getenv("DASHBOARD_PORT", "8080"))
|
|
DEBUG: bool = os.getenv("DASHBOARD_DEBUG", "false").lower() == "true"
|
|
|
|
# CORS settings
|
|
CORS_ORIGINS: List[str] = os.getenv(
|
|
"DASHBOARD_CORS_ORIGINS", "*"
|
|
).split(",") if os.getenv("DASHBOARD_CORS_ORIGINS") else ["*"]
|
|
|
|
# Device settings
|
|
DEFAULT_DEVICE_TYPE: str = os.getenv("DEFAULT_DEVICE_TYPE", "adb")
|
|
|
|
# Task settings
|
|
MAX_CONCURRENT_TASKS: int = int(os.getenv("MAX_CONCURRENT_TASKS", "10"))
|
|
TASK_TIMEOUT_SECONDS: int = int(os.getenv("TASK_TIMEOUT_SECONDS", "300"))
|
|
|
|
# Screenshot settings
|
|
SCREENSHOT_QUALITY: int = int(os.getenv("SCREENSHOT_QUALITY", "80"))
|
|
SCREENSHOT_THROTTLE_MS: int = int(os.getenv("SCREENSHOT_THROTTLE_MS", "500"))
|
|
|
|
# Model settings (defaults from environment)
|
|
MODEL_BASE_URL: str = os.getenv("PHONE_AGENT_BASE_URL", "http://localhost:8000/v1")
|
|
MODEL_NAME: str = os.getenv("PHONE_AGENT_MODEL", "autoglm-phone-9b")
|
|
MODEL_API_KEY: str = os.getenv("PHONE_AGENT_API_KEY", "EMPTY")
|
|
MAX_TOKENS: int = int(os.getenv("PHONE_AGENT_MAX_TOKENS", "3000"))
|
|
TEMPERATURE: float = float(os.getenv("PHONE_AGENT_TEMPERATURE", "0.0"))
|
|
TOP_P: float = float(os.getenv("PHONE_AGENT_TOP_P", "0.85"))
|
|
FREQUENCY_PENALTY: float = float(os.getenv("PHONE_AGENT_FREQUENCY_PENALTY", "0.2"))
|
|
|
|
# Video learning settings
|
|
VIDEO_LEARNING_OUTPUT_DIR: str = os.getenv("VIDEO_LEARNING_OUTPUT_DIR", "./video_learning_data")
|
|
|
|
# Task history
|
|
MAX_TASK_HISTORY: int = int(os.getenv("MAX_TASK_HISTORY", "100"))
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
|
|
|
|
# Global config instance
|
|
config = DashboardConfig()
|