diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 7fc3ec8..3a91d6e 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -20,7 +20,6 @@ if (!process.env.OPENAI_API_KEY) { export const POST = auth(async function POST(req: Request) { const json = await req.json() // @ts-ignore - console.log(req.auth) // todo fix types const messages = json.messages.map((m: any) => ({ content: m.content, role: m.role diff --git a/components/chat-message-actions.tsx b/components/chat-message-actions.tsx new file mode 100644 index 0000000..6593ae9 --- /dev/null +++ b/components/chat-message-actions.tsx @@ -0,0 +1,38 @@ +'use client' + +import { Button } from '@/components/ui/button' +import { IconCheck, IconCopy } from '@/components/ui/icons' +import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard' +import { cn } from '@/lib/utils' +import { type Message } from 'ai-connector' + +interface ChatMessageActionsProps extends React.ComponentProps<'div'> { + message: Message +} + +export function ChatMessageActions({ + message, + className, + ...props +}: ChatMessageActionsProps) { + const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 }) + + return ( +
+ {children}
+
+ )
}
-
- const match = /language-(\w+)/.exec(className || '')
-
- return !inline ? (
-
- {children}
-
- )
- }
- }}
- >
- {message.content}
-