diff --git a/core/detection/ui_detector.py b/core/detection/ui_detector.py index f5011ef2b..b2dc1aa06 100644 --- a/core/detection/ui_detector.py +++ b/core/detection/ui_detector.py @@ -217,7 +217,7 @@ class UIDetector: # des centaines d'appels VLM inutiles (~2-3s chacun). # On garde max 80 candidats — suffisant pour obtenir ~50 éléments # après filtrage par confiance, tout en gardant un temps raisonnable. - max_candidates = 80 + max_candidates = 30 # 30 suffisent pour les éléments principaux (~6min/screenshot au lieu de 17) if len(regions) > max_candidates: # Trier par confiance décroissante, puis par surface décroissante regions.sort(key=lambda r: (r.confidence, r.w * r.h), reverse=True) diff --git a/visual_workflow_builder/backend/services/learned_workflow_bridge.py b/visual_workflow_builder/backend/services/learned_workflow_bridge.py index 28bc20b0f..8bcfe0bb5 100644 --- a/visual_workflow_builder/backend/services/learned_workflow_bridge.py +++ b/visual_workflow_builder/backend/services/learned_workflow_bridge.py @@ -553,8 +553,14 @@ def list_learned_workflows_from_disk() -> List[Dict[str, Any]]: Retourne une liste de dicts avec les métadonnées de base. """ - base_dir = Path(_ROOT) / "data" / "training" / "workflows" - if not base_dir.exists(): + # Chercher dans les deux emplacements possibles + base_dirs = [ + Path(_ROOT) / "data" / "training" / "workflows", + Path(_ROOT) / "data" / "training" / "live_sessions" / "workflows", + ] + + existing_dirs = [d for d in base_dirs if d.exists()] + if not existing_dirs: return [] workflows = [] @@ -578,13 +584,12 @@ def list_learned_workflows_from_disk() -> List[Dict[str, Any]]: except Exception as e: logger.warning("Erreur lecture %s : %s", f, e) - # Racine - _scan_dir(base_dir) - - # Sous-dossiers machine - for machine_dir in sorted(base_dir.iterdir()): - if machine_dir.is_dir(): - _scan_dir(machine_dir, machine_id=machine_dir.name) + # Scanner tous les répertoires trouvés + for base_dir in existing_dirs: + _scan_dir(base_dir) + for machine_dir in sorted(base_dir.iterdir()): + if machine_dir.is_dir(): + _scan_dir(machine_dir, machine_id=machine_dir.name) return workflows