mirror of
https://github.com/Heretek-AI/Strata.git
synced 2026-11-07 10:05:58 -10:00
Chat settings > Render math (off by default). When it is on, \( \), \[ \], $x$ and $$ $$ in an answer are drawn as formulas by KaTeX 0.19.0, which is vendored in serve/web/vendor/katex (script, style, 20 woff2 fonts, MIT licence and a PROVENANCE.json with the npm integrity and the sha256 of every file, so the page needs no network). Nothing of KaTeX loads until an answer holds a formula. The shared core (math.js, from #2972) keeps the text of every message exactly as the model wrote it: formulas are swapped for placeholders before the Markdown runs and drawn over them afterwards, so history, copying, the Markdown export and the requests never see the drawing. Code, link targets, prices ($5 and $10) and a formula still being streamed stay text. A formula that fails, is over 16 KiB or times out stays as its source text. Safety: KaTeX runs with trust off (no \href, \url, \includegraphics, \htmlClass: they are drawn as their own name), maxExpand 1000, maxSize 20 and a fresh macro table per formula; it builds DOM nodes itself, so no HTML string from a model reaches the page. A formula already drawn is placed again at once while an answer streams, so it does not flicker back to source. serve/test_web_math.js runs the real vendored KaTeX against hostile formulas; serve/test_web_math.py checks the vendored files against PROVENANCE.json and that nothing outside this server is addressed. serve/web/vendor is -text in .gitattributes so the hashes hold on a Windows checkout. Ported by hand from PRs #2972 (core) and #2974 (KaTeX) by CC-David-CC. Co-authored-by: David <[email protected]>
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
# Frozen prompts are hashed byte for byte (manifest sha256): never convert their line endings.
|
|
bench/prompts/** -text
|
|
|
|
# launchers keep their platform line endings wherever the repository is cloned
|
|
*.sh text eol=lf
|
|
*.bat text eol=crlf
|
|
*.cmd text eol=crlf
|
|
*.ps1 text eol=crlf
|
|
bin/strata text eol=lf
|
|
|
|
# copies of real packs' native_experts.txt, parsed byte for byte by tests/core/expert_layout_test.cpp
|
|
tests/data/native_experts/** -text
|
|
|
|
# the quant yardstick's text set: tokenized byte for byte (set.ids.json), never convert its line endings
|
|
data/quant_quality/** -text
|
|
|
|
# the license text is shipped and checked as LF text on every checkout
|
|
LICENSE text eol=lf
|
|
|
|
# container scripts run in Linux: always LF
|
|
docker/*.sh text eol=lf
|
|
Dockerfile text eol=lf
|
|
docker/Dockerfile text eol=lf
|
|
docker/compose/* text eol=lf
|
|
|
|
# Apple tools (codesign, plutil) read these: LF only, wherever the repository is cloned
|
|
*.plist text eol=lf
|
|
|
|
# vendored KaTeX (serve/web/vendor): the files are hashed byte for byte (PROVENANCE.json), never convert their line endings.
|
|
serve/web/vendor/** -text
|