Files
nexus/scripts/ui-pruefung/chat-denkstufe.mjs

19 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Denkstufe im Chat nur bei Modellen mit bestätigtem Test (#1157): ungeprüft ausgeblendet (auch wirklich unsichtbar), „ja“ sichtbar.
// Aufruf: node chat-denkstufe.mjs <Passwort> (Testinstanz mit Modell „chat“ (ungeprüft) und „chat-denk“ (Spalte denkstufe = 'ja' in der Datenbank))
import * as cdp from './lib.mjs';
const BASE=process.env.NEXUS_BASE||'http://127.0.0.1:18123', pw=process.argv[2];
const b=await cdp.start({port:9373});
const ok=(n,c,d='')=>{console.log(`${c?'ok ':'FEHLER'} ${n}${d?' – '+d:''}`); if(!c) process.exitCode=1;};
const warte=ms=>new Promise(r=>setTimeout(r,ms));
const sichtbar=()=>b.eval(`(()=>{const l=document.getElementById('chat-denkstufe').closest('label'); const r=l.getBoundingClientRect(); return {display:getComputedStyle(l).display, breite:Math.round(r.width), hoehe:Math.round(r.height)};})()`);
try{
await b.login(BASE,'claude',pw); await b.goto(BASE+'/ui/chat'); await warte(1000);
const wahl=async m=>{ await b.eval(`(()=>{const s=document.getElementById('chat-modell'); s.value=${JSON.stringify(m)}; s.dispatchEvent(new Event('change',{bubbles:true}));})()`); await warte(300); };
await wahl('chat'); let s=await sichtbar();
ok('ungeprüftes Modell: Denkstufe unsichtbar (display none, keine Fläche)', s.display==='none' && s.breite===0 && s.hoehe===0, JSON.stringify(s));
await wahl('chat-denk'); s=await sichtbar();
ok('Modell mit bestätigtem Test: Denkstufe sichtbar', s.display!=='none' && s.breite>0, JSON.stringify(s));
await wahl('chat'); s=await sichtbar();
ok('zurück zum ungeprüften Modell: wieder unsichtbar, ohne Wert', s.display==='none' && (await b.eval(`document.getElementById('chat-denkstufe').value`))==='', JSON.stringify(s));
}catch(e){console.log('Fehler im Lauf:',e.message); process.exitCode=1;} finally{b.close();}