From 0d94db43313694891762b8edb4a34be5e0e67fc2 Mon Sep 17 00:00:00 2001
From: Archer <545436317@qq.com>
Date: Wed, 20 Sep 2023 11:43:49 +0800
Subject: [PATCH] fix: ts and default dataset (#329)
---
.../AdEdit/components/Nodes/NodeKbSearch.tsx | 15 +++++++------
.../app/detail/components/BasicEdit/index.tsx | 21 +++++++++++--------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeKbSearch.tsx b/client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeKbSearch.tsx
index aa388cc55590..4cd8ea536265 100644
--- a/client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeKbSearch.tsx
+++ b/client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeKbSearch.tsx
@@ -21,7 +21,7 @@ const KBSelect = ({
onChange: (e: SelectedKbType) => void;
}) => {
const theme = useTheme();
- const { datasets, loadAllDatasets } = useDatasetStore();
+ const { allDatasets, loadAllDatasets } = useDatasetStore();
const {
isOpen: isOpenKbSelect,
onOpen: onOpenKbSelect,
@@ -29,8 +29,8 @@ const KBSelect = ({
} = useDisclosure();
const showKbList = useMemo(
- () => datasets.filter((item) => activeKbs.find((kb) => kb.kbId === item._id)),
- [datasets, activeKbs]
+ () => allDatasets.filter((item) => activeKbs.find((kb) => kb.kbId === item._id)),
+ [allDatasets, activeKbs]
);
useQuery(['loadAllDatasets'], loadAllDatasets);
@@ -57,9 +57,12 @@ const KBSelect = ({
))}
- {isOpenKbSelect && (
-
- )}
+
>
);
};
diff --git a/client/src/pages/app/detail/components/BasicEdit/index.tsx b/client/src/pages/app/detail/components/BasicEdit/index.tsx
index 4562729ba27d..67365c741599 100644
--- a/client/src/pages/app/detail/components/BasicEdit/index.tsx
+++ b/client/src/pages/app/detail/components/BasicEdit/index.tsx
@@ -564,15 +564,18 @@ const Settings = ({ appId }: { appId: string }) => {
defaultData={getValues('chatModel')}
/>
)}
- ({
- kbId: item._id,
- vectorModel: item.vectorModel
- }))}
- onClose={onCloseKbSelect}
- onChange={replaceKbList}
- />
+ {isOpenKbSelect && (
+ ({
+ kbId: item._id,
+ vectorModel: item.vectorModel
+ }))}
+ onClose={onCloseKbSelect}
+ onChange={replaceKbList}
+ />
+ )}
+
{isOpenKbParams && (