78 lines
3.0 KiB
Python
78 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""V108 - E2E proof: hub shows HUMAN text not JSON"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v108-human-proof"
|
|
os.makedirs(OUT, exist_ok=True)
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
browser = await p.chromium.launch(headless=True, args=['--no-sandbox'])
|
|
context = await browser.new_context(
|
|
viewport={'width': 1920, 'height': 1080},
|
|
record_video_dir=OUT
|
|
)
|
|
page = await context.new_page()
|
|
|
|
# Load Hub with cache bust
|
|
await page.goto(f"https://weval-consulting.com/all-ia-hub.html?v=v108", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
await page.screenshot(path=f"{OUT}/01-hub-loaded-v108.png", full_page=True)
|
|
|
|
# Check new caps
|
|
caps = await page.evaluate("""() => {
|
|
const all = Array.from(document.querySelectorAll('#caps-grid .cap h3'));
|
|
return {
|
|
total_cards: all.length,
|
|
cards: all.map(h => h.textContent.trim())
|
|
};
|
|
}""")
|
|
print("Capabilities:", json.dumps(caps, indent=2))
|
|
|
|
# Test chat HI (should show HUMAN text not JSON)
|
|
await page.fill('#inp-chat', 'hi bonjour wevia')
|
|
await page.wait_for_timeout(500)
|
|
await page.click('#btn-chat')
|
|
await page.wait_for_timeout(6000) # Wait for response
|
|
|
|
# Get chat output
|
|
chat_out = await page.evaluate("""() => {
|
|
const msgs = Array.from(document.querySelectorAll('#out-chat .msg'));
|
|
return msgs.map(m => ({
|
|
cls: m.className,
|
|
text: m.textContent.trim().substring(0, 400)
|
|
}));
|
|
}""")
|
|
print("\nChat output messages:")
|
|
for m in chat_out:
|
|
print(f" [{m['cls']}] {m['text']}")
|
|
|
|
await page.screenshot(path=f"{OUT}/02-chat-hi-response.png", full_page=True)
|
|
|
|
# Click capabilities tab
|
|
await page.click('[data-view="capabilities"]')
|
|
await page.wait_for_timeout(1500)
|
|
await page.screenshot(path=f"{OUT}/03-capabilities-enriched.png", full_page=True)
|
|
|
|
await context.close()
|
|
await browser.close()
|
|
|
|
# Detect if JSON still showing
|
|
chat_text = ' '.join([m['text'] for m in chat_out])
|
|
has_json_raw = '"provider":"opus-bonjour"' in chat_text or '"tool":"bonjour-llm"' in chat_text or 'JSON.stringify' in chat_text
|
|
|
|
report = {
|
|
'v108': 'human-text-extraction',
|
|
'capabilities': caps,
|
|
'chat_output_count': len(chat_out),
|
|
'chat_has_json_raw': has_json_raw,
|
|
'chat_last_msg': chat_out[-1] if chat_out else None
|
|
}
|
|
with open(f"{OUT}/proof.json", 'w') as f:
|
|
json.dump(report, f, indent=2)
|
|
print("\n=== REPORT ===")
|
|
print(json.dumps(report, indent=2))
|
|
|
|
asyncio.run(main())
|