'use client' import { IconOpenAI, IconUser } from '../ui/icons' import { cn } from '@/lib/utils' import { spinner } from './spinner' import { CodeBlock } from '../ui/codeblock' import { MemoizedReactMarkdown } from '../markdown' import remarkGfm from 'remark-gfm' import remarkMath from 'remark-math' import { StreamableValue } from '@aigxion/isdk/rsc' import { useStreamableText } from '@/lib/hooks/use-streamable-text' // Different types of message bubbles. export function UserMessage({ children }: { children: React.ReactNode }) { return (
{children}
) } export function BotMessage({ content, className }: { content: string | StreamableValue className?: string }) { const text = useStreamableText(content) return (
{children}

}, code({ node, inline, className, children, ...props }) { if (children.length) { if (children[0] == '▍') { return ( ) } children[0] = (children[0] as string).replace('`▍`', '▍') } const match = /language-(\w+)/.exec(className || '') if (inline) { return ( {children} ) } return ( ) } }} > {text}
) } export function BotCard({ children, showAvatar = true }: { children: React.ReactNode showAvatar?: boolean }) { return (
{children}
) } export function SystemMessage({ children }: { children: React.ReactNode }) { return (
{children}
) } export function SpinnerMessage() { return (
{spinner}
) }