mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[GH-ISSUE #4881] displaying a mermaid diagram slows down subsequent output #13772
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thiswillbeyourgithub on GitHub (Aug 24, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4881
Bug Report
Installation Method
docker
Environment
Confirmation:
Expected Behavior:
No slowing down of output
Actual Behavior:
Every token that arrives is several times slower than with no diagram
Description
Bug Summary:
As soon as a mermaid diagram is displayed in a chat window, every subsequent token of the same chat will be dramatically slowed down.
Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Browser Console Logs:
No errors in chrome dev tools
Docker Container Logs:
No errors
Screenshots/Screen Recordings (if applicable):

Additional Information
Happens on android too
Note
Been happening from at least 0.3.13 I think
@thiswillbeyourgithub commented on GitHub (Aug 26, 2024):
Update: I confirm that simply breaking the rendering (turning mermaid into
mermai d) of the code block completely resets the speed. Which is otherwise unbearably slow and making openwebui unusable for me. we're talking about speed like 1 token per second on claude sonnet!!It's really a bummer because it's stopping me from inviting my closed ones on my instance as mermaid diagrams from claude sonnet are extremely helpful!
Edit: tested on firefox too!
edit: still present in 0.3.16
@thiswillbeyourgithub commented on GitHub (Sep 5, 2024):
Still present in
0.3.180.3.200.3.21@tjbck commented on GitHub (Sep 10, 2024):
Can't seem to reproduce wit the latest dev on my end, if anyone manages to reproduce and find a fix, please let us know!
@mjbommar commented on GitHub (Sep 13, 2024):
@thiswillbeyourgithub are you using webui from a device with chrome hardware acceleration on an iffy platform?
i have this issue using webui from a device with an intel iGPU on latest chrome/ubuntu 24.04, but the issue goes away when disabling chrome hardware acceleration.
@thiswillbeyourgithub commented on GitHub (Sep 14, 2024):
Thanks for the idea.
Turning down graphics acceleration on brave does not solve the issue, be it on android brave or desktop brave.
On desktop firefox: also happening, not solved by toggling acceleration.
Same for desktop chromium, with acceleration on or off.
A few things to add:
mermaidd) it's instantly as smooth as butter.I did a brave performance debugging:
Here are screenshots, for both I started the recording, then started the generation, then stopped the recording then stopped the generation.
Here's the laggy one
Here's for a regular generation
Here's a deeper dive in the bottom-up time spending of the laggy version:




Here's the content of the function at line 6036 in mermaid-js
I see here that mermaid is in version 10.9.1
The latest mermaid is in 11.2.0 . The version 11.0.0 started 3 weeks ago and has now apparently seen many debugs. @tjbck could it be tried to upgrade mermaid js? I don't know js and few things about browsers in general so I don't know the exact tradeoff to stay at version 10 instead of 11.
That's most probably as far as I can go on this. But it's really making mermaid unusable, which is a shame because it's a really nice and useful integration otherwise!
edit:
TL;DR
edit2: I'm thinking it's open-webui's fault. @tjbck is that run too often? If so maybe it's causing other kinds of slowdown for other renderings. I've seen that python seemed very slow to run in codeblocks but thought it must be due to a container of some sort or pyodide.
@tjbck commented on GitHub (Sep 17, 2024):
investigating
@tjbck commented on GitHub (Sep 21, 2024):
Related #3620
@thiswillbeyourgithub commented on GitHub (Sep 24, 2024):
I confirm this is fixed in the latest release(s) of today. Thanks a lot!