From 623add89f1b8e9bef46ced22046142ed9d9c2558 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 22 Apr 2026 20:25:28 +0800 Subject: [PATCH] fix: Improve inline code sanitization in AgentStreamDisplay component - Enhanced the `sanitizeForDisplay` function to correctly remove empty inline code snippets (`` or ` `) while preserving triple-backtick fenced code blocks. - This change ensures better rendering of code blocks in the chat interface, improving overall display accuracy. --- frontend/src/views/chat/components/AgentStreamDisplay.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vue index 7e157b77..634bcfb1 100644 --- a/frontend/src/views/chat/components/AgentStreamDisplay.vue +++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue @@ -521,7 +521,10 @@ const sanitizeForDisplay = (text: string): string => { }); result = result.replace(ID_LABEL_RE, ''); result = result.replace(UUID_RE, ''); - result = result.replace(/`\s*`/g, ''); + // Remove empty inline code like `` or ` ` while preserving triple-backtick + // fenced code blocks (```). Without the lookaround the greedy pair match + // would eat two of the three fence backticks and break code block rendering. + result = result.replace(/(?