Archiv-System: Clear archiviert, Button lädt ältere Archive chronologisch, kein Limit
This commit is contained in:
1 parent
fb2c3a0720
commit
843c210209
9 files changed
+363
-129
No files matched your search
+30
-3
@@ -21,9 +21,10 @@ function truncate(s, max) {
|
||||
|
||||
// ── Message Bubbles ──
|
||||
|
||||
function addUserBubble(text) {
|
||||
function addUserBubble(text, streamed = false) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'msg user';
|
||||
if (streamed) div.classList.add('streamed');
|
||||
div.textContent = text;
|
||||
chatEl().appendChild(div);
|
||||
scrollDown();
|
||||
@@ -54,7 +55,7 @@ let _streamText = '';
|
||||
|
||||
function startStreamBubble() {
|
||||
_streamDiv = document.createElement('div');
|
||||
_streamDiv.className = 'msg assistant';
|
||||
_streamDiv.className = 'msg assistant streamed';
|
||||
_streamDiv.innerHTML = '<span class="cursor"></span>';
|
||||
_streamText = '';
|
||||
chatEl().appendChild(_streamDiv);
|
||||
@@ -85,7 +86,7 @@ function endStreamBubble() {
|
||||
|
||||
function addToolBoxLoading(name) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'tool-box';
|
||||
div.className = 'tool-box streamed';
|
||||
div.innerHTML = '<span class="tool-name">' + esc(name) + '</span> <span class="tool-spinner">⏳</span>';
|
||||
chatEl().appendChild(div);
|
||||
scrollDown();
|
||||
@@ -114,6 +115,12 @@ function addToolBoxStatic(name, input, result, isError) {
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
// ── Streamed Elements ──
|
||||
|
||||
function removeStreamedElements() {
|
||||
chatEl().querySelectorAll('.streamed').forEach(el => el.remove());
|
||||
}
|
||||
|
||||
// ── Meta Bar ──
|
||||
|
||||
function setMeta(text) {
|
||||
@@ -123,3 +130,23 @@ function setMeta(text) {
|
||||
function setMetaHtml(html) {
|
||||
metaEl().innerHTML = html;
|
||||
}
|
||||
|
||||
// ── Archive Button ──
|
||||
|
||||
function showArchiveLoadButton() {
|
||||
const existing = chatEl().querySelector('.archive-load-btn');
|
||||
if (existing) existing.remove();
|
||||
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'archive-load-btn';
|
||||
btn.textContent = '📦 Archivierte Nachrichten laden';
|
||||
btn.addEventListener('click', loadLatestArchive);
|
||||
|
||||
// Immer ganz oben im Chat
|
||||
chatEl().prepend(btn);
|
||||
}
|
||||
|
||||
function removeArchiveLoadButton() {
|
||||
const btn = chatEl().querySelector('.archive-load-btn');
|
||||
if (btn) btn.remove();
|
||||
}
|
||||
Reference in new issue
Block a user