mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 17:38:04 +08:00
feat: code support vars
This commit is contained in:
19
web/app/components/workflow/nodes/code/use-config.ts
Normal file
19
web/app/components/workflow/nodes/code/use-config.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { useState } from 'react'
|
||||
import useVarList from '../_base/hooks/use-var-list'
|
||||
import type { CodeNodeType } from './types'
|
||||
|
||||
const useConfig = (initInputs: CodeNodeType) => {
|
||||
const [inputs, setInputs] = useState<CodeNodeType>(initInputs)
|
||||
const { handleVarListChange, handleAddVariable } = useVarList<CodeNodeType>({
|
||||
inputs,
|
||||
setInputs,
|
||||
})
|
||||
|
||||
return {
|
||||
inputs,
|
||||
handleVarListChange,
|
||||
handleAddVariable,
|
||||
}
|
||||
}
|
||||
|
||||
export default useConfig
|
||||
Reference in New Issue
Block a user