diff --git a/frontend/src/components/MermaidRenderer.tsx b/frontend/src/components/MermaidRenderer.tsx index 23b69155..c32b253b 100644 --- a/frontend/src/components/MermaidRenderer.tsx +++ b/frontend/src/components/MermaidRenderer.tsx @@ -3,11 +3,7 @@ import mermaid from 'mermaid'; import CopyButton from './CopyButton'; import { useSelector } from 'react-redux'; import { selectStatus } from '../conversation/conversationSlice'; - -interface MermaidRendererProps { - code: string; - isDarkTheme: boolean; -} +import { MermaidRendererProps } from './types'; const MermaidRenderer: React.FC = ({ code, diff --git a/frontend/src/components/types/index.ts b/frontend/src/components/types/index.ts index 47fcd86f..4e6870c4 100644 --- a/frontend/src/components/types/index.ts +++ b/frontend/src/components/types/index.ts @@ -22,3 +22,8 @@ export type InputProps = { e: React.KeyboardEvent, ) => void; }; + +export type MermaidRendererProps = { + code: string; + isDarkTheme: boolean; +}; diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 0b7498d2..c92cf870 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -403,6 +403,15 @@ const ConversationBubble = forwardRef< const match = /language-(\w+)/.exec(className || ''); const language = match ? match[1] : ''; + if (language === 'mermaid') { + return ( + + ); + } + return match ? (
@@ -792,15 +801,6 @@ function Thought({ const match = /language-(\w+)/.exec(className || ''); const language = match ? match[1] : ''; - if (language === 'mermaid') { - return ( - - ); - } - return match ? (