feat(tui): mermaid flowchart side panel (F key) via local LLM#142
Open
RonTuretzky wants to merge 2 commits into
Open
feat(tui): mermaid flowchart side panel (F key) via local LLM#142RonTuretzky wants to merge 2 commits into
RonTuretzky wants to merge 2 commits into
Conversation
Adds a togglable side panel that periodically asks the configured local LLM to render the live transcript as a mermaid flowchart. Reuses the summarizer engine (MLX on Apple Silicon, Ollama via summarization_model setting) so the same backend serves both U-key summaries and F-key flowcharts. The panel renders mermaid source as text — readable in the terminal, and copy-pastable into a real renderer for a graphical view.
There was a problem hiding this comment.
Pull request overview
Adds an optional “Flowchart” side panel to the Textual TUI that renders the current conversation as LLM-generated Mermaid source, leveraging the existing local summarizer backend configuration.
Changes:
- Introduces a new
FlowchartPanelwidget (hidden by default) to display Mermaid text + status. - Adds a local-LLM flowchart generator (
generate_flowchart) built on the existingsummarizerengine/templates. - Wires an
Fkeybinding and a periodic refresh loop intotui/app.py, plus layout updates to host transcript + side panel.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tui/widgets/flowchart.py | New side panel widget for showing Mermaid source and status/error text. |
| tui/widgets/cyberpunk.tcss | Adds a horizontal “transcript row” layout so the transcript can share space with the flowchart panel. |
| tui/llm/flowchart_gen.py | New prompt/template + cleanup utilities for generating Mermaid flowchart source via the summarizer backend. |
| tui/app.py | Adds F binding, panel composition, refresh timer, and background worker to generate/update flowcharts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2466
to
+2469
| @work(exclusive=True, thread=True, group="flowchart") | ||
| def _run_flowchart_worker(self, transcript_text: str, model_name: str) -> None: | ||
| try: | ||
| mermaid = generate_flowchart(transcript_text, model_name=model_name) |
Comment on lines
+2437
to
+2442
| def _maybe_refresh_flowchart(self): | ||
| if not self._flowchart_enabled or self._flowchart_inflight: | ||
| return | ||
| now = time.time() | ||
| if now - self._flowchart_last_run < self._flowchart_min_interval_sec: | ||
| return |
|
|
||
| _PLACEHOLDER = ( | ||
| "[#607080]waiting for transcript…[/]\n" | ||
| "[#445566]flowchart will refresh every few seconds[/]" |
Comment on lines
+2419
to
+2422
| if self._flowchart_enabled: | ||
| model = self._flowchart_model_name() or "MLX default" | ||
| panel.set_status(f"[#607080]idle · {model}[/]") | ||
| tp.system_message(f"flowchart mode ON ({model})", Log.SYS) |
- Route MLX flowchart generation through _mlx_executor under _transcribe_lock (same as _run_summarize_and_export) so it can't overlap a transcribe or model-load on the GPU; skip the lock for Ollama since HTTP doesn't share the GPU. - Show an honest backend label: "MLX default" only on Apple Silicon, otherwise prompt the user to set summarization_model to ollama:<model>. - Update placeholder copy to mention the actual ~15s cadence. - Document why _maybe_refresh_flowchart deliberately doesn't gate on _recording (P2P parties deliver turns while the local mic is paused).
Collaborator
Author
|
Thanks @copilot-pull-request-reviewer — addressed all 4 in 0835a4d:
|
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
summarization_modelconfig — MLX on Apple Silicon or Ollama everywhere), so the same backend powers both the U-key summary and the F-key flowchart with no new dependencies.Test plan
summarization_modelunset on Apple Silicon: press F, confirm MLX default loads and flowchart populates.summarization_model=ollama:qwen3:0.6b: press F, confirm status line shows the model and panel updates after a few transcribed turns.