Frontend: trim message text in all bubble renderers

This commit is contained in:
Meleki committed 2026-02-27 11:25:01 +01:00
1 parent 882d4ec21d
commit c2335c542f
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -110,7 +110,7 @@ async function loadLatestArchive() {
switch (msg.type) {
case 'text':
div.className = msg.role === 'user' ? 'msg user archived' : 'msg assistant archived';
div.textContent = msg.content;
div.textContent = (msg.content || '').trim();
if (msg.role === 'user' && msg.attachmentCount > 0) {
let names = [];
try { if (msg.attachmentNames) names = JSON.parse(msg.attachmentNames); } catch {}
@@ -137,7 +137,7 @@ async function loadLatestArchive() {
case 'error':
div.className = 'msg system-info archived';
div.style.color = '#ff6b6b';
div.textContent = msg.content;
div.textContent = (msg.content || '').trim();
break;
default:
continue;
+3 -3
View File
@@ -25,7 +25,7 @@ function addUserBubble(text, streamed = false) {
const div = document.createElement('div');
div.className = 'msg user';
if (streamed) div.classList.add('streamed');
div.textContent = text;
div.textContent = (text || '').trim();
chatEl().appendChild(div);
scrollDown();
}
@@ -33,7 +33,7 @@ function addUserBubble(text, streamed = false) {
function addAssistantBubble(text) {
const div = document.createElement('div');
div.className = 'msg assistant';
div.textContent = text;
div.textContent = (text || '').trim();
chatEl().appendChild(div);
scrollDown();
return div;
@@ -44,7 +44,7 @@ function addErrorBubble(text, streamed = false) {
div.className = 'msg system-info';
if (streamed) div.classList.add('streamed');
div.style.color = '#ff6b6b';
div.textContent = text;
div.textContent = (text || '').trim();
chatEl().appendChild(div);
scrollDown();
}