import { useState } from "react"; import { useChatCompletion } from "../hooks/useChatCompletion"; import { useChatSettings } from "../hooks/useChatSettings"; import { useUISettings } from "../hooks/useUISettings"; import ChatSettings from "./ChatSettings"; import LoadingIndicator from "./LoadingIndicator"; import MessageInput from "./MessageInput"; import MessagePair from "./MessagePair"; import OAuthLogin from "./OAuthLogin"; import TypingMessage from "./TypingMessage"; import UISettings from "./UISettings"; export default function ChatInterface() { const [hfClient, setHFClient] = useState(null); const [chatHistory, setChatHistory] = useState([]); const [chatSettings, setChatSettings] = useChatSettings(); const [uiSettings, setUISettings] = useUISettings(); const { sendMessage, isLoading, typingMessage, error } = useChatCompletion( hfClient, chatSettings, uiSettings, (newPair) => setChatHistory([newPair, ...chatHistory]) ); const handleMessageSend = async (message) => { sendMessage(message); }; const handleHFClientReady = (client) => { setHFClient(client); }; return (