'use client'; import { Document } from '@langchain/core/documents'; import Navbar from './Navbar'; import Chat from './Chat'; import EmptyChat from './EmptyChat'; import { Settings } from 'lucide-react'; import Link from 'next/link'; import NextError from 'next/error'; import { useChat } from '@/lib/hooks/useChat'; export type Message = { messageId: string; chatId: string; createdAt: Date; content: string; role: 'user' | 'assistant'; suggestions?: string[]; sources?: Document[]; }; export interface File { fileName: string; fileExtension: string; fileId: string; } const ChatWindow = () => { const { hasError, isReady, notFound, messages } = useChat(); if (hasError) { return (

Failed to connect to the server. Please try again later.

); } return isReady ? ( notFound ? ( ) : (
{messages.length > 0 ? ( <> ) : ( )}
) ) : (
); }; export default ChatWindow;