dify/web/app/components/datasets/documents/detail/context.ts
Coding On Star 581b62cf01
feat: add automated tests for pipeline setting (#29478)
Co-authored-by: CodingOnStar <hanxujiang@dify.ai>
2025-12-17 10:26:58 +08:00

16 lines
491 B
TypeScript

import type { ChunkingMode, ParentMode } from '@/models/datasets'
import { createContext, useContextSelector } from 'use-context-selector'
export type DocumentContextValue = {
datasetId?: string
documentId?: string
docForm?: ChunkingMode
parentMode?: ParentMode
}
export const DocumentContext = createContext<DocumentContextValue>({})
export const useDocumentContext = (selector: (value: DocumentContextValue) => any) => {
return useContextSelector(DocumentContext, selector)
}