Skip to content

Commit

Permalink
fix: dataset select check (#3048)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Oct 31, 2024
1 parent bc171db commit 4061b11
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions projects/app/src/components/core/app/DatasetSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const DatasetSelectModal = ({
)
};
}, [datasets, allDatasets, selectedDatasets]);
const activeVectorModel = allDatasets.find(
(dataset) => dataset._id === selectedDatasets[0]?.datasetId
)?.vectorModel?.model;

return (
<DatasetSelectContainer
Expand Down Expand Up @@ -141,11 +144,7 @@ export const DatasetSelectModal = ({
if (item.type === DatasetTypeEnum.folder) {
setParentId(item._id);
} else {
const vectorModel = datasets.find(
(dataset) => dataset._id === selectedDatasets[0]?.datasetId
)?.vectorModel?.model;

if (vectorModel && vectorModel !== item.vectorModel.model) {
if (activeVectorModel && activeVectorModel !== item.vectorModel.model) {
return toast({
status: 'warning',
title: t('common:dataset.Select Dataset Tips')
Expand All @@ -168,13 +167,20 @@ export const DatasetSelectModal = ({
{item.name}
</Box>
</Flex>
<Flex justifyContent={'flex-end'} alignItems={'center'} fontSize={'sm'}>
<Flex
justifyContent={'flex-end'}
alignItems={'center'}
fontSize={'sm'}
color={
activeVectorModel === item.vectorModel.name ? 'primary.600' : 'myGray.500'
}
>
{item.type === DatasetTypeEnum.folder ? (
<Box color={'myGray.500'}>{t('common:Folder')}</Box>
) : (
<>
<MyIcon mr={1} name="kbTest" w={'12px'} />
<Box color={'myGray.500'}>{item.vectorModel.name}</Box>
<Box>{item.vectorModel.name}</Box>
</>
)}
</Flex>
Expand Down

0 comments on commit 4061b11

Please sign in to comment.