diff --git a/wwwroot/js/history.js b/wwwroot/js/history.js index 7027c03..df4604d 100644 --- a/wwwroot/js/history.js +++ b/wwwroot/js/history.js @@ -117,7 +117,29 @@ function _findOldestMessageId(entries) { return 0; } +function _mergeConsecutiveAssistantTexts(msgs) { + const result = []; + for (const msg of msgs) { + if (msg.type === 'text' && msg.role === 'assistant') { + const prev = result[result.length - 1]; + if (prev && prev.type === 'text' && prev.role === 'assistant' + && prev.iteration === msg.iteration) { + // Gleiche Iteration: nahtlos zusammenfügen (Web-Search-Fragmente etc.) + prev.content = (prev.content || '') + ' ' + (msg.content || ''); + // IDs/Timestamps: letztes behalten (für Mark-Button etc.) + if (msg.id) prev.id = msg.id; + if (msg.createdAt) prev.createdAt = msg.createdAt; + if (msg.isMarked) prev.isMarked = true; + continue; + } + } + result.push(Object.assign({}, msg)); + } + return result; +} + function _renderMessagesIntoFragment(fragment, msgs) { + msgs = _mergeConsecutiveAssistantTexts(msgs); for (const msg of msgs) { const div = document.createElement('div'); switch (msg.type) { @@ -185,6 +207,7 @@ function _renderMessagesIntoFragment(fragment, msgs) { } function renderMessages(msgs, addToConversation) { + msgs = _mergeConsecutiveAssistantTexts(msgs); for (const msg of msgs) { if (msg.id > lastKnownMessageId) lastKnownMessageId = msg.id; @@ -266,7 +289,8 @@ async function loadLatestArchive() { fragment.appendChild(sep); for (const entry of data) { - for (const msg of entry.messages) { + const mergedMsgs = _mergeConsecutiveAssistantTexts(entry.messages); + for (const msg of mergedMsgs) { const div = document.createElement('div'); switch (msg.type) { case 'text': diff --git a/wwwroot/js/pages/dashboard.js b/wwwroot/js/pages/dashboard.js index 00ee322..044c29a 100644 --- a/wwwroot/js/pages/dashboard.js +++ b/wwwroot/js/pages/dashboard.js @@ -151,7 +151,7 @@ registerPage('dashboard', { if (a.useSoul) badges.push(' Seele'); if (a.useIdentity) badges.push(' Ich'); if (a.useUserInfo) badges.push(' Du'); - if (a.useMemory) badges.push(' Erinnerungen'); + if (a.useMemory) badges.push(' Erinnerungen'); if (a.webSearchVersion) { const wsYear = a.webSearchVersion.includes('2025') ? '2025' : '2026'; badges.push(` Web-Suche`);