-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: (UI) add syntax highlighting and latex math rendering #10808
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This frontend code is too simple and I don't want to add formatter or linter, it's overkill. Just take 2 or 5 minutes to read the code before committing, is it difficult to do so?
This is an open source project, not a school, so I can't spend there time fixing every possible thing. Because you've already done this way many times before, the next time, I may not review your PR if it takes me too much time. Hope you understand that...
For now, this PR can be merged once the CI passes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm one problem, the bundle size gets too big after this change, going from 500kb to more than 2MB now.
I temporarily block merging of this PR, but will see how we can improve that.
I removed math rendering (katex) because it is too big, we can only add it back in the future once we find a way to reduce bundle size |
merging this after #10803 to avoid conflict |
Added back katex with gzip to reduce bundle size, as discussed: #10758 (comment) Bundle size is now:
|
I think this is missing some triggers for latex. Using Qwen2.5:
|
Yeah it depends on the model. It must be trained so that it output I'll add a switch in setting for that, so user can switch between |
Note that some of this output started \[, or with ```latex, and it also failed to render as latex (see the details block for the raw text). |
For the one starts with ```latex , it should be an easy fix. Could you point me to the one starts with |
Looking back, I think rendering the latex code block as latex is a mistake, it should be just latex code with syntax highlighting if available. I asked the model to show me softmax with latex, and that's what it did. |
@ggerganov I'm gonna merge this PR now. This will produce a conflict when you merge your PR. To resolve it, you just need to delete |
…nov#10808) * add code highlighting and math formatting * code cleanup * build public/index.html * rebuild public/index.html * fixed coding style * fixed coding style * style fixes * highlight: smaller bundle size, fix light & dark theme * remove katex * add bundle size check * add more languages * add php * reuse some langs * use gzip * Revert "remove katex" This reverts commit c0e5046. * use better maintained @vscode/markdown-it-katex * fix gzip non deterministic * ability to add a demo conversation for dev * fix latex rendering * add comment * latex codeblock as code --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
Make sure to read the contributing guidelines before submitting a PR
Fixes #10246 and #10758
The changes in this PR include:
Screenshots:
Syntax highlighting
Light theme:
Latex rendering: