mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-14 20:41:21 +08:00
581b62cf01
Co-authored-by: CodingOnStar <hanxujiang@dify.ai>
16 lines
491 B
TypeScript
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)
|
|
}
|