File size: 548 Bytes
e55650e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { useCallback } from 'react';
import { useDispatch } from 'umi';
import { useGetKnowledgeSearchParams } from './routeHook';

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;
};