You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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