Fix: Improved knowledge base configuration and related logic #9869 (#10315)

### What problem does this PR solve?

Fix: Improved knowledge base configuration and related logic #9869
- Optimized the display logic of the Generate Log button to support
displaying completion time and task ID
- Implemented the ability to pause task generation and connect to the
data flow cancellation interface
- Fixed issues with type definitions and optional chaining calls in some
components
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-09-26 19:09:11 +08:00
committed by GitHub
parent c7efaab30e
commit 886d38620e
19 changed files with 374 additions and 231 deletions

View File

@ -45,11 +45,17 @@ const useFetchFileLogList = () => {
queryKey: [
'fileLogList',
knowledgeBaseId,
pagination.current,
pagination.pageSize,
pagination,
searchString,
active,
],
placeholderData: (previousData) => {
if (previousData === undefined) {
return { logs: [], total: 0 };
}
return previousData;
},
enabled: true,
queryFn: async () => {
const { data: res = {} } = await fetchFunc({
kb_id: knowledgeBaseId,
@ -73,6 +79,7 @@ const useFetchFileLogList = () => {
searchString,
handleInputChange: onInputChange,
pagination: { ...pagination, total: data?.total },
setPagination,
active,
setActive,
};

View File

@ -1,5 +1,6 @@
import SvgIcon from '@/components/svg-icon';
import { useIsDarkTheme } from '@/components/theme-provider';
import { useFetchDocumentList } from '@/hooks/use-document-request';
import { parseColorToRGBA } from '@/utils/common-util';
import { CircleQuestionMark } from 'lucide-react';
import { FC, useEffect, useMemo, useState } from 'react';
@ -90,6 +91,9 @@ const FileLogsPage: FC = () => {
});
const { data: topData } = useFetchOverviewTital();
const {
pagination: { total: fileTotal },
} = useFetchDocumentList();
console.log('topData --> ', topData);
useEffect(() => {
setTopAllData((prev) => {
@ -104,11 +108,24 @@ const FileLogsPage: FC = () => {
});
}, [topData]);
useEffect(() => {
setTopAllData((prev) => {
return {
...prev,
totalFiles: {
value: fileTotal || 0,
precent: 0,
},
};
});
}, [fileTotal]);
const {
data: tableOriginData,
searchString,
handleInputChange,
pagination,
setPagination,
active,
setActive,
} = useFetchFileLogList();
@ -131,6 +148,11 @@ const FileLogsPage: FC = () => {
};
const handlePaginationChange = (page: number, pageSize: number) => {
console.log('Pagination changed:', { page, pageSize });
setPagination({
...pagination,
page,
pageSize: pageSize,
});
};
const isDark = useIsDarkTheme();