quivr/frontend/lib/components/KnowledgeToFeedInput/KnowledgeToFeedInput.tsx
Zineb El Bachiri b64fc044c4
feat: knowledge tab add button (#1277)
* 🚧 🌐 knowledge traductions

* 🔥 replace useKnowledge hook

*  AddKnowledge in knowledge  tab

* 🚧 extract feedBrain in chat hook

* ♻️ use feedBrain method as a prop in KnowledgeToFeedInput

*  custom feedBrain for chat and brain management

*  add loader when deleting

* 🚑 remove chat after auto creation for each feed action

* 🚚 rename KnowledgeProvider into KnowledgeToFeedProvider
2023-09-28 15:39:30 +02:00

43 lines
1.3 KiB
TypeScript

import { useTranslation } from "react-i18next";
import Button from "@/lib/components/ui/Button";
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
import { FeedItems } from "./components";
import { Crawler } from "./components/Crawler";
import { FileUploader } from "./components/FileUploader";
export const KnowledgeToFeedInput = ({
feedBrain,
}: {
feedBrain: () => void;
}): JSX.Element => {
const { t } = useTranslation(["translation", "upload"]);
const { knowledgeToFeed } = useKnowledgeToFeedContext();
return (
<div className="px-20">
<div className="flex flex-row gap-10 justify-between items-center mt-5">
<FileUploader />
<span className="whitespace-nowrap ">
{`${t("and", { ns: "translation" })} / ${t("or", {
ns: "translation",
})}`}
</span>
<Crawler />
</div>
<FeedItems />
<div className="flex justify-center mt-5">
<Button
disabled={knowledgeToFeed.length === 0}
className="rounded-xl bg-purple-600 border-white"
onClick={() => void feedBrain()}
>
{t("feed_form_submit_button", { ns: "upload" })}
</Button>
</div>
</div>
);
};