From 4aabc068edd7225b90edd7bc4c88d2951a55b876 Mon Sep 17 00:00:00 2001 From: Prantik Pratim Medhi <140103052+prantikmedhi@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:42:28 +0530 Subject: [PATCH] fix(ui): use raw data for 'Copy Chat' to avoid extra newlines (#1391) - Prefer dataset.raw (original markdown) over innerText in _serializeChatTranscript. - This prevents HTML-to-text artifacts and redundant newlines added by the browser. --- static/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/app.js b/static/app.js index 32ed5a3..683e0e5 100644 --- a/static/app.js +++ b/static/app.js @@ -303,7 +303,9 @@ function initializeEventListeners() { label = (raw || '').trim() || 'Assistant'; } const body = child.querySelector('.body'); - const text = body ? (body.innerText || body.textContent || '').trim() : ''; + // Prefer dataset.raw (original markdown) over innerText (rendered HTML as text) + // to avoid extra newlines and formatting artifacts. + const text = body ? (body.dataset.raw || body.innerText || body.textContent || '').trim() : ''; if (text) parts.push(`${label}: ${text}`); } else if (child.classList?.contains('agent-thread')) { const lines = ['[Tool calls]'];