mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-20 18:19:06 +08:00
### What problem does this PR solve? fix: remove unused libraries #1306 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
792a1a9d91
commit
022afbb39d
83
web/package-lock.json
generated
83
web/package-lock.json
generated
@ -28,10 +28,8 @@
|
||||
"lodash": "^4.17.21",
|
||||
"mammoth": "^1.7.2",
|
||||
"rc-tween-one": "^3.0.6",
|
||||
"react-chat-elements": "^12.0.13",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-i18next": "^14.0.0",
|
||||
"react-infinite-scroll-component": "^6.1.0",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-pdf-highlighter": "^6.1.0",
|
||||
"react-string-replace": "^1.1.1",
|
||||
@ -17724,11 +17722,6 @@
|
||||
"node": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/loaders.css": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/loaders.css/-/loaders.css-0.1.2.tgz",
|
||||
"integrity": "sha512-Rhowlq24ey1VOeor+3wYOt9+MjaxBOJm1u4KlQgNC3+0xJ0LS4wq4iG57D/BPzvuD/7HHDGQOWJ+81oR2EI9bQ=="
|
||||
},
|
||||
"node_modules/local-pkg": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.3.tgz",
|
||||
@ -20744,15 +20737,6 @@
|
||||
"resolved": "https://registry.npmmirror.com/process-warning/-/process-warning-1.0.0.tgz",
|
||||
"integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q=="
|
||||
},
|
||||
"node_modules/progressbar.js": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/progressbar.js/-/progressbar.js-1.1.1.tgz",
|
||||
"integrity": "sha512-FBsw3BKsUbb+hNeYfiP3xzvAAQrPi4DnGDw66bCmfuRCDLcslxyxv2GyYUdBSKFGSIBa73CUP5WMcl6F8AAXlw==",
|
||||
"dependencies": {
|
||||
"lodash.merge": "^4.6.2",
|
||||
"shifty": "^2.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prompts": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/prompts/-/prompts-2.4.2.tgz",
|
||||
@ -21626,22 +21610,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-chat-elements": {
|
||||
"version": "12.0.13",
|
||||
"resolved": "https://registry.npmmirror.com/react-chat-elements/-/react-chat-elements-12.0.13.tgz",
|
||||
"integrity": "sha512-Vu5x8kW4LPu8onKfz5vsuDwZsDhoQmTBHJdqKAhVsi42PCQ8KOfzHiDp0fPUJlinJZ/MTJTm69UAchpys4iSTQ==",
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.5",
|
||||
"progressbar.js": "^1.1.0",
|
||||
"react-icons": "^4.3.1",
|
||||
"react-spinkit": "^3.0.0",
|
||||
"timeago.js": "^4.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-copy-to-clipboard": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz",
|
||||
@ -22013,33 +21981,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-icons": {
|
||||
"version": "4.12.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-icons/-/react-icons-4.12.0.tgz",
|
||||
"integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/react-infinite-scroll-component": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-infinite-scroll-component/-/react-infinite-scroll-component-6.1.0.tgz",
|
||||
"integrity": "sha512-SQu5nCqy8DxQWpnUVLx7V7b7LcA37aM7tvoWjTLZp1dk6EJibM5/4EJKzOnl07/BsM1Y40sKLuqjCwwH/xV0TQ==",
|
||||
"dependencies": {
|
||||
"throttle-debounce": "^2.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-infinite-scroll-component/node_modules/throttle-debounce": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-2.3.0.tgz",
|
||||
"integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/react-is": {
|
||||
"version": "18.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-18.2.0.tgz",
|
||||
@ -22246,17 +22187,6 @@
|
||||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-spinkit": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-spinkit/-/react-spinkit-3.0.0.tgz",
|
||||
"integrity": "sha512-RrfGRPjqxHQiy7quPqhjPynTu0zobgQaZu1QYBMpJJ6pCSRRRK16EZMaxdE6fLVYFRJWpX/eGATWLMoVFFT5uQ==",
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.3",
|
||||
"loaders.css": "^0.1.2",
|
||||
"object-assign": "^4.1.0",
|
||||
"prop-types": "^15.5.8"
|
||||
}
|
||||
},
|
||||
"node_modules/react-string-replace": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/react-string-replace/-/react-string-replace-1.1.1.tgz",
|
||||
@ -23315,14 +23245,6 @@
|
||||
"integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/shifty": {
|
||||
"version": "2.20.4",
|
||||
"resolved": "https://registry.npmmirror.com/shifty/-/shifty-2.20.4.tgz",
|
||||
"integrity": "sha512-4Y0qRkg8ME5XN8yGNAwmFOmsIURGFKT9UQfNL6DDJQErYtN5HsjyoBuJn41ZQfTkuu2rIbRMn9qazjKsDpO2TA==",
|
||||
"optionalDependencies": {
|
||||
"fsevents": "^2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz",
|
||||
@ -24597,11 +24519,6 @@
|
||||
"node": ">=12.22"
|
||||
}
|
||||
},
|
||||
"node_modules/timeago.js": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/timeago.js/-/timeago.js-4.0.2.tgz",
|
||||
"integrity": "sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w=="
|
||||
},
|
||||
"node_modules/timers-browserify": {
|
||||
"version": "2.0.12",
|
||||
"resolved": "https://registry.npmmirror.com/timers-browserify/-/timers-browserify-2.0.12.tgz",
|
||||
|
@ -39,10 +39,8 @@
|
||||
"lodash": "^4.17.21",
|
||||
"mammoth": "^1.7.2",
|
||||
"rc-tween-one": "^3.0.6",
|
||||
"react-chat-elements": "^12.0.13",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-i18next": "^14.0.0",
|
||||
"react-infinite-scroll-component": "^6.1.0",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-pdf-highlighter": "^6.1.0",
|
||||
"react-string-replace": "^1.1.1",
|
||||
|
@ -4,11 +4,12 @@ import {
|
||||
IFileListRequestBody,
|
||||
} from '@/interfaces/request/file-manager';
|
||||
import fileManagerService from '@/services/file-manager-service';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { PaginationProps, UploadFile } from 'antd';
|
||||
import React, { useCallback } from 'react';
|
||||
import { useDispatch, useSearchParams, useSelector } from 'umi';
|
||||
import { useGetNextPagination, useHandleSearchChange } from './logic-hooks';
|
||||
import { useSetPaginationParams } from './route-hook';
|
||||
|
||||
export const useGetFolderId = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
@ -48,13 +49,19 @@ export const useFetchNextFileList = (): ResponseType<any> & IListResult => {
|
||||
const { data } = useQuery({
|
||||
queryKey: [
|
||||
'fetchFileList',
|
||||
id,
|
||||
pagination.current,
|
||||
pagination.pageSize,
|
||||
searchString,
|
||||
// pagination.current,
|
||||
// id,
|
||||
// pagination.pageSize,
|
||||
// searchString,
|
||||
{
|
||||
id,
|
||||
searchString,
|
||||
...pagination,
|
||||
},
|
||||
],
|
||||
initialData: {},
|
||||
queryFn: async () => {
|
||||
queryFn: async (params: any) => {
|
||||
console.info(params);
|
||||
const { data } = await fileManagerService.listFile({
|
||||
parent_id: id,
|
||||
keywords: searchString,
|
||||
@ -99,6 +106,26 @@ export const useRemoveFile = () => {
|
||||
return removeFile;
|
||||
};
|
||||
|
||||
export const useDeleteFile = () => {
|
||||
const { setPaginationParams } = useSetPaginationParams();
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: ['deleteFile'],
|
||||
mutationFn: async (params: { fileIds: string[]; parentId: string }) => {
|
||||
const { data } = await fileManagerService.removeFile(params);
|
||||
if (data.retcode === 0) {
|
||||
setPaginationParams(1);
|
||||
}
|
||||
return data?.data ?? {};
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, deleteFile: mutateAsync };
|
||||
};
|
||||
|
||||
export const useRenameFile = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
@ -23,6 +23,7 @@ import { useDispatch } from 'umi';
|
||||
import { useSetModalState, useTranslate } from './common-hooks';
|
||||
import { useSetDocumentParser } from './document-hooks';
|
||||
import { useFetchLlmList } from './llm-hooks';
|
||||
import { useSetPaginationParams } from './route-hook';
|
||||
import { useOneNamespaceEffectsLoading } from './store-hooks';
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
@ -101,23 +102,24 @@ export const useChangeLanguage = () => {
|
||||
|
||||
export const useGetNextPagination = () => {
|
||||
const { t } = useTranslate('common');
|
||||
const [{ page, pageSize }, setPagination] = useState({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const {
|
||||
setPaginationParams,
|
||||
page,
|
||||
size: pageSize,
|
||||
} = useSetPaginationParams();
|
||||
|
||||
const onPageChange: PaginationProps['onChange'] = useCallback(
|
||||
(pageNumber: number, pageSize: number) => {
|
||||
setPagination({ page: pageNumber, pageSize });
|
||||
setPaginationParams(pageNumber, pageSize);
|
||||
},
|
||||
[setPagination],
|
||||
[setPaginationParams],
|
||||
);
|
||||
|
||||
const setCurrentPagination = useCallback(
|
||||
(pagination: { page: number; pageSize?: number }) => {
|
||||
setPagination((p) => ({ ...p, ...pagination }));
|
||||
setPaginationParams(pagination.page, pagination.pageSize);
|
||||
},
|
||||
[setPagination],
|
||||
[setPaginationParams],
|
||||
);
|
||||
|
||||
const pagination: PaginationProps = useMemo(() => {
|
||||
|
@ -54,3 +54,37 @@ export const useNavigateToDataset = () => {
|
||||
navigate(`/knowledge/${KnowledgeRouteKey.Dataset}?id=${knowledgeId}`);
|
||||
}, [knowledgeId, navigate]);
|
||||
};
|
||||
|
||||
export const useGetPaginationParams = () => {
|
||||
const [currentQueryParameters] = useSearchParams();
|
||||
|
||||
return {
|
||||
page: currentQueryParameters.get('page') || 1,
|
||||
size: currentQueryParameters.get('size') || 10,
|
||||
};
|
||||
};
|
||||
|
||||
export const useSetPaginationParams = () => {
|
||||
const [queryParameters, setSearchParams] = useSearchParams();
|
||||
// const newQueryParameters: URLSearchParams = useMemo(
|
||||
// () => new URLSearchParams(queryParameters.toString()),
|
||||
// [queryParameters],
|
||||
// );
|
||||
|
||||
const setPaginationParams = useCallback(
|
||||
(page: number = 1, pageSize?: number) => {
|
||||
queryParameters.set('page', page.toString());
|
||||
if (pageSize) {
|
||||
queryParameters.set('size', pageSize.toString());
|
||||
}
|
||||
setSearchParams(queryParameters);
|
||||
},
|
||||
[setSearchParams, queryParameters],
|
||||
);
|
||||
|
||||
return {
|
||||
setPaginationParams,
|
||||
page: Number(queryParameters.get('page')) || 1,
|
||||
size: Number(queryParameters.get('size')) || 10,
|
||||
};
|
||||
};
|
||||
|
@ -1,45 +0,0 @@
|
||||
// RCE CSS
|
||||
import { MessageList } from 'react-chat-elements';
|
||||
import 'react-chat-elements/dist/main.css';
|
||||
|
||||
const ChatBox = () => {
|
||||
return (
|
||||
<div style={{ width: 600 }}>
|
||||
{/* <MessageBox
|
||||
position={'left'}
|
||||
type={'photo'}
|
||||
text={'react.svg'}
|
||||
data={{
|
||||
uri: 'https://facebook.github.io/react/img/logo.svg',
|
||||
status: {
|
||||
click: false,
|
||||
loading: 0,
|
||||
},
|
||||
}}
|
||||
/> */}
|
||||
|
||||
<MessageList
|
||||
// referance={messageListReferance}
|
||||
className="message-list"
|
||||
lockable={true}
|
||||
toBottomHeight={'100%'}
|
||||
dataSource={[
|
||||
{
|
||||
position: 'right',
|
||||
type: 'text',
|
||||
text: 'Lorem ipsum dolor sit amet',
|
||||
date: new Date(),
|
||||
},
|
||||
{
|
||||
position: 'left',
|
||||
type: 'text',
|
||||
text: 'Lorem ipsum dolor sit amet',
|
||||
date: new Date(),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChatBox;
|
@ -2,9 +2,9 @@ import { useSetModalState, useShowDeleteConfirm } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useConnectToKnowledge,
|
||||
useCreateFolder,
|
||||
useDeleteFile,
|
||||
useFetchFileList,
|
||||
useFetchParentFolderList,
|
||||
useRemoveFile,
|
||||
useRenameFile,
|
||||
useSelectFileList,
|
||||
useSelectParentFolderList,
|
||||
@ -215,14 +215,14 @@ export const useHandleDeleteFile = (
|
||||
fileIds: string[],
|
||||
setSelectedRowKeys: (keys: string[]) => void,
|
||||
) => {
|
||||
const removeDocument = useRemoveFile();
|
||||
const { deleteFile: removeDocument } = useDeleteFile();
|
||||
const showDeleteConfirm = useShowDeleteConfirm();
|
||||
const parentId = useGetFolderId();
|
||||
|
||||
const handleRemoveFile = () => {
|
||||
showDeleteConfirm({
|
||||
onOk: async () => {
|
||||
const retcode = await removeDocument(fileIds, parentId);
|
||||
const retcode = await removeDocument({ fileIds, parentId });
|
||||
if (retcode === 0) {
|
||||
setSelectedRowKeys([]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user