'use client'; import Navbar from './Navbar'; import Chat from './Chat'; import EmptyChat from './EmptyChat'; import NextError from 'next/error'; import { useChat } from '@/lib/hooks/useChat'; import SettingsButtonMobile from './Settings/SettingsButtonMobile'; import { Block } from '@/lib/types'; import Loader from './ui/Loader'; export interface BaseMessage { chatId: string; messageId: string; createdAt: Date; } export interface Message extends BaseMessage { backendId: string; query: string; responseBlocks: Block[]; status: 'answering' | 'completed' | 'error'; } export interface File { fileName: string; fileExtension: string; fileId: string; } export interface Widget { widgetType: string; params: Record; } const ChatWindow = () => { const { hasError, notFound, messages, isReady } = useChat(); if (hasError) { return (

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

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