diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index eded26fb3..c1224b5e1 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -178,6 +178,7 @@ { left: '\\pu{', right: '}', display: false }, { left: '\\ce{', right: '}', display: false }, { left: '\\(', right: '\\)', display: false }, + { left: '( ', right: ' )', display: false }, { left: '\\[', right: '\\]', display: false }, { left: '[ ', right: ' ]', display: false }, { left: '\\begin{equation}', right: '\\end{equation}', display: true }, diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index d80fcc799..196085dbd 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -7,6 +7,9 @@ import { WEBUI_BASE_URL } from '$lib/constants'; ////////////////////////// export const sanitizeResponseContent = (content: string) => { + // replace single backslash with double backslash + content = content.replace(/\\/g, '\\\\'); + // First, temporarily replace valid