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.
This commit is contained in:
committed by
GitHub
parent
85bc18b7d8
commit
4aabc068ed
@@ -303,7 +303,9 @@ function initializeEventListeners() {
|
|||||||
label = (raw || '').trim() || 'Assistant';
|
label = (raw || '').trim() || 'Assistant';
|
||||||
}
|
}
|
||||||
const body = child.querySelector('.body');
|
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}`);
|
if (text) parts.push(`${label}: ${text}`);
|
||||||
} else if (child.classList?.contains('agent-thread')) {
|
} else if (child.classList?.contains('agent-thread')) {
|
||||||
const lines = ['[Tool calls]'];
|
const lines = ['[Tool calls]'];
|
||||||
|
|||||||
Reference in New Issue
Block a user