perf(perception): bypass heavy VLM verification for memorized high-confidence actions

This commit is contained in:
2026-04-27 11:50:39 +02:00
parent a2a4a75603
commit ae046be3b1
3 changed files with 8 additions and 6 deletions

View File

@@ -381,7 +381,8 @@ class GoalExecutor:
else:
# For interactions (like, follow) or unknown goals, use XML delta + semantic verify
if ui_changed:
verification = engine.verify_success(action, post_xml, device=self.device)
score = best_node.get("score", 0.0) if best_node else 0.0
verification = engine.verify_success(action, post_xml, device=self.device, confidence=score)
if verification is True:
action_success = True
logger.info(f"✅ [GOAP Step] Interaction '{action}' successful.")

View File

@@ -77,7 +77,7 @@ class ActionMemory:
self._last_click_context = None
def verify_success(self, intent: str, pre_click_xml: str, post_click_xml: str, device=None) -> Optional[bool]:
def verify_success(self, intent: str, pre_click_xml: str, post_click_xml: str, device=None, confidence: float = 0.0) -> Optional[bool]:
"""
Structural and Visual verification: Did the UI actually change after the click?
"""
@@ -91,8 +91,9 @@ class ActionMemory:
# State toggles (like, save, follow) rarely change XML length predictably
state_toggles = ["like", "save", "follow", "heart"]
if any(t in intent.lower() for t in state_toggles):
if device:
logger.info(f"👁️ [ActionMemory] Handing over verification for '{intent}' to VLM visual analysis...")
# If we are highly confident (e.g. pulled from Qdrant memory), bypass heavy VLM
if device and confidence < 0.95:
logger.info(f"👁️ [ActionMemory] Confidence ({confidence:.2f}) < 0.95. Handing over verification for '{intent}' to VLM visual analysis...")
from GramAddict.core.perception.semantic_evaluator import SemanticEvaluator
evaluator = SemanticEvaluator()

View File

@@ -180,11 +180,11 @@ class TelepathicEngine:
def decay_click(self, intent: str = None):
self._memory.reject_click(intent) # Alias to reject
def verify_success(self, intent: str, post_click_xml: str, device=None) -> bool:
def verify_success(self, intent: str, post_click_xml: str, device=None, confidence: float = 0.0) -> bool:
pre_click_xml = ""
if self._memory._last_click_context:
pre_click_xml = self._memory._last_click_context.get("xml_context", "")
return self._memory.verify_success(intent, pre_click_xml, post_click_xml, device=device)
return self._memory.verify_success(intent, pre_click_xml, post_click_xml, device=device, confidence=confidence)
# ──────────────────────────────────────────────
# Semantic Evaluator Delegation