mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-25 08:06:48 +08:00
Features: Memory page rendering and other bug fixes (#11784)
### What problem does this PR solve? Features: Memory page rendering and other bug fixes - Rendering of the Memory list page - Rendering of the message list page in Memory - Fixed an issue where the empty state was incorrectly displayed when search criteria were applied - Added a web link for the API-Key - modifying the index_mode attribute of the Confluence data source. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Authorization } from '@/constants/authorization';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { LanguageTranslationMap } from '@/constants/common';
|
||||
import { Pagination } from '@/interfaces/common';
|
||||
import { ResponseType } from '@/interfaces/database/base';
|
||||
import {
|
||||
IAnswer,
|
||||
@ -12,7 +13,7 @@ import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import api from '@/utils/api';
|
||||
import { getAuthorization } from '@/utils/authorization-util';
|
||||
import { buildMessageUuid } from '@/utils/chat';
|
||||
import { PaginationProps, message } from 'antd';
|
||||
import { message } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import axios from 'axios';
|
||||
import { EventSourceParserStream } from 'eventsource-parser/stream';
|
||||
@ -71,8 +72,8 @@ export const useGetPaginationWithRouter = () => {
|
||||
size: pageSize,
|
||||
} = useSetPaginationParams();
|
||||
|
||||
const onPageChange: PaginationProps['onChange'] = useCallback(
|
||||
(pageNumber: number, pageSize: number) => {
|
||||
const onPageChange: Pagination['onChange'] = useCallback(
|
||||
(pageNumber: number, pageSize?: number) => {
|
||||
setPaginationParams(pageNumber, pageSize);
|
||||
},
|
||||
[setPaginationParams],
|
||||
@ -88,7 +89,7 @@ export const useGetPaginationWithRouter = () => {
|
||||
[setPaginationParams, pageSize],
|
||||
);
|
||||
|
||||
const pagination: PaginationProps = useMemo(() => {
|
||||
const pagination: Pagination = useMemo(() => {
|
||||
return {
|
||||
showQuickJumper: true,
|
||||
total: 0,
|
||||
@ -97,7 +98,7 @@ export const useGetPaginationWithRouter = () => {
|
||||
pageSize: pageSize,
|
||||
pageSizeOptions: [1, 2, 10, 20, 50, 100],
|
||||
onChange: onPageChange,
|
||||
showTotal: (total) => `${t('total')} ${total}`,
|
||||
showTotal: (total: number) => `${t('total')} ${total}`,
|
||||
};
|
||||
}, [t, onPageChange, page, pageSize]);
|
||||
|
||||
@ -109,7 +110,7 @@ export const useGetPaginationWithRouter = () => {
|
||||
|
||||
export const useHandleSearchChange = () => {
|
||||
const [searchString, setSearchString] = useState('');
|
||||
const { setPagination } = useGetPaginationWithRouter();
|
||||
const { pagination, setPagination } = useGetPaginationWithRouter();
|
||||
const handleInputChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||
const value = e.target.value;
|
||||
@ -119,21 +120,21 @@ export const useHandleSearchChange = () => {
|
||||
[setPagination],
|
||||
);
|
||||
|
||||
return { handleInputChange, searchString };
|
||||
return { handleInputChange, searchString, pagination, setPagination };
|
||||
};
|
||||
|
||||
export const useGetPagination = () => {
|
||||
const [pagination, setPagination] = useState({ page: 1, pageSize: 10 });
|
||||
const { t } = useTranslate('common');
|
||||
|
||||
const onPageChange: PaginationProps['onChange'] = useCallback(
|
||||
const onPageChange: Pagination['onChange'] = useCallback(
|
||||
(pageNumber: number, pageSize: number) => {
|
||||
setPagination({ page: pageNumber, pageSize });
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const currentPagination: PaginationProps = useMemo(() => {
|
||||
const currentPagination: Pagination = useMemo(() => {
|
||||
return {
|
||||
showQuickJumper: true,
|
||||
total: 0,
|
||||
@ -142,7 +143,7 @@ export const useGetPagination = () => {
|
||||
pageSize: pagination.pageSize,
|
||||
pageSizeOptions: [1, 2, 10, 20, 50, 100],
|
||||
onChange: onPageChange,
|
||||
showTotal: (total) => `${t('total')} ${total}`,
|
||||
showTotal: (total: number) => `${t('total')} ${total}`,
|
||||
};
|
||||
}, [t, onPageChange, pagination]);
|
||||
|
||||
|
||||
@ -25,6 +25,17 @@ export const useNavigatePage = () => {
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const navigateToMemoryList = useCallback(
|
||||
({ isCreate = false }: { isCreate?: boolean }) => {
|
||||
if (isCreate) {
|
||||
navigate(Routes.Memories + '?isCreate=true');
|
||||
} else {
|
||||
navigate(Routes.Memories);
|
||||
}
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const navigateToDataset = useCallback(
|
||||
(id: string) => () => {
|
||||
// navigate(`${Routes.DatasetBase}${Routes.DataSetOverview}/${id}`);
|
||||
@ -105,6 +116,12 @@ export const useNavigatePage = () => {
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
const navigateToMemory = useCallback(
|
||||
(id: string) => () => {
|
||||
navigate(`${Routes.Memory}${Routes.MemoryMessage}/${id}`);
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const navigateToChunkParsedResult = useCallback(
|
||||
(id: string, knowledgeId?: string) => () => {
|
||||
@ -196,5 +213,7 @@ export const useNavigatePage = () => {
|
||||
navigateToDataflowResult,
|
||||
navigateToDataFile,
|
||||
navigateToDataSourceDetail,
|
||||
navigateToMemory,
|
||||
navigateToMemoryList,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user