### What problem does this PR solve? Fix: Optimized knowledge base file parsing and display #9869 - Optimized the ChunkMethodDialog component logic and adjusted FormSchema validation rules - Updated the document information interface definition, adding pipeline_id, pipeline_name, and suffix fields - Refactored the ChunkResultBar component, removing filter-related logic and simplifying the input box and chunk creation functionality - Improved FormatPreserveEditor to support text mode switching (full/omitted) display control - Updated timeline node titles to more accurate semantic descriptions (e.g., character splitters) - Optimized the data flow result page structure and style, dynamically adjusting height and content display - Fixed the table sorting function on the dataset overview page and enhanced the display of task type icons and status mapping. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
import {
|
|
useGetPaginationWithRouter,
|
|
useHandleSearchChange,
|
|
} from '@/hooks/logic-hooks';
|
|
import kbService, {
|
|
listDataPipelineLogDocument,
|
|
listPipelineDatasetLogs,
|
|
} from '@/services/knowledge-service';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { useCallback, useState } from 'react';
|
|
import { useParams, useSearchParams } from 'umi';
|
|
import { LogTabs } from './dataset-common';
|
|
import { IFileLogList, IOverviewTital } from './interface';
|
|
|
|
const useFetchOverviewTital = () => {
|
|
const [searchParams] = useSearchParams();
|
|
const { id } = useParams();
|
|
const knowledgeBaseId = searchParams.get('id') || id;
|
|
const { data } = useQuery<IOverviewTital>({
|
|
queryKey: ['overviewTital'],
|
|
queryFn: async () => {
|
|
const { data: res = {} } = await kbService.getKnowledgeBasicInfo({
|
|
kb_id: knowledgeBaseId,
|
|
});
|
|
return res.data || [];
|
|
},
|
|
});
|
|
return { data };
|
|
};
|
|
|
|
const useFetchFileLogList = () => {
|
|
const [searchParams] = useSearchParams();
|
|
const { searchString, handleInputChange } = useHandleSearchChange();
|
|
const { pagination, setPagination } = useGetPaginationWithRouter();
|
|
const { id } = useParams();
|
|
const [active, setActive] = useState<(typeof LogTabs)[keyof typeof LogTabs]>(
|
|
LogTabs.FILE_LOGS,
|
|
);
|
|
const knowledgeBaseId = searchParams.get('id') || id;
|
|
const fetchFunc =
|
|
active === LogTabs.DATASET_LOGS
|
|
? listPipelineDatasetLogs
|
|
: listDataPipelineLogDocument;
|
|
const { data } = useQuery<IFileLogList>({
|
|
queryKey: [
|
|
'fileLogList',
|
|
knowledgeBaseId,
|
|
pagination.current,
|
|
pagination.pageSize,
|
|
searchString,
|
|
active,
|
|
],
|
|
queryFn: async () => {
|
|
const { data: res = {} } = await fetchFunc({
|
|
kb_id: knowledgeBaseId,
|
|
page: pagination.current,
|
|
page_size: pagination.pageSize,
|
|
keywords: searchString,
|
|
// order_by: '',
|
|
});
|
|
return res.data || [];
|
|
},
|
|
});
|
|
const onInputChange: React.ChangeEventHandler<HTMLInputElement> = useCallback(
|
|
(e) => {
|
|
setPagination({ page: 1 });
|
|
handleInputChange(e);
|
|
},
|
|
[handleInputChange, setPagination],
|
|
);
|
|
return {
|
|
data,
|
|
searchString,
|
|
handleInputChange: onInputChange,
|
|
pagination: { ...pagination, total: data?.total },
|
|
active,
|
|
setActive,
|
|
};
|
|
};
|
|
|
|
export { useFetchFileLogList, useFetchOverviewTital };
|