'use client'; import React from 'react'; import { RAGResponse } from '@/lib/types'; import { ExternalLink, FileText, MapPin } from 'lucide-react'; import RBACBlock from './RBACBlock'; import GuardrailBanner from './GuardrailBanner'; interface ChatMessageProps { type: 'user' | 'assistant' | 'system'; content: string; timestamp: Date; response?: RAGResponse; } export default function ChatMessage({ type, content, timestamp, response }: ChatMessageProps) { const formatTime = (date: Date) => { return date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }); }; if (type === 'system') { return (
{content}
{formatTime(timestamp)}
{response.answer}
Semantic Route
{(response.route ?? '') .replace(/_/g, ' ') .replace(/route/i, '') .trim()}
Your Access
{source.document}
{formatTime(timestamp)}