Skip to content

fix: render LaTeX math in chat messages#1168

Open
nimitbhardwaj wants to merge 1 commit intoRightNow-AI:mainfrom
nimitbhardwaj:fix/latex-rendering
Open

fix: render LaTeX math in chat messages#1168
nimitbhardwaj wants to merge 1 commit intoRightNow-AI:mainfrom
nimitbhardwaj:fix/latex-rendering

Conversation

@nimitbhardwaj
Copy link
Copy Markdown
Contributor

Summary

  • Fix LaTeX math not rendering in chat by updating CSP to allow jsdelivr CDN
  • Add MutationObserver to auto-render LaTeX when new messages are added to DOM

Changes

  • webchat.rs: CSP updated to allow https://cdn.jsdelivr.net for scripts, styles, fonts, and connect-src
  • chat.js: MutationObserver in init() watches for new .message-bubble elements and calls renderLatex() automatically
  • katex.js: Unchanged (already uses jsdelivr CDN)

Root Cause

The dashboard's CSP was blocking the dynamic loading of KaTeX from jsdelivr CDN. CSP only allowed scripts from 'self' and 'unsafe-eval'.

Fixes #1167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LaTeX/Mathematical Equations Not Rendering in Chat in Openfang Web

1 participant