[PR #2974] [CLOSED] [GUI] Render chat math with bundled KaTeX #4371

Closed
opened 2026-11-07 15:35:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2974
Author: @CC-David-CC
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: feat/web-math-katex-minimal


📝 Commits (2)

  • 0abb109 web: add shared source-preserving math core
  • 9392cdc web: render chat math with bundled KaTeX

📊 Changes

31 files changed (+229 additions, -4 deletions)

View changed files

➕ docs/WEB_MATH_INTERFACE.md (+16 -0)
📝 serve/server.py (+18 -0)
📝 serve/web/app.css (+8 -0)
📝 serve/web/app.js (+18 -4)
📝 serve/web/index.html (+4 -0)
➕ serve/web/math-adapter.js (+22 -0)
➕ serve/web/math.js (+113 -0)
➕ serve/web/vendor/katex/LICENSE (+21 -0)
➕ serve/web/vendor/katex/PROVENANCE.json (+7 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 (+0 -0)
➕ serve/web/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff2 (+0 -0)

...and 11 more files

📄 Description

Problem and result

Enable Render math in Chat settings to display inline and block equations using bundled KaTeX. Original source remains available for copy, export, persistence and API requests.

Depends on #2972. Related: #1830. Alternative renderer: #2975.

Approach

Rebase the shared math core onto upstream main and layer the KaTeX 0.19.0 adapter and required local assets on top. Load assets only when enabled, use no CDN, and fall back to source for invalid input.

Validation

Passed:

  • Rebased onto upstream main 90767252f; tested head 9392cdca6. Range-diff confirms the original patches are unchanged; git diff --check upstream/main passed.
  • Windows, Python 3.13.15: the existing Playwright regression harness passed Chromium, Firefox and WebKit. Parser and streaming boundaries, code/currency handling, source preservation, settings persistence, disabled behavior, cache limits, deadlines and stale render completion. Equation rendering, invalid-input fallback, local asset loading and narrow-screen layout. Bundled asset integrity and package-byte comparisons passed.
  • Harness commands: python test_browser.py --browser chromium; python test_browser.py --browser firefox; python test_browser.py --browser webkit; python verify_vendor.py. Renderer screenshots inspected where applicable.

Failed:

  • None observed in final validation.

Not run:

  • Real-model/GPU inference and the Tauri desktop app. This change targets the existing web chat and does not change engine code.

Limits

Depends on the shared core in #2972. KaTeX and MathJax are alternative adapters; these branches are tested independently.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2974 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/web-math-katex-minimal` --- ### 📝 Commits (2) - [`0abb109`](https://github.com/Niko1221/Strata/commit/0abb10979c800256f221496fb2b891e769cea47f) web: add shared source-preserving math core - [`9392cdc`](https://github.com/Niko1221/Strata/commit/9392cdca627860fc976a2026102ac6290118568a) web: render chat math with bundled KaTeX ### 📊 Changes **31 files changed** (+229 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `docs/WEB_MATH_INTERFACE.md` (+16 -0) 📝 `serve/server.py` (+18 -0) 📝 `serve/web/app.css` (+8 -0) 📝 `serve/web/app.js` (+18 -4) 📝 `serve/web/index.html` (+4 -0) ➕ `serve/web/math-adapter.js` (+22 -0) ➕ `serve/web/math.js` (+113 -0) ➕ `serve/web/vendor/katex/LICENSE` (+21 -0) ➕ `serve/web/vendor/katex/PROVENANCE.json` (+7 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2` (+0 -0) ➕ `serve/web/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff2` (+0 -0) _...and 11 more files_ </details> ### 📄 Description ## Problem and result Enable Render math in Chat settings to display inline and block equations using bundled KaTeX. Original source remains available for copy, export, persistence and API requests. ## Related discussion Depends on #2972. Related: #1830. Alternative renderer: #2975. ## Approach Rebase the shared math core onto upstream main and layer the KaTeX 0.19.0 adapter and required local assets on top. Load assets only when enabled, use no CDN, and fall back to source for invalid input. ## Validation **Passed:** - Rebased onto upstream main `90767252f`; tested head `9392cdca6`. Range-diff confirms the original patches are unchanged; `git diff --check upstream/main` passed. - Windows, Python 3.13.15: the existing Playwright regression harness passed Chromium, Firefox and WebKit. Parser and streaming boundaries, code/currency handling, source preservation, settings persistence, disabled behavior, cache limits, deadlines and stale render completion. Equation rendering, invalid-input fallback, local asset loading and narrow-screen layout. Bundled asset integrity and package-byte comparisons passed. - Harness commands: `python test_browser.py --browser chromium; python test_browser.py --browser firefox; python test_browser.py --browser webkit; python verify_vendor.py`. Renderer screenshots inspected where applicable. **Failed:** - None observed in final validation. **Not run:** - Real-model/GPU inference and the Tauri desktop app. This change targets the existing web chat and does not change engine code. ## Limits Depends on the shared core in #2972. KaTeX and MathJax are alternative adapters; these branches are tested independently. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:35:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4371
No description provided.