Files
html/test-wevia-e2e-live.html
2026-04-19 22:10:02 +02:00

218 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="fr"><head>
<meta charset="UTF-8">
<title>WEVIA E2E User Test · 15 capabilities</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,Segoe UI,sans-serif;background:#09090b;color:#fafafa;padding:20px;min-height:100vh}
.hdr{background:#18181b;padding:18px 22px;border-radius:12px;margin-bottom:16px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:12px}
.hdr h1{font-size:1.2rem;color:#3b82f6}
.hdr .stats{font-size:.85rem;color:#a1a1aa}
.hdr .stats b{color:#22c55e;margin-left:4px}
.chat{background:#18181b;border-radius:12px;padding:0;overflow:hidden;max-height:76vh;overflow-y:auto}
.msg{padding:14px 20px;border-bottom:1px solid rgba(255,255,255,.05)}
.msg.q{background:rgba(59,130,246,.05)}
.msg.q .who{color:#3b82f6}
.msg.a .who{color:#22c55e}
.msg .who{font-size:.72rem;text-transform:uppercase;letter-spacing:1.5px;font-weight:700;margin-bottom:6px}
.msg .who .status{margin-left:10px;padding:2px 8px;border-radius:999px;font-size:.6rem;font-weight:600}
.msg .status.pass{background:rgba(34,197,94,.15);color:#22c55e}
.msg .status.wait{background:rgba(250,204,21,.15);color:#facc15}
.msg .status.fail{background:rgba(239,68,68,.15);color:#ef4444}
.msg .content{font-size:.88rem;line-height:1.5;color:#e5e5e5;white-space:pre-wrap;word-break:break-word}
.msg .meta{font-size:.72rem;color:#71717a;margin-top:6px;font-family:monospace}
#progress{height:4px;background:#27272a;border-radius:99px;overflow:hidden;margin-top:10px}
#progress .bar{height:100%;background:linear-gradient(90deg,#3b82f6,#22c55e);width:0%;transition:width .3s}
</style>
</head>
<body>
<div class="hdr">
<div>
<h1>🎬 WEVIA E2E User Test · Session live</h1>
<div class="stats">15 capabilities test · <span id="ts-start"></span></div>
</div>
<div class="stats" id="summary">
Progress: <b id="done">0</b>/<b>15</b> · Pass: <b id="pass">0</b> · Unclear: <b id="unclear">0</b> · Fail: <b id="fail">0</b>
<div id="progress"><div class="bar" id="bar"></div></div>
</div>
</div>
<div class="chat" id="chat"></div>
<script>
const QUESTIONS = [
{ id: 'data_pharma_real', q: 'ethica combien de HCP par pays', expect: 'DZ', cat: '📊 Data pharma real' },
{ id: 'deerflow_tool', q: 'deerflow skills', expect: 'DeerFlow', cat: '🔧 Open-source tools' },
{ id: 'agents_count', q: 'combien agents', expect: 'Agents', cat: '🤖 Agents audit' },
{ id: 'skills_count', q: 'skills counts', expect: 'skill', cat: '🧠 Skills registry' },
{ id: 'tools_registry', q: 'tool search', expect: 'tool', cat: '🛠 Tools catalog' },
{ id: 'tips_6months', q: 'tips catalog', expect: 'tips', cat: '📚 Tips 6 months' },
{ id: 'release_mgmt', q: 'commits reconcile', expect: 'commit', cat: '🚂 Release management' },
{ id: 'infra_blade', q: 'blade live status', expect: 'blade', cat: '🖥 Infra Blade' },
{ id: 'cyber_compliance', q: 'outbound risk', expect: 'INBOUND', cat: '🛡 Cyber compliance' },
{ id: 'gpus_free', q: 'gpus free', expect: 'GPU', cat: '⚡ GPUs free' },
{ id: 'machines_infra', q: 'machines status', expect: 'machine', cat: '🖥 Machines' },
{ id: 'video_coverage', q: 'living proof', expect: 'video', cat: '🎬 Video testing' },
{ id: 'wepredict_intel', q: 'wepredict concurrents', expect: 'concurrent', cat: '🔮 Business intel' },
{ id: 'opportunities', q: 'wepredict opportunities', expect: 'opport', cat: '💰 Opportunities' },
{ id: 'dsh_predict', q: 'dsh predict', expect: 'predict', cat: '📈 DSH Predict' }
];
document.getElementById('ts-start').textContent = new Date().toLocaleTimeString('fr-FR');
const chat = document.getElementById('chat');
const results = { ts: new Date().toISOString(), interactions: [] };
let pk=0, uc=0, fl=0;
function addMsg(who, html, cls='') {
const d = document.createElement('div');
d.className = 'msg ' + (who === 'q' ? 'q' : 'a');
d.innerHTML = `<div class="who">${who==='q'?'👤 User':'🤖 WEVIA'}${cls?' <span class="status '+cls.toLowerCase()+'">'+cls+'</span>':''}</div><div class="content">${html}</div>`;
chat.appendChild(d);
chat.scrollTop = chat.scrollHeight;
return d;
}
async function fetchSSE(msg) {
const url = '/api/wevia-sse-orchestrator.php?msg=' + encodeURIComponent(msg);
try {
const r = await fetch(url);
const txt = await r.text();
// Parse SSE events
const lines = txt.split('\n').filter(l => l.startsWith('data: '));
let merged = '';
let intent = null;
let engine = null;
for (const line of lines) {
try {
const d = JSON.parse(line.slice(6));
if (d.intent) intent = d.intent;
if (d.engine) engine = d.engine;
if (d.text) merged += d.text + '\n';
if (d.result) merged += d.result + '\n';
} catch(e){}
}
return { ok: true, text: merged || txt.slice(0, 500), intent, engine };
} catch(e) {
return { ok: false, error: e.message };
}
}
async function runAll() {
for (let i=0; i<QUESTIONS.length; i++) {
const q = QUESTIONS[i];
addMsg('q', `<b>${q.cat}</b><br>${q.q}`);
// Wait a bit for visual
await new Promise(r=>setTimeout(r, 600));
// Typing placeholder
const loadingMsg = addMsg('a', '<span style="opacity:.5">⏳ WEVIA traite...</span>', 'WAIT');
const t0 = Date.now();
const res = await fetchSSE(q.q);
const elapsed = Date.now() - t0;
const passed = res.ok && (res.text || '').toLowerCase().includes(q.expect.toLowerCase());
const status = passed ? 'PASS' : (res.ok ? 'UNCLEAR' : 'FAIL');
// Update the placeholder
loadingMsg.querySelector('.who').innerHTML = `🤖 WEVIA <span class="status ${status.toLowerCase()}">${status}</span>`;
const preview = (res.text || res.error || '').slice(0, 500);
loadingMsg.querySelector('.content').innerHTML = `${preview}<div class="meta">intent=${res.intent||'?'} · engine=${res.engine||'?'} · ${elapsed}ms</div>`;
results.interactions.push({
idx: i+1,
id: q.id, category: q.cat, question: q.q,
expect_keyword: q.expect,
response_preview: preview.slice(0, 300),
intent: res.intent, engine: res.engine,
elapsed_ms: elapsed, status
});
if (status==='PASS') pk++;
else if (status==='UNCLEAR') uc++;
else fl++;
document.getElementById('done').textContent = i+1;
document.getElementById('pass').textContent = pk;
document.getElementById('unclear').textContent = uc;
document.getElementById('fail').textContent = fl;
document.getElementById('bar').style.width = ((i+1)/QUESTIONS.length*100) + '%';
// Wait between questions
await new Promise(r=>setTimeout(r, 800));
}
// Final summary
const summary = {
total: QUESTIONS.length, pass: pk, unclear: uc, fail: fl,
pass_rate: Math.round(pk*100/QUESTIONS.length)
};
results.summary = summary;
addMsg('a', `<b>🏆 TEST COMPLETE</b><br>Pass: ${pk}/${QUESTIONS.length} (${summary.pass_rate}%) · Unclear: ${uc} · Fail: ${fl}<br><pre style="font-size:.75rem;color:#71717a;overflow:auto;margin-top:8px">${JSON.stringify(summary, null, 2)}</pre>`, summary.fail===0?'PASS':'FAIL');
// Expose results globally
window.__WEVIA_E2E_RESULTS__ = results;
// Save to document title for Playwright pickup
document.title = `WEVIA E2E · ${pk}/${QUESTIONS.length} PASS · ${uc} unclear · ${fl} fail`;
}
runAll();
</script>
<!-- === OPUS UNIVERSAL DRILL-DOWN v1 19avr — append-only, doctrine #14 === -->
<script>
(function(){
if (window.__opusUniversalDrill) return; window.__opusUniversalDrill = true;
var d = document;
var m = d.createElement('div');
m.id = 'opus-udrill';
m.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.82);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:99995;padding:20px;cursor:pointer';
var inner = d.createElement('div');
inner.id = 'opus-udrill-in';
inner.style.cssText = 'max-width:900px;width:100%;max-height:90vh;overflow:auto;background:#0b0d15;border:1px solid rgba(99,102,241,0.35);border-radius:14px;padding:28px;cursor:default;box-shadow:0 20px 60px rgba(0,0,0,0.6);color:#e2e8f0;font:14px/1.55 Inter,system-ui,sans-serif';
inner.addEventListener('click', function(e){ e.stopPropagation(); });
m.appendChild(inner);
m.addEventListener('click', function(){ m.style.display='none'; });
d.addEventListener('keydown', function(e){ if(e.key==='Escape') m.style.display='none'; });
(d.body || d.documentElement).appendChild(m);
function openCard(card) {
var html = '<div style="display:flex;justify-content:flex-end;margin-bottom:14px"><button id="opus-udrill-close" style="padding:6px 14px;background:#171b2a;border:1px solid rgba(99,102,241,0.25);color:#e2e8f0;border-radius:8px;cursor:pointer;font-size:12px">✕ Fermer (Esc)</button></div>';
html += '<div style="transform-origin:top left;font-size:1.05em">' + card.outerHTML + '</div>';
inner.innerHTML = html;
d.getElementById('opus-udrill-close').onclick = function(){ m.style.display='none'; };
m.style.display = 'flex';
}
function wire(root) {
var sels = '.card,[class*="card"],.kpi,[class*="kpi"],.stat,[class*="stat"],.tile,[class*="tile"],.metric,[class*="metric"],.widget,[class*="widget"]';
var cards = root.querySelectorAll(sels);
for (var i = 0; i < cards.length; i++) {
var c = cards[i];
if (c.__opusWired) continue;
if (c.closest('button, a, input, select, textarea, #opus-udrill')) continue;
var r = c.getBoundingClientRect();
if (r.width < 60 || r.height < 40) continue;
c.__opusWired = true;
c.style.cursor = 'pointer';
c.setAttribute('role','button');
c.setAttribute('tabindex','0');
c.addEventListener('click', function(ev){
if (ev.target.closest('[data-pp-id]') && window.__opusDrillInit) return;
if (ev.target.closest('a,button,input,select')) return;
ev.preventDefault(); ev.stopPropagation();
openCard(this);
});
c.addEventListener('keydown', function(ev){ if(ev.key==='Enter'||ev.key===' '){ev.preventDefault();openCard(this);} });
}
}
var initRun = function(){ wire(d.body || d.documentElement); };
if (d.readyState === 'loading') d.addEventListener('DOMContentLoaded', initRun);
else initRun();
var mo = new MutationObserver(function(muts){
var newCard = false;
for (var i=0;i<muts.length;i++) if (muts[i].addedNodes.length) { newCard = true; break; }
if (newCard) initRun();
});
mo.observe(d.body || d.documentElement, {childList:true, subtree:true});
})();
</script>
<!-- === OPUS UNIVERSAL DRILL-DOWN END === -->
</body></html>