sourcebot icon indicating copy to clipboard operation
sourcebot copied to clipboard

[FR] Render mermaid diagrams in chat answers (with explicit "Visualize" button)

Open wilson101xx opened this issue 6 months ago • 3 comments

The need PMs and devs on our team frequently ask Sourcebot questions about how specific services work end-to-end ("show me a visual of X service", "what's the request flow through Y?"). The answer is always a long markdown wall, which is great for devs but hard for PMs to skim.

Proposal Two-path diagram rendering, in V1:

  1. Automatic — teach the agent to emit a ```mermaid fenced block in its markdown answer when the user asks for something visual (architecture, workflow, sequence). Render it inline in the answer card. No new tool, no new stream part type — just a renderer in the existing markdown pipeline.
  2. Explicit — add a "Visualize" button to the answer card that re-prompts the agent on the existing thread for a diagram view of the answer.

Diagrams render to a clickable inline SVG with a fullscreen pan/zoom modal. Architecture is registry-based so a future react-flow engine can be plugged in without changing the markdown wiring.

Version 2 After we have proof that people are using this feature i propose we can create a inline React Flow, where it can be built in, and interactive, drag and drop and clickable

wilson101xx avatar May 28 '26 08:05 wilson101xx

https://github.com/sourcebot-dev/sourcebot/pull/1241

wilson101xx avatar May 28 '26 09:05 wilson101xx

hey i wanna work on this

Shashank200345 avatar May 29 '26 09:05 Shashank200345

@Shashank200345

I have completed this PR https://github.com/sourcebot-dev/sourcebot/pull/1241 which should resolve it

wilson101xx avatar May 29 '26 09:05 wilson101xx