- + {t('knowledgeDetails.testResults')} + + {t('common.total')}: {data.total} + ))} - - - > )} {!data.chunks?.length && !loading && ( diff --git a/web/src/pages/next-search/hooks.ts b/web/src/pages/next-search/hooks.ts index a165ed24ba..b3e1e69f27 100644 --- a/web/src/pages/next-search/hooks.ts +++ b/web/src/pages/next-search/hooks.ts @@ -148,10 +148,10 @@ export const useTestChunkRetrieval = ( gcTime: 0, mutationFn: async (values: any) => { const { data } = await retrievalTestFunc({ - ...values, - kb_id: values.kb_id ?? knowledgeBaseId, page, size: pageSize, + ...values, + kb_id: values.kb_id ?? knowledgeBaseId, tenant_id: tenantId, }); if (data.code === 0) { @@ -199,11 +199,10 @@ export const useTestChunkAllRetrieval = ( gcTime: 0, mutationFn: async (values: any) => { const { data } = await retrievalTestFunc({ - ...values, - kb_id: values.kb_id ?? knowledgeBaseId, - doc_ids: [], page, size: pageSize, + ...values, + kb_id: values.kb_id ?? knowledgeBaseId, tenant_id: tenantId, }); if (data.code === 0) { @@ -324,14 +323,12 @@ export const useSendQuestion = ( const [searchStr, setSearchStr] = useState(''); const [isFirstRender, setIsFirstRender] = useState(true); const [selectedDocumentIds, setSelectedDocumentIds] = useState([]); - - const { pagination, setPagination } = useGetPaginationWithRouter(); + const [pageSize, setPageSize] = useState(10); const sendQuestion = useCallback( (question: string, enableAI: boolean = true) => { const q = trim(question); if (isEmpty(q)) return; - setPagination({ page: 1 }); setIsFirstRender(false); setCurrentAnswer({} as IAnswer); if (enableAI) { @@ -352,7 +349,7 @@ export const useSendQuestion = ( highlight: true, question: q, page: 1, - size: pagination.pageSize, + size: pageSize, search_id: searchId, }); @@ -366,8 +363,7 @@ export const useSendQuestion = ( askUrl, kbIds, fetchRelatedQuestions, - setPagination, - pagination.pageSize, + pageSize, tenantId, searchId, sharedId, @@ -455,6 +451,8 @@ export const useSendQuestion = ( selectedDocumentIds, isSearchStrEmpty: isEmpty(trim(searchStr)), stopOutputMessage, + pageSize, + setPageSize, }; }; @@ -479,6 +477,8 @@ export const useSearching = ({ isSearchStrEmpty, setSearchStr, stopOutputMessage, + pageSize, + setPageSize, } = useSendQuestion( searchData.search_config.kb_ids, tenantId as string, @@ -537,14 +537,15 @@ export const useSearching = ({ ], ); - const { pagination, setPagination } = useGetPaginationWithRouter(); - const onChange = (pageNumber: number, pageSize: number) => { - setPagination({ page: pageNumber, pageSize }); - handleTestChunk(selectedDocumentIds, pageNumber, pageSize); - }; + const handleTopChange = useCallback( + (size: number) => { + setPageSize(size); + handleTestChunk(selectedDocumentIds, 1, size); + }, + [handleTestChunk, selectedDocumentIds, setPageSize], + ); return { - sendQuestion, handleClickRelatedQuestion, handleSearchStrChange, handleTestChunk, @@ -573,8 +574,8 @@ export const useSearching = ({ chunks, total, handleSearch, - pagination, - onChange, + pageSize, + handleTopChange, }; }; diff --git a/web/src/pages/next-search/search-view.tsx b/web/src/pages/next-search/search-view.tsx index 9b89cbf73b..3325fadaaa 100644 --- a/web/src/pages/next-search/search-view.tsx +++ b/web/src/pages/next-search/search-view.tsx @@ -5,13 +5,13 @@ import { FileIcon } from '@/components/icon-font'; import { ImageWithPopover } from '@/components/image'; import { Input } from '@/components/originui/input'; import { SkeletonCard } from '@/components/skeleton-card'; +import { TopSelect } from '@/components/top-select'; import { Button } from '@/components/ui/button'; import { Popover, PopoverContent, PopoverTrigger, } from '@/components/ui/popover'; -import { RAGFlowPagination } from '@/components/ui/ragflow-pagination'; import { IReference } from '@/interfaces/database/chat'; import { cn } from '@/lib/utils'; import { isEmpty } from 'lodash'; @@ -61,8 +61,8 @@ export default function SearchingView({ chunks, total, handleSearch, - pagination, - onChange, + pageSize, + handleTopChange, showEmbedLogo, }: ISearchReturnProps & { setIsSearching?: Dispatch>; @@ -183,8 +183,8 @@ export default function SearchingView({ )} {/* retrieval documents */} {!isSearchStrEmpty && !sendingLoading && ( - <> - + + - {/* */} - > + + + + + {t('common.total')}: {total} + + )} {chunks?.length > 0 && ( @@ -293,17 +301,6 @@ export default function SearchingView({ )} - {total > 0 && ( - - - - )} - {!mindMapVisible && !isFirstRender && !isSearchStrEmpty &&