Helikon

Von $1

    Inhaltsverzeichnis
    1. 1. Helikon Chat Export

    Version seit 18:29, 11 Aug 2026

    zu dieser Version.

    Zurück zu Versionshistorie.

    Zeige aktuelle Version

     
     
     
    <meta charset="utf-8"/>

    '; html += '

    <title/>

    '; html += '

    Helikon Chat Export

    '; var i; for (i = 0; i < msgs.length; i++) { var el = msgs[i]; if (el.className.indexOf('system') > -1) continue; if (el.className.indexOf('typing') > -1) continue; var cls = el.className.indexOf('user') > -1 ? 'msg-user' : 'msg-buddy'; html += '

    ' + el.textContent + '

    '; } html += '

    '; var printWin = window.open('', '_blank'); printWin.document.write(html); printWin.document.close(); printWin.onload = function() { printWin.print(); }; showBubble('PDF wird erstellt...', 3000); } if (exportBtn) { exportBtn.addEventListener('click', exportPdf); } /* === UI === */ function setGif(name) { if (avatar) avatar.src = GIFS[name] || GIFS.idle; } function showBubble(txt, duration) { if (!bubble) return; if (bubbleTimer) clearTimeout(bubbleTimer); bubble.textContent = txt; bubble.className = 'visible'; bubbleTimer = setTimeout(function() { bubble.className = ''; }, duration || 5000); } function addMsg(text, cls) { var div = document.createElement('div'); div.className = 'chatMsg ' + cls; div.textContent = text; log.appendChild(div); log.scrollTop = log.scrollHeight; return div; } function setStatus(txt) { if (status) status.textContent = txt || ''; } function handleReply(reply) { history.push({ role: 'assistant', content: reply }); if (reply.length <= SHORT_LEN) { showBubble(reply, 6000); } else { addMsg(reply, 'buddy'); var dot = reply.indexOf('. '); var summary; if (dot > 0 && dot < 80) { summary = reply.substring(0, dot + 1); } else if (reply.length > 60) { summary = reply.substring(0, 57) + '...'; } else { summary = reply; } showBubble(summary, 6000); } setGif('happy'); setTimeout(function() { setGif('idle'); }, 3000); setStatus(''); } function send() { var msg = input.value.replace(/^\s+|\s+$/g, ''); if (!msg || busy) return; if (!apiUrl) { addMsg('API nicht konfiguriert. Seiteneigenschaft buddy.apiurl pruefen.', 'system'); showBubble('Keine API!', 3000); setGif('error'); setTimeout(function() { setGif('idle'); }, 4000); return; } addMsg(msg, 'user'); input.value = ''; history.push({ role: 'user', content: msg }); busy = true; btn.disabled = true; setGif('loading'); setStatus('denkt nach...'); showBubble('...', 30000); var typing = addMsg('...', 'buddy typing'); var messages = [{ role: 'system', content: sysMsg }]; var i; for (i = 0; i < history.length; i++) { messages.push(history[i]); } var headers = { 'Content-Type': 'application/json' }; if (apiKey) headers['Authorization'] = 'Bearer ' + apiKey; var body = JSON.stringify({ model: MODEL, messages: messages, max_tokens: 500 }); var xhr = new XMLHttpRequest(); xhr.open('POST', apiUrl, true); var key; for (key in headers) { if (headers.hasOwnProperty(key)) { xhr.setRequestHeader(key, headers[key]); } } xhr.onload = function() { log.removeChild(typing); if (xhr.status === 200) { try { var data = JSON.parse(xhr.responseText); var reply = data.choices[0].message.content; handleReply(reply); } catch (e) { addMsg('Fehler beim Parsen der Antwort.', 'system'); showBubble('Oops!', 3000); setGif('error'); setTimeout(function() { setGif('idle'); }, 4000); setStatus('Parse-Fehler'); } } else { addMsg('Fehler: ' + xhr.status + ' ' + xhr.statusText, 'system'); showBubble('Fehler!', 3000); setGif('error'); setTimeout(function() { setGif('idle'); }, 4000); setStatus('API-Fehler ' + xhr.status); } busy = false; btn.disabled = false; input.focus(); }; xhr.onerror = function() { log.removeChild(typing); addMsg('Verbindungsfehler. API nicht erreichbar.', 'system'); showBubble('Nicht erreichbar!', 3000); setGif('error'); setTimeout(function() { setGif('idle'); }, 4000); setStatus('Nicht erreichbar'); busy = false; btn.disabled = false; }; xhr.send(body); } btn.addEventListener('click', send); input.addEventListener('keydown', function(e) { if (e.keyCode === 13) send(); }); /* === INIT === */ setGif('loading'); setStatus('lade konfiguration...'); input.disabled = true; btn.disabled = true; fetchAllProperties(function(props) { apiUrl = props['buddy.apiurl'] || ''; apiKey = props['buddy.apikey'] || ''; setStatus('API-URL: ' + (apiUrl ? 'OK' : 'FEHLT') + ' | API-Key: ' + (apiKey ? 'OK' : 'FEHLT')); fetchText(PROMPT_URL, function(val) { sysMsg = val || 'Du bist Server Buddy, ein freundlicher IT-Assistent.'; setGif('idle'); input.disabled = false; btn.disabled = false; if (apiUrl) { showBubble('Hallo! Wie kann ich helfen?', 5000); setStatus('bereit'); } else { showBubble('API nicht konfiguriert!', 5000); setGif('error'); setStatus('buddy.apiurl fehlt in Seiteneigenschaften'); } }); }); })();

     

    Nach oben Nach unten

     

     

    Nach unten

     

    Lade Daten...
     
     
     
     
     
     

     
    Use the language selection below for English Utilise le sélecteur de langue ci-dessous pour français Per l'italiano, utilizzare la selezione della lingua qui sotto Schön sprichst du deutsch :-)