Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

512 B
Raw Blame
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
  canEdit?: boolean
}

export const DocumentContext = createContext<DocumentContextValue>({})

export const useDocumentContext = <T>(selector: (value: DocumentContextValue) => T) => {
  return useContextSelector(DocumentContext, selector)
}