feat: form input var type

This commit is contained in:
Joel 2024-03-18 10:52:45 +08:00
parent 90b7ca1df1
commit 4daf93ef4f
2 changed files with 4 additions and 8 deletions

View File

@ -49,8 +49,8 @@ const CustomEdge = ({
const [open, setOpen] = useState(false)
const { handleNodeAdd } = useNodesInteractions()
const nodesExtraData = useNodesExtraData()
const availablePrevNodes = nodesExtraData[(data as Edge['data'])!.targetType].availablePrevNodes
const availableNextNodes = nodesExtraData[(data as Edge['data'])!.sourceType].availableNextNodes
const availablePrevNodes = nodesExtraData[(data as Edge['data'])?.targetType]?.availablePrevNodes || []
const availableNextNodes = nodesExtraData[(data as Edge['data'])?.sourceType]?.availableNextNodes || []
const handleOpenChange = useCallback((v: boolean) => {
setOpen(v)
}, [])

View File

@ -12,7 +12,7 @@ import { fetchBuiltInToolList, fetchCollectionList, fetchCustomToolList, updateB
import { addDefaultValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
import Toast from '@/app/components/base/toast'
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 useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
const useConfig = (id: string, payload: ToolNodeType) => {
@ -156,16 +156,12 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const singleRunForms = (() => {
const formInputs: InputVar[] = []
toolInputVarSchema.forEach((item: any) => {
// const targetItem = toolInputs.find(input => input.variable === item.variable)
// TODO: support selector
// if (targetItem?.variable_type === VarType.selector) {
formInputs.push({
label: item.label[language] || item.label.en_US,
variable: item.variable,
type: InputVarType.textInput, // TODO: to form input
type: item.type,
required: item.required,
})
// }
})
const forms: FormProps[] = [{
inputs: formInputs,