From a14c033da56a711a101c5ed5c314cc5bcf885289 Mon Sep 17 00:00:00 2001
From: Mamadou DICKO <63923024+mamadoudicko@users.noreply.github.com>
Date: Thu, 7 Sep 2023 10:15:19 +0200
Subject: [PATCH] feat: allow user to chat while feed process is pending
(#1120)
* feat: remove 'ux-upload' feature flag
* feat: publish a message at the end of feed process
* feat: hide feed card during feed process
---
.../components/ActionsBar/ActionsBar.tsx | 1 +
.../ActionsBar/components/ChatInput/index.tsx | 14 +++++++----
.../ActionsBar/hooks/useKnowledgeUploader.ts | 24 +++++++++++++------
frontend/public/locales/en/upload.json | 3 ++-
frontend/public/locales/es/upload.json | 3 ++-
frontend/public/locales/fr/upload.json | 3 ++-
frontend/public/locales/pt-br/upload.json | 3 ++-
frontend/public/locales/ru/upload.json | 3 ++-
frontend/public/locales/zh-cn/upload.json | 3 ++-
9 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/frontend/app/chat/[chatId]/components/ActionsBar/ActionsBar.tsx b/frontend/app/chat/[chatId]/components/ActionsBar/ActionsBar.tsx
index fab2ac8d4cba..512e13f66e05 100644
--- a/frontend/app/chat/[chatId]/components/ActionsBar/ActionsBar.tsx
+++ b/frontend/app/chat/[chatId]/components/ActionsBar/ActionsBar.tsx
@@ -29,6 +29,7 @@ export const ActionsBar = (): JSX.Element => {
shouldDisplayUploadCard={shouldDisplayUploadCard}
setShouldDisplayUploadCard={setShouldDisplayUploadCard}
feedBrain={() => void feedBrain()}
+ hasContentToFeedBrain={contents.length > 0}
/>
diff --git a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/index.tsx b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/index.tsx
index e951b1777807..c7ac005b8f6e 100644
--- a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/index.tsx
+++ b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/index.tsx
@@ -1,5 +1,5 @@
+/* eslint-disable max-lines */
"use client";
-import { useFeature } from "@growthbook/growthbook-react";
import { useTranslation } from "react-i18next";
import { MdAddCircle, MdSend } from "react-icons/md";
@@ -15,17 +15,18 @@ type ChatInputProps = {
shouldDisplayUploadCard: boolean;
feedBrain: () => void;
setShouldDisplayUploadCard: (shouldDisplayUploadCard: boolean) => void;
+ hasContentToFeedBrain: boolean;
};
export const ChatInput = ({
shouldDisplayUploadCard,
feedBrain,
setShouldDisplayUploadCard,
+ hasContentToFeedBrain,
}: ChatInputProps): JSX.Element => {
const { setMessage, submitQuestion, chatId, generatingAnswer, message } =
useChatInput();
const { t } = useTranslation(["chat"]);
- const shouldDisplayUploadButton = useFeature("ux-upload").on;
const { currentBrainId } = useBrainContext();
return (
@@ -37,7 +38,7 @@ export const ChatInput = ({
}}
className="sticky flex items-star bottom-0 bg-white dark:bg-black w-full flex justify-center gap-2 z-20"
>
- {!shouldDisplayUploadCard && shouldDisplayUploadButton && (
+ {!shouldDisplayUploadCard && (