mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Interface integration for the file log page in the overview - Support for selecting data pipeline parsing types - Use the RunningStatus enumeration instead of numeric status - Obtain and display data pipeline file log details - Replace existing mock data with new interface data on the page - Link the file log list to the real data source - Optimize log information display - Fixed a typo in the field name "pipeline_id" → "pipeline_id" ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { useSetModalState } from '@/hooks/common-hooks';
|
|
import { useSetDocumentParser } from '@/hooks/use-document-request';
|
|
import { IDocumentInfo } from '@/interfaces/database/document';
|
|
import { IChangeParserRequestBody } from '@/interfaces/request/document';
|
|
import { useCallback, useState } from 'react';
|
|
|
|
export const useChangeDocumentParser = () => {
|
|
const { setDocumentParser, loading } = useSetDocumentParser();
|
|
const [record, setRecord] = useState<IDocumentInfo>({} as IDocumentInfo);
|
|
|
|
const {
|
|
visible: changeParserVisible,
|
|
hideModal: hideChangeParserModal,
|
|
showModal: showChangeParserModal,
|
|
} = useSetModalState();
|
|
|
|
const onChangeParserOk = useCallback(
|
|
async (parserConfigInfo: IChangeParserRequestBody) => {
|
|
if (record?.id) {
|
|
const ret = await setDocumentParser({
|
|
parserId: parserConfigInfo.parser_id,
|
|
pipelineId: parserConfigInfo.pipeline_id,
|
|
documentId: record?.id,
|
|
parserConfig: parserConfigInfo.parser_config,
|
|
});
|
|
if (ret === 0) {
|
|
hideChangeParserModal();
|
|
}
|
|
}
|
|
},
|
|
[record?.id, setDocumentParser, hideChangeParserModal],
|
|
);
|
|
|
|
const handleShowChangeParserModal = useCallback(
|
|
(row: IDocumentInfo) => {
|
|
setRecord(row);
|
|
showChangeParserModal();
|
|
},
|
|
[showChangeParserModal],
|
|
);
|
|
|
|
return {
|
|
changeParserLoading: loading,
|
|
onChangeParserOk,
|
|
changeParserVisible,
|
|
hideChangeParserModal,
|
|
showChangeParserModal: handleShowChangeParserModal,
|
|
changeParserRecord: record,
|
|
};
|
|
};
|
|
|
|
export type UseChangeDocumentParserShowType = Pick<
|
|
ReturnType<typeof useChangeDocumentParser>,
|
|
'showChangeParserModal'
|
|
>;
|