mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-27 21:56:35 +08:00
### What problem does this PR solve? Feat: Modify the data structure of the chunk in the conversation #3909 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
30 lines
765 B
TypeScript
30 lines
765 B
TypeScript
import { useSetModalState } from '@/hooks/common-hooks';
|
|
import { IReferenceChunk } from '@/interfaces/database/chat';
|
|
import { useCallback, useState } from 'react';
|
|
|
|
export const useClickDrawer = () => {
|
|
const { visible, showModal, hideModal } = useSetModalState();
|
|
const [selectedChunk, setSelectedChunk] = useState<IReferenceChunk>(
|
|
{} as IReferenceChunk,
|
|
);
|
|
const [documentId, setDocumentId] = useState<string>('');
|
|
|
|
const clickDocumentButton = useCallback(
|
|
(documentId: string, chunk: IReferenceChunk) => {
|
|
showModal();
|
|
setSelectedChunk(chunk);
|
|
setDocumentId(documentId);
|
|
},
|
|
[showModal],
|
|
);
|
|
|
|
return {
|
|
clickDocumentButton,
|
|
visible,
|
|
showModal,
|
|
hideModal,
|
|
selectedChunk,
|
|
documentId,
|
|
};
|
|
};
|