Runde 8: ruhige Freistell-Kante, KI-Zusammenfassung nur mit Einwilligung, Nachschauen im Foyer, Handy-Schwelle 20 B/s
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
const optionen = { type: 'tldr', format: 'plain-text', length: 'short', expectedInputLanguages: ['de'], outputLanguage: 'de' };
|
||||
let stand;
|
||||
try { stand = await mitFrist(S.availability(optionen), 4000, 'unavailable'); } catch { stand = 'unavailable'; }
|
||||
if (stand === 'downloadable' || stand === 'downloading') { kiAngebot(liste, optionen); return ''; }
|
||||
if (stand !== 'available') return ''; /* nie ungefragt ein Modell laden */
|
||||
try {
|
||||
const z = await mitFrist(S.create(optionen), 8000, null);
|
||||
@@ -92,6 +93,26 @@
|
||||
} catch { return ''; }
|
||||
}
|
||||
|
||||
/* EINWILLIGUNG (Runde 8): Kann Chrome das Modell laden, fragt ein Knopf – erst
|
||||
der Druck lädt es (einmalig, bleibt auf dem Gerät). Nie von selbst. */
|
||||
function kiAngebot(liste, optionen) {
|
||||
const ki = $('vp-ki');
|
||||
if (!ki || $('vp-ki-laden')) return;
|
||||
const k = el('button', 'btn btn-klein btn-sekundaer', 'KI-Zusammenfassung einschalten (einmalig laden, bleibt auf deinem Gerät)');
|
||||
k.type = 'button'; k.id = 'vp-ki-laden';
|
||||
k.addEventListener('click', async () => {
|
||||
k.disabled = true; k.textContent = 'Lädt …';
|
||||
try {
|
||||
const z = await self.Summarizer.create({ ...optionen, monitor(m) { m.addEventListener?.('downloadprogress', (e) => { k.textContent = `Lädt … ${Math.round((e.loaded || 0) * 100)} %`; }); } });
|
||||
const text = liste.slice(-60).map((b) => `${b.name}: ${b.text}`).join('\n').slice(0, 6000);
|
||||
const satz = await mitFrist(z.summarize(text, { context: 'Live-Chat einer gemeinsamen Watch-Party. Fasse zusammen, worüber gesprochen wurde.' }), 20000, '');
|
||||
k.remove();
|
||||
if (satz) { ki.textContent = `Kurz gesagt (auf deinem Gerät zusammengefasst): ${String(satz).trim().slice(0, 400)}`; ki.hidden = false; }
|
||||
} catch { k.textContent = 'Das ging gerade nicht.'; }
|
||||
});
|
||||
ki.before(k);
|
||||
}
|
||||
|
||||
async function auf() {
|
||||
let t = $('vp-tafel');
|
||||
if (!t) {
|
||||
|
||||
Reference in New Issue
Block a user