mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-17 11:21:35 +03:00
1ec736b357
* feat(brainSettings): add feed process instrcution to knowledge tab * feat: prevent default brain auto fetch * feat: prevent chat submision on submit button click * feat: remove unrelevant toast * feat: remove duplicated GA initialization * feat: add brain name in notifications * fix(test): update analytics import path * refactor: move ChatsList utils to ChatsList directory * fix(test): update chatlist tests
62 lines
2.3 KiB
TypeScript
62 lines
2.3 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { AiOutlineLoading3Quarters } from "react-icons/ai";
|
|
|
|
import { ChatInput, KnowledgeToFeed } from "./components";
|
|
import { useActionBar } from "./hooks/useActionBar";
|
|
import { useKnowledgeUploader } from "./hooks/useKnowledgeUploader";
|
|
|
|
export const ActionsBar = (): JSX.Element => {
|
|
const {
|
|
shouldDisplayUploadCard,
|
|
setShouldDisplayUploadCard,
|
|
hasPendingRequests,
|
|
setHasPendingRequests,
|
|
} = useActionBar();
|
|
|
|
const { addContent, contents, feedBrain, removeContent } =
|
|
useKnowledgeUploader({
|
|
setHasPendingRequests,
|
|
setShouldDisplayUploadCard,
|
|
});
|
|
|
|
const { t } = useTranslation(["chat"]);
|
|
|
|
return (
|
|
<>
|
|
{hasPendingRequests && (
|
|
<div className="flex mt-1 flex-col md:flex-row w-full shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-2 md:p-6 pl-6">
|
|
<div className="flex flex-1 items-center mb-2 md:mb-0">
|
|
<span className="text-sm md:text-1xl">{t("feedingBrain")}</span>
|
|
</div>
|
|
<AiOutlineLoading3Quarters className="animate-spin text-2xl md:text-3xl self-center" />
|
|
</div>
|
|
)}
|
|
|
|
<div
|
|
className={
|
|
shouldDisplayUploadCard ? "h-full flex flex-col flex-auto" : ""
|
|
}
|
|
>
|
|
{shouldDisplayUploadCard && (
|
|
<div className="flex flex-1 overflow-y-scroll shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-4 md:p-6">
|
|
<KnowledgeToFeed
|
|
onClose={() => setShouldDisplayUploadCard(false)}
|
|
contents={contents}
|
|
addContent={addContent}
|
|
removeContent={removeContent}
|
|
/>
|
|
</div>
|
|
)}
|
|
<div className="flex mt-1 flex-col w-full shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-4 md:p-6">
|
|
<ChatInput
|
|
shouldDisplayUploadCard={shouldDisplayUploadCard}
|
|
setShouldDisplayUploadCard={setShouldDisplayUploadCard}
|
|
feedBrain={() => void feedBrain()}
|
|
hasContentToFeedBrain={contents.length > 0}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|