webui: Fix selecting generated output issues during active streaming#18091
Conversation
allozaur
left a comment
There was a problem hiding this comment.
@ggerganov @ngxson @ServeurpersoCom
Please do some testing on your end as well and let me know if we aren't missing anything in this PR to address the issue.
|
Fantastic! I absolutely must stress test it @ MoE A3B on 5090 because my draft kept crashing after a while! Edit : We have the same edge case bug as in the POC/Draft (video watched together). We need to try to narrow down by generating the content that causes it. |
|
Running GPT-OSS-20B at 330 tok/s inference was faster than rendering, making it easier to trigger the race condition between stable/unstable block updates, solution: await tick() to force DOM sync |
tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte
Outdated
Show resolved
Hide resolved
|
Generally this also works on my end, but I do see occasionally bigger selections than expected. Maybe related to the race that @ServeurpersoCom found: webui-selection-0.mp4 |
eb39de1 to
511a426
Compare
ggerganov
left a comment
There was a problem hiding this comment.
Actually, I did some more testing and the problem that I observed occurs only when I am trying to select text inside a code block that is currently being generated. After it gets closed, then selecting for that block works ok.
I think this is acceptable.
tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte
Outdated
Show resolved
Hide resolved
tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte
Outdated
Show resolved
Hide resolved
tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte
Outdated
Show resolved
Hide resolved
c5f4157 to
70b0644
Compare
@ggerganov @ServeurpersoCom I've added some changes after @ngxson's review. Please re-test this on your ends. |
|
No regression on my end: >10 long rich markdown generations with success, whereas the corruption was systematically occurring after 2 or 3 generations
|
ngxson
left a comment
There was a problem hiding this comment.
Tested on my side, it works except for inside a generating code block as Georgi spotted earlier.
We can improve this in the future by somehow prevent setting innerHTML via {@html block.html}. Instead, I think it's best to have a system where it can take a HastRoot and use depth-first search to get the diff between 2 virtual DOM, and only update changed nodes on HTML. Probably there are some libraries already do all of these heavy-lifting works for us, but we can have a look later.
For now, I think this PR is good to merge.
|
Same on Windows, copy paste -> no |
6768dec to
aa461e8
Compare
@ggerganov @ServeurpersoCom this should be fixed with 30c2c18 |
Suggestion from @ServeurpersoCom Co-authored-by: Pascal <[email protected]>
aa461e8 to
b4aa66a
Compare
|
Thanks so much for this one! 🥳 It fixes a usability annoyance for good. The users will love it. |
Great to hear! It's still not in a perfect state and we are planning a better strategy for rendering the generated content, but it solves the most pressing issue. |
…gml-org#18091) * draft: incremental markdown rendering with stable blocks * refactor: Logic improvements * refactor: DRY Markdown post-processing logic * refactor: ID generation improvements * fix: Remove runes * refactor: Clean up & add JSDocs * chore: update webui static output * fix: Add tick to prevent race conditions for rendering Markdown blocks Suggestion from @ServeurpersoCom Co-authored-by: Pascal <[email protected]> * chore: Run `npm audit fix` * chore: update webui static output * feat: Improve performance using global counter & id instead of UUID * refactor: Enhance Markdown rendering with link and code features * chore: update webui static output * fix: Code block content extraction * chore: update webui static output * chore: update webui static output --------- Co-authored-by: Pascal <[email protected]>
…(#18091) * draft: incremental markdown rendering with stable blocks * refactor: Logic improvements * refactor: DRY Markdown post-processing logic * refactor: ID generation improvements * fix: Remove runes * refactor: Clean up & add JSDocs * chore: update webui static output * fix: Add tick to prevent race conditions for rendering Markdown blocks Suggestion from @ServeurpersoCom Co-authored-by: Pascal <[email protected]> * chore: Run `npm audit fix` * chore: update webui static output * feat: Improve performance using global counter & id instead of UUID * refactor: Enhance Markdown rendering with link and code features * chore: update webui static output * fix: Code block content extraction * chore: update webui static output * chore: update webui static output --------- Co-authored-by: Pascal <[email protected]>


Close #17132
MarkdownContentcomponentdemo.mp4