diff --git a/frontend/src/StyledMarkdown.tsx b/frontend/src/StyledMarkdown.tsx index 70a1f24..c46cb4d 100644 --- a/frontend/src/StyledMarkdown.tsx +++ b/frontend/src/StyledMarkdown.tsx @@ -4,7 +4,8 @@ import { SxProps, useTheme } from '@mui/material/styles'; import { Link } from '@mui/material'; import { ChatQuery, QueryOptions } from './ChatQuery'; import Box from '@mui/material/Box'; - +import JsonView from '@uiw/react-json-view'; +import { vscodeTheme } from '@uiw/react-json-view/vscode'; import { Mermaid } from './Mermaid'; import './StyledMarkdown.css'; @@ -24,10 +25,34 @@ const StyledMarkdown: React.FC = (props: StyledMarkdownProp pre: { component: (element: any) => { const { className } = element.children.props; - const chart = element.children?.props?.children || ""; + const content = element.children?.props?.children || ""; if (className === "lang-mermaid") { - console.log(`StyledMarkdown pre: ${className}`); - return ; + return ; + } + if (className === "lang-json") { + return + { + if (typeof (children) === "string" && children.match("\n")) { + return
{children}
+ } + }} + /> +
; } return
{element.children}
; },