Skip to content

Commit

Permalink
🐛 fix: feature flag knowledge_base doesn't affect ActionBar (lobehu…
Browse files Browse the repository at this point in the history
…b#3609)

* 🐛 fix: Feature flag `knoeledge_base` doesn't affect ActionBar

* 🐛 fix: Feature flag `knoeledge_base` doesn't affect ActionBar
  • Loading branch information
zhuozhiyongde authored Aug 26, 2024
1 parent d1d0350 commit 1a5286b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/features/ChatInput/ActionBar/Knowledge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 = (
<DropdownMenu>
<ActionIcon
Expand Down
6 changes: 5 additions & 1 deletion src/features/ChatInput/ActionBar/Upload/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { isServerMode } from '@/const/version';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';

import ClientMode from './ClientMode';
import ServerMode from './ServerMode';

const Upload = isServerMode ? ServerMode : ClientMode;
const Upload = () => {
const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);
return isServerMode && enableKnowledgeBase ? <ServerMode /> : <ClientMode />;
};

export default Upload;

0 comments on commit 1a5286b

Please sign in to comment.