fix: enforce quoted intent for follow to prevent VLM hallucination

This commit is contained in:
2026-04-27 21:47:40 +02:00
parent a7449a1db3
commit 7b8daa7670
49 changed files with 4850 additions and 294 deletions

View File

@@ -18,8 +18,8 @@ logger = logging.getLogger("TestingToolkit")
def _save_dump(device, fixture_dir, filename, description):
logger.info(f"⏳ Waiting for UI to settle for [{description}]...")
time.sleep(3.5) # ensure animations finish
xml_data = device.dump_hierarchy()
xml_data = device.dump_hierarchy()
if not xml_data or len(xml_data) < 100:
logger.warning(f"⚠️ Received empty or exceptionally small XML dump for {filename}. Is the app open?")
@@ -28,6 +28,23 @@ def _save_dump(device, fixture_dir, filename, description):
f.write(xml_data)
logger.info(f"✅ Saved REAL DUMP to {filename} ({len(xml_data)} bytes)")
# Capture screenshot
try:
import base64
screenshot_b64 = device.get_screenshot_b64()
if screenshot_b64:
screenshot_data = base64.b64decode(screenshot_b64)
screenshot_filename = filename.replace(".xml", ".jpg")
screenshot_path = os.path.join(fixture_dir, screenshot_filename)
with open(screenshot_path, "wb") as f:
f.write(screenshot_data)
logger.info(f"✅ Saved REAL SCREENSHOT to {screenshot_filename}")
else:
logger.warning(f"⚠️ Failed to capture screenshot for {filename}")
except Exception as e:
logger.error(f"Failed to capture screenshot: {e}")
def run_interactive_guide(device, fixture_dir):
print("\n" + "=" * 60)
@@ -79,6 +96,13 @@ def main():
device_id = args.device
# Auto-detect config if not provided
if not args.config:
if os.path.exists("test_config.yml"):
args.config = "test_config.yml"
elif os.path.exists("config.yml"):
args.config = "config.yml"
# Try to extract device from config if provided
if args.config:
try: