feat: n to 1 retrieval legacy (#6554)

This commit is contained in:
zxhlyh
2024-07-24 12:50:48 +08:00
committed by GitHub
parent e4bb943fe5
commit 6fe9aa69cc
35 changed files with 1329 additions and 249 deletions

View File

@@ -4,15 +4,17 @@ import React, { useCallback } from 'react'
import { useBoolean } from 'ahooks'
import {
RiDeleteBinLine,
RiEditLine,
} from '@remixicon/react'
import type { DataSet } from '@/models/datasets'
import { DataSourceType } from '@/models/datasets'
import { Settings01 } from '@/app/components/base/icons/src/vender/line/general'
import FileIcon from '@/app/components/base/file-icon'
import { Folder } from '@/app/components/base/icons/src/vender/solid/files'
import SettingsModal from '@/app/components/app/configuration/dataset-config/settings-modal'
import Drawer from '@/app/components/base/drawer'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import Badge from '@/app/components/base/badge'
import { useKnowledge } from '@/hooks/use-knowledge'
type Props = {
payload: DataSet
@@ -29,6 +31,7 @@ const DatasetItem: FC<Props> = ({
}) => {
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
const { formatIndexingTechniqueAndMethod } = useKnowledge()
const [isShowSettingsModal, {
setTrue: showSettingsModal,
@@ -62,7 +65,7 @@ const DatasetItem: FC<Props> = ({
className='flex items-center justify-center w-6 h-6 hover:bg-black/5 rounded-md cursor-pointer'
onClick={showSettingsModal}
>
<Settings01 className='w-4 h-4 text-gray-500' />
<RiEditLine className='w-4 h-4 text-gray-500' />
</div>
<div
className='flex items-center justify-center w-6 h-6 hover:bg-black/5 rounded-md cursor-pointer'
@@ -72,6 +75,10 @@ const DatasetItem: FC<Props> = ({
</div>
</div>
)}
<Badge
className='group-hover/dataset-item:hidden shrink-0'
text={formatIndexingTechniqueAndMethod(payload.indexing_technique, payload.retrieval_model_dict?.search_method)}
/>
{isShowSettingsModal && (
<Drawer isOpen={isShowSettingsModal} onClose={hideSettingsModal} footer={null} mask={isMobile} panelClassname='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'>