mirror of
https://github.com/langgenius/dify.git
synced 2025-07-16 05:35:09 +00:00
20 lines
520 B
TypeScript
20 lines
520 B
TypeScript
import {
|
|
useCallback,
|
|
useRef,
|
|
} from 'react'
|
|
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
|
import type { KnowledgeBaseNodeType } from '../types'
|
|
|
|
export const useConfig = (id: string, payload: KnowledgeBaseNodeType) => {
|
|
const {
|
|
inputs,
|
|
setInputs,
|
|
} = useNodeCrud(id, payload)
|
|
const ref = useRef(inputs)
|
|
|
|
const handleInputsChange = useCallback((newInputs: KnowledgeBaseNodeType) => {
|
|
setInputs(newInputs)
|
|
ref.current = newInputs
|
|
}, [setInputs, ref])
|
|
}
|