'use client'; import type { ReactNode } from 'react'; import { ChatStarters, ChatThread, Composer, type ChatMessageData, type FooterInfo, } from '@bitbaum/chatkit/react'; import { VOICE } from '@/components/forms/TextBox'; /** A source an answer was drawn from, shown under that answer. */ export interface ChatSourceItem { label: string; detail?: string; } /** A chat turn as botsmann keeps it: chatkit's message plus the sources it cites. */ export type EmbeddedChatMessage = ChatMessageData & { sources?: readonly ChatSourceItem[] }; interface EmbeddedChatProps { messages: readonly EmbeddedChatMessage[]; onSend: (text: string) => void; sending: boolean; placeholder: string; onRetry?: () => void; onStop?: () => void; /** Shown above the composer while the person has not asked anything yet. */ starters?: readonly string[]; /** Shown in place of the thread while there are no messages. */ empty?: ReactNode; /** Why sending is not possible right now (e.g. no document uploaded yet). */ sendBlockedReason?: string | null; /** A disclaimer or note above the composer. */ note?: ReactNode; /** Height and frame of the panel; the thread scrolls inside it. */ className?: string; renderFooter?: (message: EmbeddedChatMessage, info: FooterInfo) => ReactNode; } const Sources = ({ sources }: { sources: readonly ChatSourceItem[] }) => (
Sources: