fix: escape content in buildCollapsibleSection, avoid double-escaping response

This commit is contained in:
2026-05-02 15:27:18 +03:00
parent 6b922d84ae
commit a980b90c0a

View File

@@ -184,7 +184,7 @@ function renderPromptEntry(entry) {
if (_middleTruncation && responseText.length > 400) { if (_middleTruncation && responseText.length > 400) {
responseText = responseText.substring(0, 200) + '\n\n... [truncated middle] ...\n\n' + responseText.substring(responseText.length - 200); responseText = responseText.substring(0, 200) + '\n\n... [truncated middle] ...\n\n' + responseText.substring(responseText.length - 200);
} }
displayHtml += buildCollapsibleSection('Response', escapeHtml(responseText), 'response'); displayHtml += buildCollapsibleSection('Response', responseText, 'response');
} }
// Render into the prompt-display div (using innerHTML for collapsible structure) // Render into the prompt-display div (using innerHTML for collapsible structure)
@@ -249,7 +249,7 @@ function buildCollapsibleSection(title, content, sectionId) {
${escapeHtml(title)} ${escapeHtml(title)}
</div> </div>
<div class="prompt-subsection-body" id="${uniqueId}"> <div class="prompt-subsection-body" id="${uniqueId}">
<pre style="white-space: pre-wrap; word-break: break-word; background: #1a1a1a; padding: 0.5rem; border-radius: 4px; font-size: 0.8rem; line-height: 1.4; margin: 0.25rem 0;">${content}</pre> <pre style="white-space: pre-wrap; word-break: break-word; background: #1a1a1a; padding: 0.5rem; border-radius: 4px; font-size: 0.8rem; line-height: 1.4; margin: 0.25rem 0;">${escapeHtml(content)}</pre>
</div>`; </div>`;
} }