2024-03-20 11:13:51 +08:00
|
|
|
import { useCallback } from 'react';
|
|
|
|
|
import { useDispatch } from 'umi';
|
2024-07-17 19:07:34 +08:00
|
|
|
import { useGetKnowledgeSearchParams } from './route-hook';
|
2024-03-20 11:13:51 +08:00
|
|
|
|
|
|
|
|
interface PayloadType {
|
|
|
|
|
doc_id: string;
|
|
|
|
|
keywords?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const useFetchChunkList = () => {
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const { documentId } = useGetKnowledgeSearchParams();
|
|
|
|
|
|
|
|
|
|
const fetchChunkList = useCallback(() => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'chunkModel/chunk_list',
|
|
|
|
|
payload: {
|
|
|
|
|
doc_id: documentId,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}, [dispatch, documentId]);
|
|
|
|
|
|
|
|
|
|
return fetchChunkList;
|
|
|
|
|
};
|