From 1a5286b2f14c7868fd988c5d0280823741eee709 Mon Sep 17 00:00:00 2001 From: Arthals <36695271+zhuozhiyongde@users.noreply.github.com> Date: Tue, 27 Aug 2024 00:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20feature=20flag=20`knowled?= =?UTF-8?q?ge=5Fbase`=20doesn't=20affect=20ActionBar=20(#3609)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 fix: Feature flag `knoeledge_base` doesn't affect ActionBar * 🐛 fix: Feature flag `knoeledge_base` doesn't affect ActionBar --- src/features/ChatInput/ActionBar/Knowledge/index.tsx | 7 +++++++ src/features/ChatInput/ActionBar/Upload/index.tsx | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/features/ChatInput/ActionBar/Knowledge/index.tsx b/src/features/ChatInput/ActionBar/Knowledge/index.tsx index 1609db7e9ff5..a4e2f712cdaa 100644 --- a/src/features/ChatInput/ActionBar/Knowledge/index.tsx +++ b/src/features/ChatInput/ActionBar/Knowledge/index.tsx @@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'; import TipGuide from '@/components/TipGuide'; import { isServerMode } from '@/const/version'; +import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; import { useUserStore } from '@/store/user'; import { preferenceSelectors } from '@/store/user/selectors'; @@ -15,11 +16,17 @@ const enableKnowledge = isServerMode; const Knowledge = memo(() => { const { t } = useTranslation('chat'); + const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors); + const [showTip, updateGuideState] = useUserStore((s) => [ preferenceSelectors.showUploadFileInKnowledgeBaseTip(s), s.updateGuideState, ]); + if (!enableKnowledgeBase) { + return null; + } + const content = ( { + const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors); + return isServerMode && enableKnowledgeBase ? : ; +}; export default Upload;