feat: Chats umbenennen (#1187); fix: ausgeblendete Elemente wirklich unsichtbar, Denkstufe nur bei bestätigtem Test (#1188); Version 0.1.17-rc4

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg6sxZ8wsKZAVLQ6Xj5
This commit is contained in:
2026-11-21 22:10:03 +01:00
parent 6db1eb6101
commit cf0b3fb0c3
9 changed files with 128 additions and 12 deletions

View File

@ -0,0 +1,18 @@
// 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();}

View File

@ -0,0 +1,41 @@
// Chat in der Seitenleiste umbenennen: Name bleibt nach weiterer Frage und Neuladen, Escape und leerer Name ändern nichts.
// Aufruf: node chat-umbenennen.mjs <Passwort> (Testinstanz mit Modell chat und fake_llama_lang.py, NEXUS_BASE)
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:9371});
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 titel=()=>b.eval(`[...document.querySelectorAll('#chat-liste li .titel, #chat-liste li .titel-eingabe')].map(x=>x.tagName==='INPUT'?x.value:x.textContent).join('|')`);
const frage=async t=>{ await b.eval(`document.getElementById('chat-text').value=${JSON.stringify(t)}`); await b.eval(`document.getElementById('chat-senden').click()`);
for(let i=0;i<400;i++){ await warte(500); if(await b.eval(`!document.getElementById('chat-senden').disabled && document.querySelectorAll('.blase.assistant').length>0`)) break; } await warte(1500); };
const tippe=async t=>{ await b.eval(`(()=>{const f=document.querySelector('.titel-eingabe'); f.value=${JSON.stringify(t)};})()`); };
const taste=async k=>{ await b.send('Input.dispatchKeyEvent',{type:'keyDown',key:k,code:k,windowsVirtualKeyCode:k==='Enter'?13:27}); await b.send('Input.dispatchKeyEvent',{type:'keyUp',key:k,code:k,windowsVirtualKeyCode:k==='Enter'?13:27}); await warte(600); };
try{
await b.login(BASE,'claude',pw);
await b.goto(BASE+'/ui/chat'); await warte(1000);
await frage('Erste Frage zum Scheduler');
ok('Titel kommt zunächst aus der ersten Frage', /Erste Frage/.test(await titel()), await titel());
const knopf=()=>b.eval(`(()=>{const k=[...document.querySelectorAll('#chat-liste li button')].find(x=>x.textContent==='Umbenennen'); if(!k) return false; k.click(); return true;})()`);
ok('Knopf „Umbenennen“ vorhanden', await knopf());
await tippe('Nexus Architektur'); await taste('Enter');
ok('Neuer Name steht in der Liste', (await titel())==='Nexus Architektur', await titel());
// Escape ändert nichts
await knopf(); await tippe('Wird verworfen'); await taste('Escape');
ok('Escape verwirft', (await titel())==='Nexus Architektur', await titel());
// leerer Name ändert nichts
await knopf(); await tippe(' '); await taste('Enter');
ok('Leerer Name ändert nichts', (await titel())==='Nexus Architektur', await titel());
// weitere Frage: Name bleibt
await frage('Zweite Frage dazu');
ok('Name bleibt nach der nächsten Frage', (await titel())==='Nexus Architektur', await titel());
// Neuladen: vom Server
await warte(1500); await b.goto(BASE+'/ui/chat'); await warte(1500);
ok('Name bleibt nach Neuladen (Server)', /Nexus Architektur/.test(await titel()), await titel());
const json=await b.eval(`fetch('/ui/chat/verlauf').then(r=>r.json()).then(l=>l.map(c=>({titel:c.titel,manuell:!!c.titelManuell,n:c.nachrichten.length})))`);
console.log(' Server:', JSON.stringify(json));
ok('Server hat Namen und Marke', json.length===1 && json[0].titel==='Nexus Architektur' && json[0].manuell && json[0].n>=4);
// Suche findet den neuen Namen
await b.eval(`(()=>{const s=document.getElementById('chat-suche'); s.value='architektur'; s.dispatchEvent(new Event('input',{bubbles:true}));})()`); await warte(500);
ok('Suche findet den neuen Namen', /Nexus Architektur/.test(await titel()));
await b.shot('/tmp/umbenennen.png');
}catch(e){console.log('Fehler im Lauf:',e.message); process.exitCode=1;} finally{b.close();}