diff --git a/.env b/.env index 38f71060..76bd0df5 100644 --- a/.env +++ b/.env @@ -2,3 +2,4 @@ #VITE_API_BASE=http://localhost:5174 #VITE_ENDPOINT_COMPLETIONS=/v1/chat/completions #VITE_ENDPOINT_MODELS=/v1/models +#VITE_RENDER_LATEX=false diff --git a/src/lib/EditMessage.svelte b/src/lib/EditMessage.svelte index 9690993a..36699474 100644 --- a/src/lib/EditMessage.svelte +++ b/src/lib/EditMessage.svelte @@ -19,6 +19,8 @@ export let message:Message export let chatId:number export let chat:Chat + + const renderLatexFlag = import.meta.env.VITE_RENDER_LATEX || true $: chatSettings = chat.settings @@ -224,6 +226,9 @@ } const preprocessMath = (text: string): string => { + if (renderLatexFlag !== true) { + return text + } var codeBlockPlaceholderPrefix = "__prefix__c0d3b10ck__"; while (text.indexOf(codeBlockPlaceholderPrefix) > 0) { codeBlockPlaceholderPrefix = codeBlockPlaceholderPrefix + "_";