您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

chunk-hooks.ts 549B

123456789101112131415161718192021222324
  1. import { useCallback } from 'react';
  2. import { useDispatch } from 'umi';
  3. import { useGetKnowledgeSearchParams } from './route-hook';
  4. interface PayloadType {
  5. doc_id: string;
  6. keywords?: string;
  7. }
  8. export const useFetchChunkList = () => {
  9. const dispatch = useDispatch();
  10. const { documentId } = useGetKnowledgeSearchParams();
  11. const fetchChunkList = useCallback(() => {
  12. dispatch({
  13. type: 'chunkModel/chunk_list',
  14. payload: {
  15. doc_id: documentId,
  16. },
  17. });
  18. }, [dispatch, documentId]);
  19. return fetchChunkList;
  20. };