演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
512 B
TypeScript
17 lines
512 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
|
|
canEdit?: boolean
|
|
}
|
|
|
|
export const DocumentContext = createContext<DocumentContextValue>({})
|
|
|
|
export const useDocumentContext = <T>(selector: (value: DocumentContextValue) => T) => {
|
|
return useContextSelector(DocumentContext, selector)
|
|
}
|