mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 09:09:53 +00:00
refac: latex handling
This commit is contained in:
parent
d3c6bfb764
commit
ebce006974
@ -178,6 +178,7 @@
|
|||||||
{ left: '\\pu{', right: '}', display: false },
|
{ left: '\\pu{', right: '}', display: false },
|
||||||
{ left: '\\ce{', 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: '\\[', right: '\\]', display: false },
|
||||||
{ left: '[ ', right: ' ]', display: false },
|
{ left: '[ ', right: ' ]', display: false },
|
||||||
{ left: '\\begin{equation}', right: '\\end{equation}', display: true },
|
{ left: '\\begin{equation}', right: '\\end{equation}', display: true },
|
||||||
|
@ -7,6 +7,9 @@ import { WEBUI_BASE_URL } from '$lib/constants';
|
|||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
export const sanitizeResponseContent = (content: string) => {
|
export const sanitizeResponseContent = (content: string) => {
|
||||||
|
// replace single backslash with double backslash
|
||||||
|
content = content.replace(/\\/g, '\\\\');
|
||||||
|
|
||||||
// First, temporarily replace valid <video> tags with a placeholder
|
// First, temporarily replace valid <video> tags with a placeholder
|
||||||
const videoTagRegex = /<video\s+src="([^"]+)"\s+controls><\/video>/gi;
|
const videoTagRegex = /<video\s+src="([^"]+)"\s+controls><\/video>/gi;
|
||||||
const placeholders: string[] = [];
|
const placeholders: string[] = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user