webui: add lazy markdown loading for improved performance#19557
Closed
shem-aleph wants to merge 1 commit into
Closed
webui: add lazy markdown loading for improved performance#19557shem-aleph wants to merge 1 commit into
shem-aleph wants to merge 1 commit into
Conversation
Add LazyMarkdownContent component that defers markdown rendering until messages scroll into view. This significantly improves load times for conversations with many messages (500+ messages would previously timeout). Changes: - New LazyMarkdownContent.svelte using IntersectionObserver - ChatMessageAssistant uses lazy loading for completed messages, eager rendering for streaming messages - ChatMessageUser and ChatMessageSystem use lazy loading - Short messages (<200 chars) render immediately for responsiveness The component shows a lightweight text placeholder until the message enters the viewport (with 200px margin for preloading), then renders full markdown with syntax highlighting, KaTeX, etc.
Contributor
|
Let's come back to this after we have #18655 merged which should be very soon :) |
Contributor
|
Superseded by #20999 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
LazyMarkdownContentcomponent that defers markdown rendering until messages scroll into view. This significantly improves load times for conversations with many messages.Problem
Conversations with 500+ messages would timeout or take several minutes to load because all
MarkdownContentcomponents initialize simultaneously, each running the full remark/rehype pipeline (GFM, KaTeX, syntax highlighting, etc.).Solution
New
LazyMarkdownContentwrapper that:IntersectionObserverto detect when messages enter viewportChanges
LazyMarkdownContent.svelte- new component with IntersectionObserverChatMessageAssistant.svelte- uses lazy for completed, eager for streamingChatMessageUser.svelte- uses lazy loadingChatMessageSystem.svelte- uses lazy loadingindex.ts- exports new componentTesting
npm run checkpasses with 0 errors