2023-06-11 00:59:16 +03:00
|
|
|
"use client";
|
2023-06-15 12:52:46 +03:00
|
|
|
|
2023-08-07 15:13:41 +03:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
2023-06-15 12:52:46 +03:00
|
|
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
2023-07-18 19:28:44 +03:00
|
|
|
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
2023-07-05 10:30:22 +03:00
|
|
|
import { ChatProvider } from "@/lib/context/ChatProvider";
|
2023-06-15 12:52:46 +03:00
|
|
|
|
2023-07-03 18:39:59 +03:00
|
|
|
import { ChatInput, ChatMessages } from "./components";
|
2023-06-11 00:59:16 +03:00
|
|
|
|
2023-07-05 19:33:18 +03:00
|
|
|
const SelectedChatPage = (): JSX.Element => {
|
2023-07-18 19:28:44 +03:00
|
|
|
const { currentBrain } = useBrainContext();
|
2023-08-07 15:13:41 +03:00
|
|
|
const { t } = useTranslation(['chat']);
|
2023-07-18 19:28:44 +03:00
|
|
|
|
2023-06-11 00:59:16 +03:00
|
|
|
return (
|
2023-07-05 10:30:22 +03:00
|
|
|
<main className="flex flex-col w-full pt-10" data-testid="chat-page">
|
2023-07-02 15:30:11 +03:00
|
|
|
<section className="flex flex-col flex-1 items-center w-full h-full min-h-[70vh]">
|
2023-06-11 00:59:16 +03:00
|
|
|
<PageHeading
|
2023-08-07 15:13:41 +03:00
|
|
|
title={t('title',{ brain: currentBrain?.name, ns: 'chat'})}
|
|
|
|
subtitle= {t('subtitle',{ ns: 'chat'})}
|
2023-06-11 00:59:16 +03:00
|
|
|
/>
|
2023-06-22 18:50:06 +03:00
|
|
|
<ChatProvider>
|
2023-06-27 12:28:09 +03:00
|
|
|
<div className="relative w-full flex flex-col flex-1 items-center">
|
|
|
|
<div className="flex-1 w-full flex flex-col items-center">
|
2023-06-22 18:50:06 +03:00
|
|
|
<ChatMessages />
|
|
|
|
</div>
|
|
|
|
<ChatInput />
|
2023-06-11 11:44:23 +03:00
|
|
|
</div>
|
2023-06-22 18:50:06 +03:00
|
|
|
</ChatProvider>
|
2023-06-11 00:59:16 +03:00
|
|
|
</section>
|
|
|
|
</main>
|
|
|
|
);
|
2023-07-05 10:30:22 +03:00
|
|
|
};
|
|
|
|
|
2023-07-05 19:33:18 +03:00
|
|
|
export default SelectedChatPage;
|