Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg6sxZ8wsKZAVLQ6Xj5
25 lines
2.3 KiB
JavaScript
25 lines
2.3 KiB
JavaScript
// client2sprachausgabe.10 (Playground-Teil): Studio liefert einen Strom ohne Ton -> Fehlerblase statt Stille.
|
||
// Aufruf: node strom-ohne-ton.mjs <Passwort> (Testinstanz mit Modell chat und tts-base; die Studio-Weiterleitung liefert Kopfzeilen 200 ohne Ton)
|
||
import * as cdp from './lib.mjs';
|
||
const BASE=process.env.NEXUS_BASE||'http://127.0.0.1:18122', pw=process.argv[2];
|
||
const b=await cdp.start({port:9365});
|
||
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));
|
||
try{
|
||
await b.login(BASE,'claude',pw);
|
||
await b.goto(BASE+'/ui/modelle?art=sprache'); await warte(800);
|
||
if(/Nicht freigegeben/.test(await b.eval('document.body.innerText'))){ await b.eval(`[...document.querySelectorAll('button')].find(x=>x.textContent.trim()==='Freigeben').click()`); await warte(2000); }
|
||
await b.goto(BASE+'/ui/chat'); await warte(800);
|
||
await b.eval(`(()=>{const s=document.getElementById('chat-sprache'); s.value='tts-base'; s.dispatchEvent(new Event('change',{bubbles:true}));})()`); await warte(1500);
|
||
await b.eval(`(()=>{const s=document.getElementById('chat-stimme'); const o=[...s.options].find(o=>/Scotty/.test(o.textContent)); s.value=o.value; s.dispatchEvent(new Event('change',{bubbles:true}));})()`);
|
||
await b.eval(`document.getElementById('chat-text').value='Sag Hallo.'`);
|
||
await b.eval(`document.getElementById('chat-senden').click()`);
|
||
for(let i=0;i<300;i++){ await warte(500); if(await b.eval(`!![...document.querySelectorAll('button')].find(x=>x.textContent.trim()==='Vorlesen')`)) break; }
|
||
console.log(' Blasen:', await b.eval(`[...document.querySelectorAll('.blase')].map(x=>x.className+': '+x.innerText.slice(0,60).split(String.fromCharCode(10)).join(' ')).join(' // ')`));
|
||
await b.eval(`[...document.querySelectorAll('button')].find(x=>x.textContent.trim()==='Vorlesen').click()`);
|
||
let fehler='';
|
||
for(let i=0;i<60;i++){ await warte(500); fehler=await b.eval(`[...document.querySelectorAll('.fehlerblase')].map(x=>x.innerText).join(' || ')`); if(fehler) break; }
|
||
ok('Playground zeigt eine Fehlermeldung statt Stille', /Sprachausgabe:/.test(fehler)&&/keinen Ton/.test(fehler), fehler.slice(0,220));
|
||
await b.shot('/tmp/ohneton.png');
|
||
}catch(e){console.log('Fehler im Lauf:',e.message); process.exitCode=1;} finally{b.close();}
|