Skip to content

Self-hosted AI workspace.

Python

fix(ui): use raw data for 'Copy Chat' to avoid extra newlines (#1391)

Prantik Pratim Medhi9e25566b4525
diff --git a/static/app.js b/static/app.js
index 32ed5a31f..683e0e553 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]'];