diff --git a/src/components/ChatMessage.tsx b/src/components/ChatMessage.tsx index 49f3515..c6acea9 100644 --- a/src/components/ChatMessage.tsx +++ b/src/components/ChatMessage.tsx @@ -150,7 +150,21 @@ function MarkdownImage(props: React.ImgHTMLAttributes) { return ; } -const markdownComponents = { pre: CodeBlock, img: MarkdownImage }; +function MarkdownLink(props: React.AnchorHTMLAttributes) { + const { href, children, ...rest } = props; + const isExternal = href && /^https?:\/\//.test(href); + return ( + + {children} + + ); +} + +const markdownComponents = { pre: CodeBlock, img: MarkdownImage, a: MarkdownLink }; function renderTextBlocks(blocks: MessageBlock[]) { return getTextBlocks(blocks).map((block, i) => (