diff --git a/components/chat-message.tsx b/components/chat-message.tsx
index 9b9e3d6..e4a1af8 100644
--- a/components/chat-message.tsx
+++ b/components/chat-message.tsx
@@ -29,47 +29,47 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
{message.role === 'user' ? : }
-
- {children}
- },
- code({ node, inline, className, children, ...props }) {
- if (children.length) {
- if (children[0] == '▍') {
- return (
-
- ▍
-
- )
- }
-
- children[0] = (children[0] as string).replace('`▍`', '▍')
+ {children}
+ },
+ code({ node, inline, className, children, ...props }) {
+ if (children.length) {
+ if (children[0] == '▍') {
+ return (
+ ▍
+ )
}
- const match = /language-(\w+)/.exec(className || '')
+ children[0] = (children[0] as string).replace('`▍`', '▍')
+ }
- return !inline ? (
-
- ) : (
+ const match = /language-(\w+)/.exec(className || '')
+
+ if (inline) {
+ return (
{children}
)
}
- }}
- >
- {message.content}
-
-
+
+ return (
+
+ )
+ }
+ }}
+ >
+ {message.content}
+
diff --git a/components/ui/codeblock.tsx b/components/ui/codeblock.tsx
index cfa98d0..d8f0a4a 100644
--- a/components/ui/codeblock.tsx
+++ b/components/ui/codeblock.tsx
@@ -6,6 +6,7 @@ import { coldarkDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'
import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard'
import { IconCheck, IconCopy, IconDownload } from '@/components/ui/icons'
+import { Button } from '@/components/ui/button'
interface Props {
language: string
@@ -51,8 +52,10 @@ export const generateRandomString = (length: number, lowercase = false) => {
}
return lowercase ? result.toLowerCase() : result
}
+
const CodeBlock: FC