#!/usr/bin/env python3 """V113 - Add Quick Test Intent panel in Hub Capabilities tab""" path = "/var/www/html/all-ia-hub.html" with open(path, "r", encoding="utf-8") as f: c = f.read() if "V113-QUICK-INTENTS" in c: print("ALREADY") exit(0) # Find the Blade section end (before DeepSeek Web Access card) anchor = '
\n

🌐 DeepSeek Web Access

' add_panel = '''

⚡ Quick Test Any Intent — 2004 intents live

Tape un trigger ci-dessous ou choisis un preset. Repond: -

🌐 DeepSeek Web Access

''' if anchor not in c: print("ANCHOR NOT FOUND") exit(1) c = c.replace(anchor, add_panel, 1) # Add JS functions before refreshBladeStats js_anchor = "// V111-BLADE-ENRICH: live blade tasks" js_add = '''// V113-QUICK-INTENTS: test any intent function setIntent(s){ document.getElementById('intent-input').value=s; } async function testIntent(){ const inp=document.getElementById('intent-input'); const out=document.getElementById('intent-output'); const lat=document.getElementById('intent-latency'); const msg=inp.value.trim(); if(!msg){out.style.display='block';out.textContent='Tape un trigger d abord';return;} out.style.display='block'; out.textContent='Loading...'; lat.textContent='...'; const t0=Date.now(); try{ const r=await fetch('/api/wevia-master-api.php',{ method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({message:msg,session_id:'hub-v113-test-'+Date.now()}), signal:AbortSignal.timeout(60000) }); const d=await r.json(); const t=((Date.now()-t0)/1000).toFixed(1); lat.textContent=t+'s '+(d.provider||d.tool||'?'); const txt=d.content||d.response||d.text||d.output||JSON.stringify(d,null,2); out.textContent=txt.substring(0,2500); }catch(e){ out.textContent='Error: '+e.message; lat.textContent='err'; } } // V111-BLADE-ENRICH: live blade tasks''' if js_anchor in c: c = c.replace(js_anchor, js_add, 1) with open(path, "w", encoding="utf-8") as f: f.write(c) print(f"PATCHED size={len(c)}")