| | |
| | | |
| | | import type { ValueSelector, Var } from '../../types' |
| | | import { InputVarType, VarType } from '../../types' |
| | | import type { DocExtractorNodeType } from './types' |
| | | import { type DocExtractorNodeType } from './types' |
| | | import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud' |
| | | import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run' |
| | | import { |
| | |
| | | const currentNode = getNodes().find(n => n.id === id) |
| | | const isInIteration = payload.isInIteration |
| | | const iterationNode = isInIteration ? getNodes().find(n => n.id === currentNode!.parentId) : null |
| | | const isInLoop = payload.isInLoop |
| | | const loopNode = isInLoop ? getNodes().find(n => n.id === currentNode!.parentId) : null |
| | | const availableNodes = useMemo(() => { |
| | | return getBeforeNodesInSameBranch(id) |
| | | }, [getBeforeNodesInSameBranch, id]) |
| | |
| | | const { getCurrentVariableType } = useWorkflowVariables() |
| | | const getType = useCallback((variable?: ValueSelector) => { |
| | | const varType = getCurrentVariableType({ |
| | | parentNode: isInIteration ? iterationNode : loopNode, |
| | | parentNode: iterationNode, |
| | | valueSelector: variable || [], |
| | | availableNodes, |
| | | isChatMode, |
| | | isConstant: false, |
| | | }) |
| | | return varType |
| | | }, [getCurrentVariableType, isInIteration, availableNodes, isChatMode, iterationNode, loopNode]) |
| | | }, [getCurrentVariableType, availableNodes, isChatMode, iterationNode]) |
| | | |
| | | const handleVarChanges = useCallback((variable: ValueSelector | string) => { |
| | | const newInputs = produce(inputs, (draft) => { |