From f78f519c8a32865ed6b567376000f83cf0e92521 Mon Sep 17 00:00:00 2001 From: FunMelon Date: Tue, 9 Dec 2025 13:05:16 +0800 Subject: [PATCH] fix(scripts/static/js/sidebar.js): fixed unicode escape error in displaying artifacts in the sidebar --- scripts/static/js/sidebar.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/static/js/sidebar.js b/scripts/static/js/sidebar.js index d48b2aa29..1230c0f81 100644 --- a/scripts/static/js/sidebar.js +++ b/scripts/static/js/sidebar.js @@ -405,6 +405,19 @@ export function showSidebarContent(d, fromHover = false) { } // Show only the selected prompt let promptVal = promptMap[lastPromptKey]; + + // Handle unicode escape for artifacts JSON display + if (lastPromptKey === 'artifacts' && typeof promptVal === 'string') { + try { + // Parse and stringify to properly escape unicode + const parsed = JSON.parse(promptVal); + promptVal = JSON.stringify(parsed, null, 2); + } catch (e) { + // If parsing fails, use original value + console.warn('Failed to parse artifacts JSON for unicode escape:', e); + } + } + let promptHtml = ``; return selectHtml + promptHtml; }