Skip to content

Commit ee63e6d

Browse files
authored
Merge pull request #338 from FunMelon/fix-issue-visualizer-artifacts-unicode-escape
fix(scripts/static/js/sidebar.js): fixed unicode escape error in disp…
2 parents a7428ef + f78f519 commit ee63e6d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/static/js/sidebar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,19 @@ export function showSidebarContent(d, fromHover = false) {
405405
}
406406
// Show only the selected prompt
407407
let promptVal = promptMap[lastPromptKey];
408+
409+
// Handle unicode escape for artifacts JSON display
410+
if (lastPromptKey === 'artifacts' && typeof promptVal === 'string') {
411+
try {
412+
// Parse and stringify to properly escape unicode
413+
const parsed = JSON.parse(promptVal);
414+
promptVal = JSON.stringify(parsed, null, 2);
415+
} catch (e) {
416+
// If parsing fails, use original value
417+
console.warn('Failed to parse artifacts JSON for unicode escape:', e);
418+
}
419+
}
420+
408421
let promptHtml = `<pre class="sidebar-pre">${promptVal ?? ''}</pre>`;
409422
return selectHtml + promptHtml;
410423
}

0 commit comments

Comments
 (0)