feat(vwb): Améliorer outils IA et supprimer fallback statique
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>
This commit is contained in:
@@ -817,36 +817,20 @@ def find_and_click(
|
||||
except Exception as seeclick_err:
|
||||
print(f"⚠️ [Vision] Erreur SeeClick: {seeclick_err}")
|
||||
|
||||
# === STRATÉGIE 5: Coordonnées statiques (dernier recours) ===
|
||||
# === Toutes les méthodes visuelles ont échoué ===
|
||||
if anchor_bbox:
|
||||
best_conf = max(global_result.get('confidence', 0), 0)
|
||||
|
||||
# Utiliser coordonnées statiques seulement si confiance > 0.5
|
||||
if best_conf >= 0.5:
|
||||
print(f"⚠️ [Vision] Fallback: coordonnées statiques (confiance: {best_conf:.2f})")
|
||||
center_x = anchor_bbox.get('x', 0) + anchor_bbox.get('width', 0) // 2
|
||||
center_y = anchor_bbox.get('y', 0) + anchor_bbox.get('height', 0) // 2
|
||||
return {
|
||||
'found': True,
|
||||
'coordinates': {'x': int(center_x), 'y': int(center_y)},
|
||||
'bbox': anchor_bbox,
|
||||
'confidence': best_conf,
|
||||
'method': 'static_fallback',
|
||||
'search_time_ms': (_time.time() - start_time) * 1000,
|
||||
'candidates': []
|
||||
}
|
||||
else:
|
||||
print(f"❌ [Vision] Ancre non trouvée (confiance: {best_conf:.2f})")
|
||||
return {
|
||||
'found': False,
|
||||
'coordinates': None,
|
||||
'bbox': anchor_bbox,
|
||||
'confidence': best_conf,
|
||||
'method': 'not_found',
|
||||
'search_time_ms': (_time.time() - start_time) * 1000,
|
||||
'candidates': [],
|
||||
'reason': 'Ancre non trouvée à l\'écran'
|
||||
}
|
||||
print(f"❌ [Vision] Ancre non trouvée à l'écran (meilleure confiance: {best_conf:.2f})")
|
||||
return {
|
||||
'found': False,
|
||||
'coordinates': None,
|
||||
'bbox': anchor_bbox,
|
||||
'confidence': best_conf,
|
||||
'method': 'not_found',
|
||||
'search_time_ms': (_time.time() - start_time) * 1000,
|
||||
'candidates': [],
|
||||
'reason': 'Aucune méthode visuelle n\'a trouvé l\'ancre à l\'écran'
|
||||
}
|
||||
|
||||
# Pas de bbox, impossible de chercher
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user