mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
21 lines
485 B
TypeScript
21 lines
485 B
TypeScript
|
'use client'
|
||
|
|
||
|
import { createContext, useContext } from 'use-context-selector'
|
||
|
import type { DataSet } from '@/models/datasets'
|
||
|
|
||
|
export type DatasetsContextValue = {
|
||
|
datasets: DataSet[]
|
||
|
mutateDatasets: () => void
|
||
|
currentDataset?: DataSet
|
||
|
}
|
||
|
|
||
|
const DatasetsContext = createContext<DatasetsContextValue>({
|
||
|
datasets: [],
|
||
|
mutateDatasets: () => {},
|
||
|
currentDataset: undefined
|
||
|
})
|
||
|
|
||
|
export const useDatasetsContext = () => useContext(DatasetsContext)
|
||
|
|
||
|
export default DatasetsContext
|