mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-18 04:51:23 -05:00
feat: rendering Mermaid diagrams in the chat response #923
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 @joelmnz on GitHub (May 15, 2024).
Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to copy generated Mermaid script from the chat window into Mermaid Live just to see the diagram.
Describe the solution you'd like
It would be amazing if the chat renderer could detect the Mermaid script tag and render the diagram using Mermaid.js.
This feature could be enabled or disabled via a user setting or controlled by an inline toggle in the chat when you hover over the Mermaid script. This setting should be sticky, remembering the last used preference.
Describe alternatives you've considered
The only alternative I've found is to copy and paste the generated Mermaid code from the chat into an online renderer.
Additional context
This project is great, and I am looking forward to seeing how it evolves.
@newzealandpaul commented on GitHub (May 29, 2024):
This is support in some LLM clients. It is a very useful feature. Is there a plugin interface to open-webui to enable content filters?
@tjbck commented on GitHub (May 29, 2024):
@newzealandpaul We're planning on pushing our plugin framework Pipelines to allow such actions, stay tuned!
@newzealandpaul commented on GitHub (May 29, 2024):
@tjbck great! I Looked at the example, does it allow modifying how LLM responses are rendered?
Here is an example conversation below. Ideally some JS could be inserted inside the web ui that simply renders a mermaid chart above or below the response. Just like how GitHub issues does it.
User: Generate a mermaid 10.0.7 diagram showing relationships inside a transformer neural network
Assistant: Creating a diagram in Mermaid 10.0.7 to show the relationship in a Transformer Neural Network is a great idea. A Transformer model comprises an encoder and a decoder, with multiple layers for attention mechanism and feedforward neural networks. I'll outline a basic structure for you.
Here's the Mermaid diagram code to demonstrate the components and how they relate to each other:
Here's the Mermaid diagram code to demonstrate the components and how they relate to each other:
@newzealandpaul commented on GitHub (May 29, 2024):
Mermaid as generated by GPT4 start with the following (where ' is a `)
'''mermaid
Its very hard showing this in Github issues because Github aggressively renders mermaid
@tjbck commented on GitHub (Jun 3, 2024):
Added to dev, releasing 0.2.2 soon!