ui: Mermaid Diagrams in chat + interactive preview (#24032)

This commit is contained in:
Aleksander Grygier
2026-06-03 16:55:36 +02:00
committed by GitHub
parent 9e58d4d692
commit ee4cf705bb
19 changed files with 2851 additions and 773 deletions
+5
View File
@@ -34,3 +34,8 @@ export const MODALITY_LABELS = {
[ModelModality.AUDIO]: 'Audio',
[ModelModality.VIDEO]: 'Video'
} as const;
// Shared SVG icon strings for copy and preview buttons
export const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy-icon lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
export const PREVIEW_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eye lucide-eye-icon"><path d="M2.062 12.345a1 1 0 0 1 0-.69C3.5 7.73 7.36 5 12 5s8.5 2.73 9.938 6.655a1 1 0 0 1 0 .69C20.5 16.27 16.64 19 12 19s-8.5-2.73-9.938-6.655"/><circle cx="12" cy="12" r="3"/></svg>`;
+2
View File
@@ -15,6 +15,7 @@ export * from './cache';
export * from './chat-form';
export * from './cli-flags';
export * from './code-blocks';
export * from './icons';
export * from './code';
export * from './context-keys';
export * from './control-actions';
@@ -26,6 +27,7 @@ export * from './icons';
export * from './latex-protection';
export * from './literal-html';
export * from './markdown';
export * from './mermaid-blocks';
export * from './max-bundle-size';
export * from './mcp';
export * from './mcp-form';
@@ -0,0 +1,2 @@
export const MERMAID_WRAPPER_CLASS = 'mermaid-block-wrapper';
export const MERMAID_SCROLL_CONTAINER_CLASS = 'mermaid-scroll-container';