feat(p1x): de-hardcode VLM models/endpoints to vlm_config (DGX-ready)

Migre les call-sites VLM serveur vers la configuration centrale pour
fonctionner sur DGX (tunnel Ollama 11434), où gemma4:* est absent et le
port Docker 11435 est mort.

- task_planner, replay_verifier, domain_context, ir_builder, resolve_engine
  (popup): modele -> vlm_config.get_vlm_model(), defaut 11435 -> 11434
  (override GEMMA4_PORT legacy conserve)
- resolve_engine (grounding bbox x2): nouvel helper
  vlm_config.get_bbox_grounding_model() (var dediee RPA_BBOX_GROUNDING_MODEL,
  fallback RPA_GROUNDING_MODEL puis qwen2.5vl:7b-rpa) -> desambiguise le
  conflit D5-v3b, bbox_2d + num_ctx 4096 preserves
- safety_checks_provider: defaut -> get_vlm_model(), override
  RPA_SAFETY_CHECKS_LLM_MODEL preserve
- ui_detector: default_factory + resolution lazy (corrige aussi un gel a
  l'import), pas d'appel reseau a l'import
- field_extractor: property lazy via vlm_config

TDD strict (RED->GREEN), 305 tests verts, tests mockes HTTP (zero dependance
DGX reel), aucun alias Ollama.

Hors perimetre (arbitrage Dom): client Lea agent_v1/executor.py (gele),
chemin V4 observe_reason_act (RPA_REASONING_MODEL), core/config.py defaults.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-06-03 14:06:03 +02:00
parent 4e7c2a7628
commit 4dc7d840d6
21 changed files with 739 additions and 37 deletions

View File

@@ -151,6 +151,46 @@ class TestIRBuilder:
{"event": {"type": "key_combo", "keys": ["ctrl", "s"], "window": {"title": "*Sans titre Bloc-notes"}, "timestamp": 115.0}},
]
def test_analyze_intent_modele_via_vlm_config(self):
"""Le payload _analyze_intent utilise le modèle résolu par vlm_config."""
captured = {}
def capture_post(url, json=None, **kwargs):
captured["url"] = url
captured["model"] = (json or {}).get("model")
resp = MagicMock()
resp.ok = True
resp.json.return_value = {"message": {"content": "INTENTION: x\nAVANT: y\nAPRÈS: z"}}
return resp
with patch(
"core.workflow.ir_builder.vlm_config.get_vlm_model",
return_value="modele-resolu:test",
), patch("requests.post", side_effect=capture_post):
builder = IRBuilder()
builder._analyze_intent("clic Rechercher", 0, 1, "Test", "generic")
assert captured["model"] == "modele-resolu:test"
def test_analyze_intent_endpoint_par_defaut_11434(self, monkeypatch):
"""Sans GEMMA4_PORT, _analyze_intent vise 11434, pas le port mort 11435."""
monkeypatch.delenv("GEMMA4_PORT", raising=False)
captured = {}
def capture_post(url, json=None, **kwargs):
captured["url"] = url
resp = MagicMock()
resp.ok = True
resp.json.return_value = {"message": {"content": "INTENTION: x\nAVANT: y\nAPRÈS: z"}}
return resp
with patch("requests.post", side_effect=capture_post):
builder = IRBuilder()
builder._analyze_intent("clic Rechercher", 0, 1, "Test", "generic")
assert ":11434" in captured["url"]
assert ":11435" not in captured["url"]
def test_builder_sans_gemma4(self):
"""Le builder fonctionne même sans gemma4 (fallback gracieux)."""
builder = IRBuilder(gemma4_port="99999") # Port invalide