Backend: - analyser_avec_ia.py: centraliser URL Ollama via os.environ.get() - action_contracts.py: assouplir le contrat ai_analyze_text (mode texte sans ancre visuelle, accepter prompt ou analysis_prompt) - intelligent_executor.py: supprimer le fallback coordonnées statiques quand la vision échoue — renvoyer not_found pour self-healing - workflow.py: ajouter endpoints validate et export-training run.sh: - Corriger les ports (3000 → 3002) et le venv (venv_v3 → .venv) - Lancer run_v4.sh au lieu de l'ancien run.sh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
719 lines
24 KiB
Bash
Executable File
719 lines
24 KiB
Bash
Executable File
#!/bin/bash
|
|
# RPA Vision V3 - Chef d'Orchestre 🎼
|
|
# Auteur: Dom, Alice Kiro - 15 décembre 2024
|
|
# Lance et orchestre tous les composants du système RPA Vision V3
|
|
|
|
set -e # Exit on error
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
PURPLE='\033[0;35m'
|
|
BOLD='\033[1m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Banner
|
|
echo -e "${PURPLE}${BOLD}"
|
|
echo "╔════════════════════════════════════════════════════════════╗"
|
|
echo "║ 🎼 RPA Vision V3 - Chef d'Orchestre 🎼 ║"
|
|
echo "║ 100% Vision-Based RPA System ║"
|
|
echo "║ Fiche #1 & #2 Corrections Applied ✅ ║"
|
|
echo "╚════════════════════════════════════════════════════════════╝"
|
|
echo -e "${NC}"
|
|
|
|
# Help
|
|
show_help() {
|
|
echo -e "${BOLD}🎼 RPA Vision V3 - Chef d'Orchestre${NC}"
|
|
echo ""
|
|
echo -e "${BOLD}Usage:${NC} ./run.sh [OPTIONS]"
|
|
echo ""
|
|
echo -e "${BOLD}🚀 Modes de Lancement:${NC}"
|
|
echo -e " ${GREEN}--full${NC} 🎯 Mode COMPLET (Recommandé) - Tout l'écosystème"
|
|
echo -e " ${CYAN}--gui${NC} 🖥️ Interface GUI PyQt5 (défaut)"
|
|
echo -e " ${BLUE}--server${NC} 🌐 API Server seul (port 8000)"
|
|
echo -e " ${PURPLE}--dashboard${NC} 📊 Dashboard Web seul (port 5001)"
|
|
echo -e " ${YELLOW}--monitoring${NC} 📈 Interface de monitoring (port 5003)"
|
|
echo -e " ${CYAN}--workflow${NC} 🔧 Visual Workflow Builder (port 3002)"
|
|
echo -e " ${GREEN}--agent${NC} 📹 Agent V0 (capture tool)"
|
|
echo -e " ${BLUE}--chat${NC} 💬 Agent Chat (port 5002)"
|
|
echo ""
|
|
echo -e "${BOLD}🧪 Tests & Validation:${NC}"
|
|
echo -e " ${GREEN}--test${NC} 🧪 Tests complets"
|
|
echo -e " ${CYAN}--test-quick${NC} ⚡ Tests rapides"
|
|
echo -e " ${YELLOW}--test-bbox${NC} 📐 Tests corrections BBOX (Fiche #2)"
|
|
echo -e " ${PURPLE}--demo${NC} 🎮 Démos d'intégration"
|
|
echo ""
|
|
echo -e "${BOLD}🔧 Maintenance:${NC}"
|
|
echo -e " ${YELLOW}--check${NC} ✅ Vérification environnement seul"
|
|
echo -e " ${RED}--reinstall${NC} 🔄 Réinstallation forcée des dépendances"
|
|
echo -e " ${BLUE}--status${NC} 📊 Status des services"
|
|
echo -e " ${GREEN}--stop${NC} 🛑 Arrêter tous les services"
|
|
echo ""
|
|
echo -e "${BOLD}📖 Exemples:${NC}"
|
|
echo -e " ${GREEN}./run.sh --full${NC} # 🎯 Écosystème complet (recommandé)"
|
|
echo -e " ${CYAN}./run.sh${NC} # 🖥️ GUI seule"
|
|
echo -e " ${BLUE}./run.sh --server --dashboard${NC} # 🌐 API + Dashboard"
|
|
echo -e " ${YELLOW}./run.sh --test-bbox${NC} # 📐 Tester corrections BBOX"
|
|
echo -e " ${PURPLE}./run.sh --demo${NC} # 🎮 Démos d'intégration"
|
|
echo ""
|
|
echo -e "${BOLD}🌐 URLs d'accès:${NC}"
|
|
echo -e " API Server: ${BLUE}http://localhost:8000${NC}"
|
|
echo -e " Dashboard: ${PURPLE}http://localhost:5001${NC}"
|
|
echo -e " Agent Chat: ${BLUE}http://localhost:5002${NC}"
|
|
echo -e " Monitoring: ${YELLOW}http://localhost:5003${NC}"
|
|
echo -e " Workflow Builder: ${CYAN}http://localhost:3002${NC}"
|
|
echo ""
|
|
}
|
|
|
|
# Parse arguments
|
|
MODE="gui"
|
|
FORCE_REINSTALL=false
|
|
CHECK_ONLY=false
|
|
LAUNCH_SERVER=false
|
|
LAUNCH_DASHBOARD=false
|
|
LAUNCH_MONITORING=false
|
|
LAUNCH_WORKFLOW=false
|
|
LAUNCH_AGENT=false
|
|
LAUNCH_COMMAND=false
|
|
|
|
for arg in "$@"; do
|
|
case $arg in
|
|
--full)
|
|
MODE="full"
|
|
LAUNCH_SERVER=true
|
|
LAUNCH_DASHBOARD=true
|
|
LAUNCH_MONITORING=true
|
|
LAUNCH_WORKFLOW=true
|
|
;;
|
|
--gui)
|
|
MODE="gui"
|
|
;;
|
|
--server|--api)
|
|
MODE="server"
|
|
LAUNCH_SERVER=true
|
|
;;
|
|
--dashboard|--web)
|
|
MODE="dashboard"
|
|
LAUNCH_DASHBOARD=true
|
|
;;
|
|
--monitoring|--monitor)
|
|
MODE="monitoring"
|
|
LAUNCH_MONITORING=true
|
|
;;
|
|
--workflow|--visual)
|
|
MODE="workflow"
|
|
LAUNCH_WORKFLOW=true
|
|
;;
|
|
--all)
|
|
MODE="all"
|
|
LAUNCH_SERVER=true
|
|
LAUNCH_DASHBOARD=true
|
|
;;
|
|
--agent)
|
|
MODE="agent"
|
|
LAUNCH_AGENT=true
|
|
;;
|
|
--chat|--cmd)
|
|
MODE="chat"
|
|
LAUNCH_COMMAND=true
|
|
;;
|
|
--test)
|
|
MODE="test"
|
|
;;
|
|
--test-quick)
|
|
MODE="test-quick"
|
|
;;
|
|
--test-bbox)
|
|
MODE="test-bbox"
|
|
;;
|
|
--demo)
|
|
MODE="demo"
|
|
;;
|
|
--status)
|
|
MODE="status"
|
|
;;
|
|
--stop)
|
|
MODE="stop"
|
|
;;
|
|
--reinstall)
|
|
FORCE_REINSTALL=true
|
|
;;
|
|
--check)
|
|
CHECK_ONLY=true
|
|
;;
|
|
-h|--help)
|
|
show_help
|
|
exit 0
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Get script directory
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Step 1: Check OS
|
|
echo -e "${BLUE}[1/7]${NC} Checking Operating System..."
|
|
OS=$(uname -s)
|
|
case "$OS" in
|
|
Linux*) OS_NAME="Linux";;
|
|
Darwin*) OS_NAME="macOS";;
|
|
MINGW*|MSYS*|CYGWIN*) OS_NAME="Windows";;
|
|
*) OS_NAME="Unknown";;
|
|
esac
|
|
echo -e "${GREEN}✓${NC} OS: $OS_NAME ($(uname -m))"
|
|
|
|
# Step 2: Check Python
|
|
echo -e "${BLUE}[2/7]${NC} Checking Python..."
|
|
if command -v python3 &> /dev/null; then
|
|
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
|
|
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d'.' -f1)
|
|
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d'.' -f2)
|
|
|
|
if [ "$PYTHON_MAJOR" -ge 3 ] && [ "$PYTHON_MINOR" -ge 8 ]; then
|
|
echo -e "${GREEN}✓${NC} Python $PYTHON_VERSION"
|
|
else
|
|
echo -e "${RED}✗${NC} Python 3.8+ required (found $PYTHON_VERSION)"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo -e "${RED}✗${NC} Python 3 not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Step 3: Check/Create Virtual Environment
|
|
echo -e "${BLUE}[3/7]${NC} Setting up Python environment..."
|
|
VENV_DIR=".venv"
|
|
|
|
if [ ! -d "$VENV_DIR" ]; then
|
|
echo " Creating virtual environment..."
|
|
python3 -m venv $VENV_DIR
|
|
echo -e "${GREEN}✓${NC} Virtual environment created"
|
|
else
|
|
echo -e "${GREEN}✓${NC} Virtual environment exists"
|
|
fi
|
|
|
|
# Activate venv
|
|
source $VENV_DIR/bin/activate
|
|
|
|
# ---------------------------------------------------------------------
|
|
# Fiche #23 - Sécurité (anti-oubli)
|
|
# - Crée/charge .env.local si absent
|
|
# - Fournit un lien dashboard avec token
|
|
# ---------------------------------------------------------------------
|
|
if [ -f "$SCRIPT_DIR/server/bootstrap_local_env.sh" ]; then
|
|
chmod +x "$SCRIPT_DIR/server/bootstrap_local_env.sh" 2>/dev/null || true
|
|
# shellcheck disable=SC1090
|
|
"$SCRIPT_DIR/server/bootstrap_local_env.sh" || true
|
|
fi
|
|
|
|
# Charge les variables dans ce script (sinon elles restent dans le sous-process)
|
|
if [ -f "$SCRIPT_DIR/.env.local" ]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$SCRIPT_DIR/.env.local"
|
|
set +a
|
|
fi
|
|
|
|
# Step 4: Install Dependencies
|
|
echo -e "${BLUE}[4/7]${NC} Checking dependencies..."
|
|
|
|
if [ "$FORCE_REINSTALL" = true ]; then
|
|
rm -f .deps_installed
|
|
fi
|
|
|
|
if [ ! -f ".deps_installed" ]; then
|
|
echo " Installing dependencies (this may take a few minutes)..."
|
|
$VENV_DIR/bin/python3 -m pip install --upgrade pip -q
|
|
$VENV_DIR/bin/python3 -m pip install -r requirements.txt -q
|
|
|
|
# Server dependencies
|
|
if [ -f "server/requirements_server.txt" ]; then
|
|
$VENV_DIR/bin/python3 -m pip install -r server/requirements_server.txt -q
|
|
fi
|
|
|
|
# Dashboard dependencies
|
|
if [ -f "web_dashboard/requirements.txt" ]; then
|
|
$VENV_DIR/bin/python3 -m pip install -r web_dashboard/requirements.txt -q
|
|
fi
|
|
|
|
touch .deps_installed
|
|
echo -e "${GREEN}✓${NC} Dependencies installed"
|
|
else
|
|
echo -e "${GREEN}✓${NC} Dependencies OK (use --reinstall to force)"
|
|
fi
|
|
|
|
# Step 5: Check GPU
|
|
echo -e "${BLUE}[5/7]${NC} Checking GPU..."
|
|
GPU_AVAILABLE=false
|
|
if command -v nvidia-smi &> /dev/null; then
|
|
GPU_INFO=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | head -1)
|
|
if [ ! -z "$GPU_INFO" ]; then
|
|
echo -e "${GREEN}✓${NC} GPU: $GPU_INFO"
|
|
GPU_AVAILABLE=true
|
|
fi
|
|
fi
|
|
if [ "$GPU_AVAILABLE" = false ]; then
|
|
echo -e "${YELLOW}⚠${NC} No NVIDIA GPU (using CPU)"
|
|
fi
|
|
|
|
# Step 6: Check Ollama
|
|
echo -e "${BLUE}[6/7]${NC} Checking Ollama..."
|
|
if command -v ollama &> /dev/null; then
|
|
echo -e "${GREEN}✓${NC} Ollama installed"
|
|
if ollama list 2>/dev/null | grep -q "qwen3-vl"; then
|
|
echo -e "${GREEN}✓${NC} qwen3-vl model available"
|
|
else
|
|
echo -e "${YELLOW}⚠${NC} qwen3-vl not found (run: ollama pull qwen3-vl:8b)"
|
|
fi
|
|
else
|
|
echo -e "${YELLOW}⚠${NC} Ollama not installed (optional)"
|
|
fi
|
|
|
|
# Step 7: Create directories
|
|
echo -e "${BLUE}[7/7]${NC} Creating directories..."
|
|
mkdir -p data/training/uploads
|
|
mkdir -p data/training/sessions
|
|
mkdir -p data/workflows
|
|
mkdir -p logs
|
|
mkdir -p models
|
|
echo -e "${GREEN}✓${NC} Directories ready"
|
|
|
|
# Summary
|
|
echo ""
|
|
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN}✓ Environment Ready${NC}"
|
|
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
|
|
if [ "$CHECK_ONLY" = true ]; then
|
|
echo ""
|
|
echo "Environment check complete. Use ./run.sh --help for options."
|
|
deactivate 2>/dev/null || true
|
|
exit 0
|
|
fi
|
|
|
|
# PIDs for cleanup
|
|
API_PID=""
|
|
DASHBOARD_PID=""
|
|
MONITORING_PID=""
|
|
WORKFLOW_PID=""
|
|
COMMAND_PID=""
|
|
|
|
# Service management functions
|
|
start_service() {
|
|
local name=$1
|
|
local command=$2
|
|
local port=$3
|
|
local log_file=$4
|
|
|
|
echo "Starting $name (port $port)..."
|
|
eval "$command > logs/$log_file 2>&1 &"
|
|
local pid=$!
|
|
sleep 3
|
|
|
|
if kill -0 $pid 2>/dev/null; then
|
|
echo -e "${GREEN}✓${NC} $name started (PID: $pid)"
|
|
echo $pid # Retourner le PID via stdout
|
|
else
|
|
echo -e "${RED}✗${NC} $name failed to start"
|
|
cat logs/$log_file
|
|
echo 0 # Retourner 0 en cas d'échec
|
|
fi
|
|
}
|
|
|
|
check_service_status() {
|
|
local name=$1
|
|
local port=$2
|
|
|
|
if curl -s "http://localhost:$port" > /dev/null 2>&1; then
|
|
echo -e "${GREEN}✓${NC} $name (port $port) - Running"
|
|
else
|
|
echo -e "${RED}✗${NC} $name (port $port) - Stopped"
|
|
fi
|
|
}
|
|
|
|
cleanup() {
|
|
echo ""
|
|
echo -e "${YELLOW}🛑 Stopping services...${NC}"
|
|
[ ! -z "$API_PID" ] && kill $API_PID 2>/dev/null || true
|
|
[ ! -z "$DASHBOARD_PID" ] && kill $DASHBOARD_PID 2>/dev/null || true
|
|
[ ! -z "$MONITORING_PID" ] && kill $MONITORING_PID 2>/dev/null || true
|
|
[ ! -z "$WORKFLOW_PID" ] && kill $WORKFLOW_PID 2>/dev/null || true
|
|
[ ! -z "$COMMAND_PID" ] && kill $COMMAND_PID 2>/dev/null || true
|
|
|
|
# Kill any remaining processes on our ports
|
|
pkill -f "port 8000" 2>/dev/null || true
|
|
pkill -f "port 5001" 2>/dev/null || true
|
|
pkill -f "port 5002" 2>/dev/null || true
|
|
pkill -f "port 5003" 2>/dev/null || true
|
|
pkill -f "port 3002" 2>/dev/null || true
|
|
pkill -f "vite.*3002" 2>/dev/null || true
|
|
|
|
deactivate 2>/dev/null || true
|
|
echo -e "${GREEN}✓${NC} Cleanup complete"
|
|
exit 0
|
|
}
|
|
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
# Launch based on mode
|
|
case $MODE in
|
|
gui)
|
|
echo ""
|
|
echo -e "${CYAN}🖥️ Launching GUI...${NC}"
|
|
$VENV_DIR/bin/python3 run_gui.py
|
|
;;
|
|
|
|
server)
|
|
echo ""
|
|
echo -e "${BLUE}🌐 Launching API Server on port 8000...${NC}"
|
|
echo ""
|
|
echo "Endpoints:"
|
|
echo " POST http://localhost:8000/api/traces/upload"
|
|
echo " GET http://localhost:8000/api/traces/status"
|
|
echo " GET http://localhost:8000/api/traces/sessions"
|
|
echo " GET http://localhost:8000/api/traces/queue"
|
|
echo ""
|
|
$VENV_DIR/bin/python3 server/api_upload.py
|
|
;;
|
|
|
|
dashboard)
|
|
echo ""
|
|
echo -e "${PURPLE}📊 Launching Dashboard on port 5001...${NC}"
|
|
echo ""
|
|
echo "Access: http://localhost:5001"
|
|
echo ""
|
|
$VENV_DIR/bin/python3 web_dashboard/app.py
|
|
;;
|
|
|
|
monitoring)
|
|
echo ""
|
|
echo -e "${YELLOW}📈 Launching Monitoring Interface on port 5003...${NC}"
|
|
echo ""
|
|
echo "Access: http://localhost:5003"
|
|
echo ""
|
|
# Create simple monitoring interface
|
|
cat > monitoring_server.py << 'EOF'
|
|
from flask import Flask, render_template_string
|
|
import psutil
|
|
import json
|
|
from datetime import datetime
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/')
|
|
def monitoring():
|
|
return render_template_string('''
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>🎼 RPA Vision V3 - Monitoring</title>
|
|
<meta http-equiv="refresh" content="5">
|
|
<style>
|
|
body { font-family: Arial; margin: 20px; background: #f5f5f5; }
|
|
.container { max-width: 1200px; margin: 0 auto; }
|
|
.card { background: white; padding: 20px; margin: 10px 0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
|
.status-ok { color: #28a745; }
|
|
.status-warning { color: #ffc107; }
|
|
.status-error { color: #dc3545; }
|
|
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
|
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🎼 RPA Vision V3 - Monitoring Dashboard</h1>
|
|
<div class="card">
|
|
<h2>📊 System Metrics</h2>
|
|
<div class="metric">CPU: {{ cpu }}%</div>
|
|
<div class="metric">Memory: {{ memory }}%</div>
|
|
<div class="metric">Disk: {{ disk }}%</div>
|
|
<div class="metric">Uptime: {{ uptime }}</div>
|
|
</div>
|
|
<div class="card">
|
|
<h2>🌐 Services Status</h2>
|
|
<div class="services">
|
|
<div>API Server (8000): <span id="api-status">Checking...</span></div>
|
|
<div>Dashboard (5001): <span id="dashboard-status">Checking...</span></div>
|
|
<div>Command (5002): <span id="command-status">Checking...</span></div>
|
|
<div>Workflow (3000): <span id="workflow-status">Checking...</span></div>
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<h2>📈 RPA Vision V3 Status</h2>
|
|
<p>✅ Fiche #1 & #2 Corrections Applied</p>
|
|
<p>🎯 BBOX Precision: ~95% (improved from ~60%)</p>
|
|
<p>🔧 All contrats de données unified</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
''',
|
|
cpu=psutil.cpu_percent(),
|
|
memory=psutil.virtual_memory().percent,
|
|
disk=psutil.disk_usage('/').percent,
|
|
uptime=str(datetime.now() - datetime.fromtimestamp(psutil.boot_time())).split('.')[0]
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5003, debug=False)
|
|
EOF
|
|
$VENV_DIR/bin/python3 monitoring_server.py
|
|
;;
|
|
|
|
workflow)
|
|
echo ""
|
|
echo -e "${CYAN}🔧 Launching Visual Workflow Builder v4...${NC}"
|
|
echo ""
|
|
echo "Access: http://localhost:3002 (frontend) / http://localhost:5001 (backend)"
|
|
echo ""
|
|
cd visual_workflow_builder
|
|
./run_v4.sh
|
|
cd ..
|
|
;;
|
|
|
|
agent)
|
|
echo ""
|
|
echo -e "${GREEN}📹 Launching Agent V0 (capture tool)...${NC}"
|
|
echo ""
|
|
echo "The agent will appear in your system tray."
|
|
echo "Click the icon to start/stop recording."
|
|
echo ""
|
|
|
|
# Export necessary environment variables for the agent
|
|
export RPA_TOKEN_ADMIN="${RPA_TOKEN_ADMIN:-}"
|
|
export RPA_TOKEN_READONLY="${RPA_TOKEN_READONLY:-}"
|
|
export ENCRYPTION_PASSWORD="${ENCRYPTION_PASSWORD:-}"
|
|
|
|
cd agent_v0
|
|
../$VENV_DIR/bin/python3 main.py
|
|
cd ..
|
|
;;
|
|
|
|
chat)
|
|
echo ""
|
|
echo -e "${BLUE}💬 Launching Agent Chat on port 5002...${NC}"
|
|
echo ""
|
|
echo "Access: http://localhost:5002"
|
|
echo ""
|
|
$VENV_DIR/bin/python3 agent_chat/app.py
|
|
;;
|
|
|
|
full)
|
|
echo ""
|
|
echo -e "${GREEN}${BOLD}🎯 Launching FULL ECOSYSTEM...${NC}"
|
|
echo ""
|
|
|
|
# Start API server
|
|
API_PID=$(start_service "API Server" "$VENV_DIR/bin/python3 server/api_upload.py" "8000" "api.log")
|
|
|
|
# Start Dashboard
|
|
DASHBOARD_PID=$(start_service "Dashboard" "$VENV_DIR/bin/python3 web_dashboard/app.py" "5001" "dashboard.log")
|
|
|
|
# Start Monitoring
|
|
cat > monitoring_server.py << 'EOF'
|
|
from flask import Flask, render_template_string
|
|
import psutil
|
|
import json
|
|
from datetime import datetime
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/')
|
|
def monitoring():
|
|
return render_template_string('''
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>🎼 RPA Vision V3 - Monitoring</title>
|
|
<meta http-equiv="refresh" content="5">
|
|
<style>
|
|
body { font-family: Arial; margin: 20px; background: #f5f5f5; }
|
|
.container { max-width: 1200px; margin: 0 auto; }
|
|
.card { background: white; padding: 20px; margin: 10px 0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
|
.status-ok { color: #28a745; }
|
|
.status-warning { color: #ffc107; }
|
|
.status-error { color: #dc3545; }
|
|
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
|
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🎼 RPA Vision V3 - Monitoring Dashboard</h1>
|
|
<div class="card">
|
|
<h2>📊 System Metrics</h2>
|
|
<div class="metric">CPU: {{ cpu }}%</div>
|
|
<div class="metric">Memory: {{ memory }}%</div>
|
|
<div class="metric">Disk: {{ disk }}%</div>
|
|
<div class="metric">Uptime: {{ uptime }}</div>
|
|
</div>
|
|
<div class="card">
|
|
<h2>🌐 Services Status</h2>
|
|
<div class="services">
|
|
<div>API Server (8000): <span class="status-ok">✅ Running</span></div>
|
|
<div>Dashboard (5001): <span class="status-ok">✅ Running</span></div>
|
|
<div>Monitoring (5003): <span class="status-ok">✅ Running</span></div>
|
|
<div>Command (5002): <span class="status-warning">⚠️ Optional</span></div>
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<h2>📈 RPA Vision V3 Status</h2>
|
|
<p>✅ Fiche #1 & #2 Corrections Applied</p>
|
|
<p>🎯 BBOX Precision: ~95% (improved from ~60%)</p>
|
|
<p>🔧 All contrats de données unified</p>
|
|
<p>🚀 Full ecosystem running!</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
''',
|
|
cpu=psutil.cpu_percent(),
|
|
memory=psutil.virtual_memory().percent,
|
|
disk=psutil.disk_usage('/').percent,
|
|
uptime=str(datetime.now() - datetime.fromtimestamp(psutil.boot_time())).split('.')[0]
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5003, debug=False)
|
|
EOF
|
|
MONITORING_PID=$(start_service "Monitoring" "$VENV_DIR/bin/python3 monitoring_server.py" "5003" "monitoring.log")
|
|
|
|
# Start Visual Workflow Builder v4 (in background)
|
|
echo "Starting Visual Workflow Builder v4 (port 3002)..."
|
|
cd visual_workflow_builder
|
|
./run_v4.sh > ../logs/workflow.log 2>&1 &
|
|
WORKFLOW_PID=$!
|
|
cd ..
|
|
sleep 3
|
|
|
|
if kill -0 $WORKFLOW_PID 2>/dev/null; then
|
|
echo -e "${GREEN}✓${NC} Visual Workflow Builder started (PID: $WORKFLOW_PID)"
|
|
else
|
|
echo -e "${YELLOW}⚠${NC} Visual Workflow Builder may need manual start"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${GREEN}${BOLD}🎉 FULL ECOSYSTEM RUNNING!${NC}"
|
|
echo ""
|
|
echo -e "${BOLD}🌐 Access URLs:${NC}"
|
|
echo -e " API Server: ${BLUE}http://localhost:8000${NC}"
|
|
echo -e " Dashboard: ${PURPLE}http://localhost:5001${NC}"
|
|
echo -e " Monitoring: ${YELLOW}http://localhost:5003${NC}"
|
|
echo -e " Workflow Builder: ${CYAN}http://localhost:3002${NC}"
|
|
echo ""
|
|
echo -e "${BOLD}📊 Logs:${NC}"
|
|
echo " tail -f logs/api.log"
|
|
echo " tail -f logs/dashboard.log"
|
|
echo " tail -f logs/monitoring.log"
|
|
echo " tail -f logs/workflow.log"
|
|
echo ""
|
|
echo -e "${BOLD}🎯 Ready to test Fiche #1 & #2 corrections!${NC}"
|
|
echo ""
|
|
|
|
# Start GUI as main interface
|
|
echo "Starting GUI as main interface..."
|
|
$VENV_DIR/bin/python3 run_gui.py
|
|
|
|
cleanup
|
|
;;
|
|
|
|
all)
|
|
echo ""
|
|
echo -e "${CYAN}🌐 Launching API + Dashboard...${NC}"
|
|
echo ""
|
|
|
|
# Start API server
|
|
API_PID=$(start_service "API Server" "$VENV_DIR/bin/python3 server/api_upload.py" "8000" "api.log")
|
|
|
|
# Start Dashboard
|
|
DASHBOARD_PID=$(start_service "Dashboard" "$VENV_DIR/bin/python3 web_dashboard/app.py" "5001" "dashboard.log")
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Services running!${NC}"
|
|
echo ""
|
|
echo "URLs:"
|
|
echo " API: http://localhost:8000"
|
|
echo " Dashboard: http://localhost:5001"
|
|
echo ""
|
|
echo "Logs:"
|
|
echo " tail -f logs/api.log"
|
|
echo " tail -f logs/dashboard.log"
|
|
echo ""
|
|
|
|
# Start GUI
|
|
echo "Starting GUI..."
|
|
$VENV_DIR/bin/python3 run_gui.py
|
|
|
|
cleanup
|
|
;;
|
|
|
|
test)
|
|
echo ""
|
|
echo -e "${GREEN}🧪 Running complete tests...${NC}"
|
|
echo ""
|
|
$VENV_DIR/bin/python3 -m pytest tests/ -v --tb=short
|
|
;;
|
|
|
|
test-quick)
|
|
echo ""
|
|
echo -e "${CYAN}⚡ Running quick tests...${NC}"
|
|
echo ""
|
|
./test_quick.sh
|
|
;;
|
|
|
|
test-bbox)
|
|
echo ""
|
|
echo -e "${YELLOW}📐 Testing BBOX corrections (Fiche #2)...${NC}"
|
|
echo ""
|
|
$VENV_DIR/bin/python3 -m pytest tests/unit/test_fiche2_bbox_xywh_corrections.py tests/unit/test_bbox_center_xywh.py -v
|
|
;;
|
|
|
|
demo)
|
|
echo ""
|
|
echo -e "${PURPLE}🎮 Running integration demos...${NC}"
|
|
echo ""
|
|
echo "Available demos:"
|
|
echo "1. Full Integration Demo"
|
|
echo "2. Automation Demo"
|
|
echo "3. Self-Healing Demo"
|
|
echo ""
|
|
read -p "Choose demo (1-3): " demo_choice
|
|
case $demo_choice in
|
|
1) $VENV_DIR/bin/python3 demo_full_integration.py ;;
|
|
2) $VENV_DIR/bin/python3 demo_automation.py ;;
|
|
3) $VENV_DIR/bin/python3 demo_self_healing.py ;;
|
|
*) echo "Invalid choice" ;;
|
|
esac
|
|
;;
|
|
|
|
status)
|
|
echo ""
|
|
echo -e "${BLUE}📊 Services Status:${NC}"
|
|
echo ""
|
|
check_service_status "API Server" "8000"
|
|
check_service_status "Dashboard" "5001"
|
|
check_service_status "Agent Chat" "5002"
|
|
check_service_status "Monitoring" "5003"
|
|
check_service_status "Workflow Builder" "3002"
|
|
echo ""
|
|
;;
|
|
|
|
stop)
|
|
echo ""
|
|
echo -e "${RED}🛑 Stopping all services...${NC}"
|
|
pkill -f "port 8000" 2>/dev/null || true
|
|
pkill -f "port 5001" 2>/dev/null || true
|
|
pkill -f "port 5002" 2>/dev/null || true
|
|
pkill -f "port 5003" 2>/dev/null || true
|
|
pkill -f "port 3002" 2>/dev/null || true
|
|
pkill -f "vite.*3002" 2>/dev/null || true
|
|
echo -e "${GREEN}✓${NC} All services stopped"
|
|
;;
|
|
esac
|
|
|
|
deactivate 2>/dev/null || true
|