fix: grounding pour TOUT texte visible (OCR + VLM), auto-unload gemma4

1. Le grounding se déclenche pour by_text_source="vlm" (pas juste "ocr")
   Les textes lus par gemma4 (onglets, labels) sont du texte visible,
   le grounding doit les chercher comme n'importe quel texte OCR.

2. gemma4 est automatiquement déchargé après le build_replay
   pour libérer la VRAM et permettre à qwen2.5vl de charger au replay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-05 12:24:44 +02:00
parent 1c5ff42006
commit f0b311306d
2 changed files with 22 additions and 4 deletions

View File

@@ -5189,8 +5189,8 @@ def _resolve_target_sync(
# ---------------------------------------------------------------
by_text_source = target_spec.get("by_text_source", "")
if by_text_strict and by_text_source == "ocr":
# Texte OCR fiable → grounding VLM direct
if by_text_strict and by_text_source in ("ocr", "vlm"):
# Texte visible (OCR ou lu par gemma4) → grounding VLM direct
grounding_result = _resolve_by_grounding(
screenshot_path=screenshot_path,
target_spec=target_spec,
@@ -5206,8 +5206,8 @@ def _resolve_target_sync(
)
return grounding_result
if not by_text_strict or by_text_source != "ocr":
# Template matching sur la fenêtre active si disponible (évite les faux positifs)
if not by_text_strict or by_text_source not in ("ocr", "vlm"):
# Template matching pour les éléments sans texte (icônes pures)
window_capture = target_spec.get("window_capture", {})
window_rect = window_capture.get("rect")
from pathlib import Path as _Path