feat: Personas-Seite mit Übersicht, Editor, Wiederherstellen, Dirty-State und Testen-Verweis, Version 0.1.33 (#1199)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -21,6 +21,7 @@ eingebauten WebSocket von Node (kein Paket, keine Installation). Sie laufen gege
|
||||
| `zugaenge-bedienung.mjs` | Zugänge (#1217): Key anlegen (einmal sichtbar), sperren, entfernen; Benutzer anlegen, ändern, entfernen (Testinstanz mit leerer Datenbank, Standard-Port 18131) | `admin2zugaenge.1` (Stand 27.11.2026 lokal ✓) |
|
||||
| `chat-langer-verlauf.mjs` | Chat mit langem Verlauf: Seite scrollt nie, nur der Verlauf, Eingabe sichtbar; Breiten 1280 bis 320, kurze Fenster, hell und dunkel (Testinstanz mit einem Chat-Modell, Standard-Port 18131) | `browser2stil.4` (Stand 27.11.2026 lokal ✗, → #1242) |
|
||||
| `systemprompt-ebenen.mjs` | Systemprompt-Ebenen (#1248): globaler Prompt (Admin), Standard-Persona (im Chat vorgewählt), Ersetzen statt Stapeln mit einem echten Modell (≥ 3B), Längenhinweis der wirksamen Ebene (Testinstanz mit llama.cpp, Port 18131, `NEXUS_MODELL`) | `browser2systemprompt.1` bis `.3`, `.5` (Stand 27.11.2026 lokal ✓) |
|
||||
| `personas-seite.mjs` | Personas-Seite (#1199, R1): leere und gefüllte Übersicht, Suche, Editor, Dirty-State, Zeichenzähler, Wiederherstellen als neue Version, Breiten 1280/768/390/320 hell und dunkel ohne Überlauf (Testinstanz mit leerer Datenbank, Standard-Port 18141; ohne Modell, deshalb nicht die Chat-Vorwahl) | `browser2personasseite.1` bis `.4` (Stand 29.11.2026 lokal ✓) |
|
||||
| `enginefenster.mjs` | Fenster-Symbole der Engines-Seite (gestrichelt ohne Link, Klick ohne Wirkung) | `admin2enginefenster.3` |
|
||||
| `strom-ohne-ton.mjs` | Playground „Vorlesen“, wenn das Studio einen Strom ohne Ton liefert (Weiterleitung zum Studio nötig) | `client2sprachausgabe.10` |
|
||||
| `chat-layout.mjs` | Chat-Kopf (Persona, Stimme), Seitenleiste (Suche, Anheften, Löschen, Ein/Aus), Konfiguration je Antwort, Kopieren/Wiederholen, Modellwechsel | `browser2chat.5` bis `.7` **Veraltet seit `0.1.18` (Chat-Umbau, #1195): Knöpfe und Texte haben sich geändert (Kopf, Seitenleiste, Player nur bei Wiedergabe), nicht angepasst und nicht gelaufen; braucht die Studio-Weiterleitung. Die Eigenschaften des neuen Chats prüft `crates/nexus-api/tests/chat_browser.mjs` (mit `cargo test -p nexus-api -- --ignored`).** |
|
||||
|
||||
53
scripts/ui-pruefung/personas-seite.mjs
Normal file
53
scripts/ui-pruefung/personas-seite.mjs
Normal file
@ -0,0 +1,53 @@
|
||||
import * as cdp from './lib.mjs';
|
||||
// Personas-Seite (#1199, R1): Übersicht, Suche, Editor, Dirty-State, Wiederherstellen, Breiten 1280/768/390/320 hell und dunkel.
|
||||
// Aufruf: node personas-seite.mjs <Testpasswort> <Ausgabeordner>; Testinstanz mit leerer Datenbank (NEXUS_BASE, Standard http://127.0.0.1:18141), Benutzer claude (admin).
|
||||
const BASE=process.env.NEXUS_BASE||'http://127.0.0.1:18141', pw=process.argv[2], AUS=process.argv[3]||'/tmp';
|
||||
const b=await cdp.start({port:9411});
|
||||
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 ev=x=>b.eval(x);
|
||||
try{
|
||||
await b.login(BASE,'claude',pw);
|
||||
await b.goto(BASE+'/ui/personas'); await warte(500);
|
||||
ok('leere Übersicht', /Noch keine Persona/.test(await ev('document.body.innerText')));
|
||||
const lang='Zeile\n'.repeat(1500);
|
||||
for(const [n,t,v] of [['Luna',lang,'Du bist Luna.'],['Karl','Sachlich.','']]){
|
||||
await ev(`fetch('/ui/personas/speichern',{method:'POST',headers:{'content-type':'application/x-www-form-urlencoded'},body:new URLSearchParams({csrf:document.body.getAttribute('data-csrf'),id:'',name:${JSON.stringify(n)},systemprompt:${JSON.stringify(t||v)},stil:'',stimme:'',standard:${n==='Karl'?"'1'":"''"}})}).then(r=>r.status)`); }
|
||||
const luna=await ev(`fetch('/ui/personas').then(r=>r.text()).then(t=>t.match(/personas\\?id=(\\d+)">Bearbeiten/g).join('|'))`);
|
||||
console.log(luna);
|
||||
for(const theme of ['light','dark']){
|
||||
for(const [w,h] of [[1280,900],[768,900],[390,844],[320,568]]){
|
||||
await b.viewport(w,h,{mobile:w<500});
|
||||
await ev(`document.documentElement.setAttribute('data-theme','${theme}'); try{localStorage.setItem('theme','${theme}')}catch(e){}`);
|
||||
for(const [name,url] of [['uebersicht','/ui/personas'],['editor','/ui/personas?id=1']]){
|
||||
await b.goto(BASE+url); await ev(`document.documentElement.setAttribute('data-theme','${theme}')`); await warte(300);
|
||||
const m=await ev(`({ueberlauf:document.documentElement.scrollWidth>document.documentElement.clientWidth+1, sw:document.documentElement.scrollWidth, cw:document.documentElement.clientWidth})`);
|
||||
ok(`${name} ${w}px ${theme}: kein seitliches Scrollen`, !m.ueberlauf, JSON.stringify(m));
|
||||
if(w===1280||w===390) await b.shot(`${AUS}/personas-${name}-${w}-${theme}.png`,{full:true});
|
||||
}
|
||||
}
|
||||
}
|
||||
await b.viewport(1280,900,{mobile:false});
|
||||
// Suche
|
||||
await b.goto(BASE+'/ui/personas'); await warte(300);
|
||||
const n0=await ev(`document.querySelectorAll('.persona-karte:not([hidden])').length`);
|
||||
await ev(`(()=>{const s=document.getElementById('persona-suche'); s.value='kar'; s.dispatchEvent(new Event('input',{bubbles:true}));})()`);
|
||||
ok('Suche filtert Karten', n0===2 && (await ev(`document.querySelectorAll('.persona-karte:not([hidden])').length`))===1);
|
||||
await ev(`(()=>{const s=document.getElementById('persona-suche'); s.value='xyz'; s.dispatchEvent(new Event('input',{bubbles:true}));})()`);
|
||||
ok('Suche ohne Treffer zeigt Hinweis', await ev(`!document.getElementById('persona-leer').hidden`));
|
||||
// Editor: Dirty-State
|
||||
await b.goto(BASE+'/ui/personas?id=1'); await warte(300);
|
||||
ok('Dirty zunächst verborgen', await ev(`document.querySelector('.persona-dirty').hidden`));
|
||||
await ev(`(()=>{const f=document.querySelector('.persona-form').elements.name; f.value=f.value+'x'; f.dispatchEvent(new Event('input',{bubbles:true}));})()`);
|
||||
ok('Dirty nach Änderung sichtbar', await ev(`!document.querySelector('.persona-dirty').hidden`));
|
||||
await ev(`(()=>{const f=document.querySelector('.persona-form').elements.name; f.value=f.value.slice(0,-1); f.dispatchEvent(new Event('input',{bubbles:true}));})()`);
|
||||
ok('Dirty verschwindet bei Rückgängig', await ev(`document.querySelector('.persona-dirty').hidden`));
|
||||
ok('Zähler zeigt Zeichen', /von 32000 Zeichen/.test(await ev(`document.querySelector('.zeichenzahl').textContent`)));
|
||||
// Speichern, dann Wiederherstellen
|
||||
await ev(`(()=>{const f=document.querySelector('.persona-form'); f.elements.systemprompt.value='Neu'; f.elements.systemprompt.dispatchEvent(new Event('input',{bubbles:true})); f.requestSubmit();})()`); await warte(1200);
|
||||
ok('Version 2 gespeichert', /Version 2/.test(await ev('document.body.innerText')));
|
||||
await ev(`[...document.querySelectorAll('button')].find(x=>x.textContent.trim()==='Als neue Version wiederherstellen').click()`); await warte(1200);
|
||||
const t=await ev('document.body.innerText');
|
||||
ok('Wiederherstellen legt Version 3 an', /Version 3/.test(t) && /Das ist die aktuelle Version/.test(await ev('document.body.textContent')));
|
||||
await b.goto(BASE+'/ui/personas'); ok('Testen-Verweis zeigt auf den Chat', await ev("[...document.querySelectorAll('.persona-karte a')].some(a=>a.textContent==='Testen' && a.getAttribute('href')==='/ui/chat?persona=1')"));
|
||||
const kons=b.events.filter(e=>e.method==='Runtime.exceptionThrown'); ok('keine Skriptfehler', kons.length===0, JSON.stringify(kons.slice(0,2)));
|
||||
}catch(e){console.log('FEHLER',e.message); process.exitCode=1;} finally{b.close();}
|
||||
Reference in New Issue
Block a user