Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

message.tsx

18 lines528 Bytes

1import type { MessageProps } from '@tanstack/ai-react/ui'
2import { Message, MessageAvatar, MessageContent } from '@/components/ai/message'
3import type { chatOptions } from '@/chat/options'
4​
5export function ChatMessage({
6 message,
7 Parts,
8}: MessageProps<typeof chatOptions>) {
9 const from = message.role === 'user' ? 'user' : 'assistant'
10 return (
11 <Message from={from}>
12 <MessageAvatar name={from === 'user' ? 'You' : 'Desk'} />
13 <MessageContent>
14 <Parts />
15 </MessageContent>
16 </Message>
17 )