import remarkGfm from 'remark-gfm' import remarkMath from 'remark-math' import supersub from 'remark-supersub' import remarkBreaks from 'remark-breaks' import { cn } from '@/lib/utils' import { CodeBlock } from '@/components/ui/codeblock' import { MemoizedReactMarkdown } from '@/components/markdown' import { LearnMore } from './learn-more' import { ChatMessageModel } from '@/lib/bots/bing/types' import { useEffect } from 'react' import { TurnCounter } from './turn-counter' export interface ChatMessageProps { message: ChatMessageModel } export function ChatMessage({ message, ...props }: ChatMessageProps) { useEffect(() => { if (document.body.scrollHeight - window.innerHeight - window.scrollY - 200 < 0) { window.scrollBy(0, 200) } }, [message.text]) return message.text ? (
{obj.alt} } } catch (e) { } return {obj.alt} }, p({ children }) { 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 ( ) } }} > {message.text}
{message.author === 'bot' && } {message.author === 'bot' && }
) : null }