Add Web Dashboard with multi-device control and callback hooks
Features: - Web Dashboard: FastAPI-based dashboard with Vue.js frontend - Multi-device support (ADB, HDC, iOS) - Real-time WebSocket updates for task progress - Device management with status tracking - Task queue with execution controls (start/stop/re-execute) - Detailed task information display (thinking, actions, completion messages) - Screenshot viewing per device - LAN deployment support with configurable CORS - Callback Hooks: Interrupt and modify task execution - step_callback: Called after each step with StepResult - before_action_callback: Called before executing action - Support for task interruption and dynamic task switching - Example scripts demonstrating callback usage - Configuration: Environment-based configuration - .env file support for all settings - .env.example template with documentation - Model API configuration (base URL, model name, API key) - Dashboard configuration (host, port, CORS, device type) - Phone agent configuration (delays, max steps, language) Technical improvements: - Fixed forward reference issue with StepResult - Added package exports for callback types and configs - Enhanced dependencies with FastAPI, WebSocket support - Thread-safe task execution with device locking - Async WebSocket broadcasting from sync thread pool Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
7
main.py
7
main.py
@@ -11,6 +11,9 @@ Environment Variables:
|
||||
PHONE_AGENT_API_KEY: API key for model authentication (default: EMPTY)
|
||||
PHONE_AGENT_MAX_STEPS: Maximum steps per task (default: 100)
|
||||
PHONE_AGENT_DEVICE_ID: ADB device ID for multi-device setups
|
||||
|
||||
Configuration Files:
|
||||
.env: Automatically loaded from current directory or project root
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@@ -20,8 +23,12 @@ import subprocess
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from openai import OpenAI
|
||||
|
||||
# Load .env file if exists (search in current directory and project root)
|
||||
load_dotenv()
|
||||
|
||||
from phone_agent import PhoneAgent
|
||||
from phone_agent.agent import AgentConfig
|
||||
from phone_agent.agent_ios import IOSAgentConfig, IOSPhoneAgent
|
||||
|
||||
Reference in New Issue
Block a user