diff --git a/visual_workflow_builder/backend/api_v3/execute.py b/visual_workflow_builder/backend/api_v3/execute.py index 2c4a098a5..2e9de2dd1 100644 --- a/visual_workflow_builder/backend/api_v3/execute.py +++ b/visual_workflow_builder/backend/api_v3/execute.py @@ -560,6 +560,20 @@ def execute_workflow_thread(execution_id: str, workflow_id: str, app): db.session.commit() break + # Vérification finale : gérer les dialogues restants après la dernière étape + if _execution_state.get('execution_mode') in ('intelligent', 'debug'): + print(f"\n{'='*60}") + print(f"🔎 [Post-workflow] Vérification écran final...") + time.sleep(1.0) + for attempt in range(3): + detected = _check_screen_for_patterns() + if detected: + print(f"🧠 [Post-workflow] Dialogue détecté: {detected.get('pattern')}") + _handle_detected_pattern(detected) + time.sleep(1.0) + else: + break + # Finaliser l'exécution if execution.status == 'running': execution.status = 'completed'