fix(dashboard): corriger les routes mortes, parsing API et liens cassés

Audit et corrections du Web Dashboard (port 5001) :

- Désactiver le bouton "Restaurer" (rollback) car la route /api/version/rollback
  n'est pas implémentée côté serveur
- Corriger le parsing de /api/version : les données sont dans version.version (dict),
  pas directement dans version (string)
- Corriger le parsing de /api/version/system-info : données imbriquées dans
  system_info.system, pas directement à la racine
- Corriger le parsing de /api/backup/stats : utiliser stats.*.file_count au lieu
  de categories.*.count qui n'existe pas
- Corriger le fallback correction packs pour utiliser le bon format de stats
- Corriger le parsing de faiss.total_vectors dans l'onglet Apprentissage
- Remplacer les données simulées dans loadActionTypeStats() par un placeholder honnête
- Corriger le HTML invalide (double attribut style sur configTestResults)
- Rendre switchTab() plus robuste avec event.target.closest('.tab')
- Réduire le polling services de 5s à 15s pour limiter la charge
- Mettre à jour SERVICES_CONFIG (ports corrects, .venv/ au lieu de venv_v3/)
- Ajouter le proxy streaming et 4 services manquants dans la config
- Ajouter 19 tests unitaires pour les routes du dashboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dom
2026-03-14 22:05:11 +01:00
parent 8f31ba95d3
commit 463f1dd95e
3 changed files with 643 additions and 207 deletions

View File

@@ -1582,30 +1582,54 @@ metrics_thread.start()
# Configuration des services RPA Vision V3
SERVICES_CONFIG = {
"agent_chat": {
"name": "Agent Chat (LLM)",
"description": "Interface conversationnelle avec Ollama",
"port": 5002,
"start_cmd": "cd {base} && ./venv_v3/bin/python -m agent_chat.app",
"url": "http://localhost:5002",
"icon": "🤖"
"api_server": {
"name": "API Server",
"description": "API principale RPA Vision V3 (upload, sessions)",
"port": 8000,
"start_cmd": "cd {base} && {base}/.venv/bin/python server/api_upload.py",
"url": "http://localhost:8000",
"icon": "🚀"
},
"monitoring": {
"name": "Monitoring",
"description": "Métriques et surveillance système",
"port": 5003,
"start_cmd": "cd {base} && {base}/.venv/bin/python monitoring_server.py",
"url": "http://localhost:5003",
"icon": "📈"
},
"vwb_backend": {
"name": "VWB Backend",
"description": "API Visual Workflow Builder",
"port": 5000,
"start_cmd": "cd {base}/visual_workflow_builder/backend && {base}/venv_v3/bin/python app.py",
"url": "http://localhost:5000",
"port": 5002,
"start_cmd": "cd {base}/visual_workflow_builder/backend && {base}/.venv/bin/python app.py",
"url": "http://localhost:5002",
"icon": "⚙️"
},
"vwb_frontend": {
"name": "VWB Frontend",
"description": "Interface React du Workflow Builder",
"port": 3000,
"start_cmd": "cd {base}/visual_workflow_builder/frontend && npm start",
"url": "http://localhost:3000",
"description": "Interface React du Workflow Builder (V4)",
"port": 3002,
"start_cmd": "cd {base}/visual_workflow_builder/frontend_v4 && npm run dev -- --port 3002 --host 0.0.0.0",
"url": "http://localhost:3002",
"icon": "🎨"
},
"agent_chat": {
"name": "Agent Chat (LLM)",
"description": "Interface conversationnelle avec Ollama",
"port": 5004,
"start_cmd": "cd {base} && ./.venv/bin/python -m agent_chat.app",
"url": "http://localhost:5004",
"icon": "🤖"
},
"streaming": {
"name": "Streaming Server",
"description": "Serveur de capture et streaming temps réel",
"port": 5005,
"start_cmd": "cd {base} && ./.venv/bin/python -m agent_v0.server_v1.api_stream",
"url": "http://localhost:5005",
"icon": "📡"
},
"web_dashboard": {
"name": "Dashboard (ce service)",
"description": "Panneau de contrôle RPA Vision V3",
@@ -2061,6 +2085,29 @@ def import_config():
return jsonify({"success": False, "error": str(e)}), 500
# =============================================================================
# API Streaming - Proxy vers le serveur de streaming (port 5005)
# =============================================================================
STREAMING_BASE_URL = 'http://localhost:5005/api/v1/traces/stream'
@app.route('/api/streaming/<path:endpoint>')
def proxy_streaming(endpoint):
"""Proxy vers le serveur de streaming pour éviter les problèmes CORS."""
import urllib.request
import urllib.error
try:
url = f'{STREAMING_BASE_URL}/{endpoint}'
req = urllib.request.Request(url, headers={'Accept': 'application/json'})
with urllib.request.urlopen(req, timeout=5) as response:
data = json.loads(response.read().decode())
return jsonify(data)
except urllib.error.URLError as e:
return jsonify({'error': f'Serveur streaming inaccessible: {e}'}), 502
except Exception as e:
return jsonify({'error': str(e)}), 500
# =============================================================================
# Main
# =============================================================================