import React, { useEffect, useState } from "react"; import Workspace from "../../models/workspace"; import LoadingChat from "./LoadingChat"; import ChatContainer from "./ChatContainer"; import paths from "../../utils/paths"; export default function WorkspaceChat({ loading, workspace }) { const [history, setHistory] = useState([]); const [loadingHistory, setLoadingHistory] = useState(true); useEffect(() => { async function getHistory() { if (loading) return; if (!workspace?.slug) { setLoadingHistory(false); return false; } const chatHistory = await Workspace.chatHistory(workspace.slug); setHistory(chatHistory); setLoadingHistory(false); } getHistory(); }, [workspace, loading]); if (loadingHistory) return ; if (!loading && !loadingHistory && !workspace) { return ( <> {loading === false && !workspace && (

Workspace not found!

It looks like a workspace by this name is not available.

Go back to homepage
)} ); } return ; }