fix: ajouter position relative au prompt grounding (désambiguïsation)

Quand plusieurs éléments ont le même texte ("Rechercher" dans la taskbar
ET dans l'explorateur), la position relative (en bas, en haut, à gauche)
aide le VLM à choisir le bon.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-05 12:04:46 +02:00
parent b09a3df054
commit 1c5ff42006

View File

@@ -4580,7 +4580,14 @@ def _resolve_by_grounding(
return None
# Prompt natif Qwen2.5-VL — format bbox_2d (le seul fiable)
prompt = f"Detect '{description}' in this image with a bounding box."
# Ajouter la position relative pour désambiguïser (ex: deux "Rechercher" à l'écran)
original_pos = target_spec.get("original_position", {})
pos_hint = ""
y_rel = original_pos.get("y_relative", "")
x_rel = original_pos.get("x_relative", "")
if y_rel or x_rel:
pos_hint = f" located {y_rel} {x_rel} of the screen".strip()
prompt = f"Detect '{description}'{pos_hint} in this image with a bounding box."
# Le grounding nécessite un modèle entraîné pour les coordonnées (bbox_2d).
# Qwen2.5-VL est le seul qui retourne des positions précises.