import type { Message } from '../../types'; // Check if content is a quota error message function isQuotaError(content: string): boolean { return content.includes('Rate limit exceeded') || content.includes('Token limit exceeded') || content.includes('Please wait before sending another message') || content.includes('try again after'); } interface MessageBubbleProps { message: Message; isLastMessageStreaming: boolean; onSourceClick: (filename: string, content: string, chunkIndex: number) => void; } export function MessageBubble({ message, isLastMessageStreaming, onSourceClick, }: MessageBubbleProps) { const isQuota = message.role === 'assistant' && isQuotaError(message.content); return (
{message.content || (isLastMessageStreaming ? '▮' : '')}
{message.role === 'assistant' && message.sources && message.sources.length > 0 && (
Sources:
{message.sources.map((source, idx) => ( ))}
)}
); }