mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +00:00
feat: form input var type
This commit is contained in:
@@ -49,8 +49,8 @@ const CustomEdge = ({
|
|||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const { handleNodeAdd } = useNodesInteractions()
|
const { handleNodeAdd } = useNodesInteractions()
|
||||||
const nodesExtraData = useNodesExtraData()
|
const nodesExtraData = useNodesExtraData()
|
||||||
const availablePrevNodes = nodesExtraData[(data as Edge['data'])!.targetType].availablePrevNodes
|
const availablePrevNodes = nodesExtraData[(data as Edge['data'])?.targetType]?.availablePrevNodes || []
|
||||||
const availableNextNodes = nodesExtraData[(data as Edge['data'])!.sourceType].availableNextNodes
|
const availableNextNodes = nodesExtraData[(data as Edge['data'])?.sourceType]?.availableNextNodes || []
|
||||||
const handleOpenChange = useCallback((v: boolean) => {
|
const handleOpenChange = useCallback((v: boolean) => {
|
||||||
setOpen(v)
|
setOpen(v)
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { fetchBuiltInToolList, fetchCollectionList, fetchCustomToolList, updateB
|
|||||||
import { addDefaultValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
|
import { addDefaultValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
||||||
import { InputVarType, VarType as VarVarType } from '@/app/components/workflow/types'
|
import { VarType as VarVarType } from '@/app/components/workflow/types'
|
||||||
import type { InputVar, Var } from '@/app/components/workflow/types'
|
import type { InputVar, Var } from '@/app/components/workflow/types'
|
||||||
import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
|
import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
|
||||||
const useConfig = (id: string, payload: ToolNodeType) => {
|
const useConfig = (id: string, payload: ToolNodeType) => {
|
||||||
@@ -156,16 +156,12 @@ const useConfig = (id: string, payload: ToolNodeType) => {
|
|||||||
const singleRunForms = (() => {
|
const singleRunForms = (() => {
|
||||||
const formInputs: InputVar[] = []
|
const formInputs: InputVar[] = []
|
||||||
toolInputVarSchema.forEach((item: any) => {
|
toolInputVarSchema.forEach((item: any) => {
|
||||||
// const targetItem = toolInputs.find(input => input.variable === item.variable)
|
|
||||||
// TODO: support selector
|
|
||||||
// if (targetItem?.variable_type === VarType.selector) {
|
|
||||||
formInputs.push({
|
formInputs.push({
|
||||||
label: item.label[language] || item.label.en_US,
|
label: item.label[language] || item.label.en_US,
|
||||||
variable: item.variable,
|
variable: item.variable,
|
||||||
type: InputVarType.textInput, // TODO: to form input
|
type: item.type,
|
||||||
required: item.required,
|
required: item.required,
|
||||||
})
|
})
|
||||||
// }
|
|
||||||
})
|
})
|
||||||
const forms: FormProps[] = [{
|
const forms: FormProps[] = [{
|
||||||
inputs: formInputs,
|
inputs: formInputs,
|
||||||
|
|||||||
Reference in New Issue
Block a user