feat: Thread nodeOutputVars through HITL and workflow variable components

This commit is contained in:
zhsama
2026-02-10 00:55:06 +08:00
parent 41b218f427
commit d47bc3abc4
10 changed files with 95 additions and 29 deletions

View File

@@ -3,7 +3,7 @@ import type { FC } from 'react'
import type { WorkflowNodesMap } from '../workflow-variable-block/node'
import type { FormInputItem } from '@/app/components/workflow/nodes/human-input/types'
import type { Type } from '@/app/components/workflow/nodes/llm/types'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import { RiDeleteBinLine, RiEditLine } from '@remixicon/react'
import { useBoolean } from 'ahooks'
import * as React from 'react'
@@ -23,6 +23,7 @@ type HITLInputComponentUIProps = {
onRename: (payload: FormInputItem, oldName: string) => void
onRemove: (varName: string) => void
workflowNodesMap: WorkflowNodesMap
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -49,6 +50,7 @@ const HITLInputComponentUI: FC<HITLInputComponentUIProps> = ({
onRename,
onRemove,
workflowNodesMap = {},
nodeOutputVars,
getVarType,
environmentVariables,
conversationVariables,
@@ -118,6 +120,7 @@ const HITLInputComponentUI: FC<HITLInputComponentUIProps> = ({
<VariableBlock
variables={formInput.default?.selector}
workflowNodesMap={workflowNodesMap}
nodeOutputVars={nodeOutputVars}
getVarType={getVarType}
environmentVariables={environmentVariables}
conversationVariables={conversationVariables}

View File

@@ -2,7 +2,7 @@ import type { FC } from 'react'
import type { WorkflowNodesMap } from '../workflow-variable-block/node'
import type { FormInputItem } from '@/app/components/workflow/nodes/human-input/types'
import type { Type } from '@/app/components/workflow/nodes/llm/types'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import { produce } from 'immer'
import { useCallback } from 'react'
import { useSelectOrDelete } from '../../hooks'
@@ -18,6 +18,7 @@ type HITLInputComponentProps = {
onRename: (payload: FormInputItem, oldName: string) => void
onRemove: (varName: string) => void
workflowNodesMap: WorkflowNodesMap
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -37,6 +38,7 @@ const HITLInputComponent: FC<HITLInputComponentProps> = ({
onRename,
onRemove,
workflowNodesMap = {},
nodeOutputVars,
getVarType,
environmentVariables,
conversationVariables,
@@ -73,6 +75,7 @@ const HITLInputComponent: FC<HITLInputComponentProps> = ({
onRename={onRename}
onRemove={onRemove}
workflowNodesMap={workflowNodesMap}
nodeOutputVars={nodeOutputVars}
getVarType={getVarType}
environmentVariables={environmentVariables}
conversationVariables={conversationVariables}

View File

@@ -55,6 +55,7 @@ const HITLInputReplacementBlock = ({
onFormInputItemRemove!,
workflowNodesMap,
getVarType,
variables,
environmentVariables,
conversationVariables,
ragVariables,

View File

@@ -1,4 +1,5 @@
import type { HITLInputBlockType } from '../../types'
import type { UpdateWorkflowNodesMapPayload } from '../workflow-variable-block'
import type {
HITLNodeProps,
} from './node'
@@ -14,6 +15,7 @@ import {
useEffect,
} from 'react'
import { CustomTextNode } from '../custom-text/node'
import { UPDATE_WORKFLOW_NODES_MAP } from '../workflow-variable-block'
import {
$createHITLInputNode,
HITLInputNode,
@@ -21,7 +23,6 @@ import {
export const INSERT_HITL_INPUT_BLOCK_COMMAND = createCommand('INSERT_HITL_INPUT_BLOCK_COMMAND')
export const DELETE_HITL_INPUT_BLOCK_COMMAND = createCommand('DELETE_HITL_INPUT_BLOCK_COMMAND')
export const UPDATE_WORKFLOW_NODES_MAP = createCommand('UPDATE_WORKFLOW_NODES_MAP')
export type HITLInputProps = {
onInsert?: () => void
@@ -31,6 +32,7 @@ const HITLInputBlock = memo(({
onInsert,
onDelete,
workflowNodesMap,
variables,
getVarType,
readonly,
}: HITLInputBlockType) => {
@@ -38,9 +40,13 @@ const HITLInputBlock = memo(({
useEffect(() => {
editor.update(() => {
editor.dispatchCommand(UPDATE_WORKFLOW_NODES_MAP, workflowNodesMap)
const payload: UpdateWorkflowNodesMapPayload = {
workflowNodesMap: workflowNodesMap || {},
nodeOutputVars: variables || [],
}
editor.dispatchCommand(UPDATE_WORKFLOW_NODES_MAP, payload)
})
}, [editor, workflowNodesMap])
}, [editor, workflowNodesMap, variables])
useEffect(() => {
if (!editor.hasNodes([HITLInputNode]))
@@ -66,6 +72,7 @@ const HITLInputBlock = memo(({
onFormInputItemRemove,
workflowNodesMap,
getVarType,
variables,
undefined,
undefined,
undefined,
@@ -94,7 +101,7 @@ const HITLInputBlock = memo(({
COMMAND_PRIORITY_EDITOR,
),
)
}, [editor, onInsert, onDelete])
}, [editor, onInsert, onDelete, workflowNodesMap, getVarType, variables, readonly])
return null
})

View File

@@ -2,7 +2,7 @@ import type { LexicalNode, NodeKey, SerializedLexicalNode } from 'lexical'
import type { GetVarType } from '../../types'
import type { WorkflowNodesMap } from '../workflow-variable-block/node'
import type { FormInputItem } from '@/app/components/workflow/nodes/human-input/types'
import type { Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, Var } from '@/app/components/workflow/types'
import { DecoratorNode } from 'lexical'
import HILTInputBlockComponent from './component'
@@ -15,6 +15,7 @@ export type HITLNodeProps = {
onFormInputItemRemove: (varName: string) => void
workflowNodesMap: WorkflowNodesMap
getVarType?: GetVarType
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -32,6 +33,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
__onFormInputItemRemove: (varName: string) => void
__workflowNodesMap: WorkflowNodesMap
__getVarType?: GetVarType
__nodeOutputVars?: NodeOutPutVar[]
__environmentVariables?: Var[]
__conversationVariables?: Var[]
__ragVariables?: Var[]
@@ -89,6 +91,11 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
return self.__getVarType
}
getNodeOutputVars(): NodeOutPutVar[] {
const self = this.getLatest()
return self.__nodeOutputVars || []
}
getEnvironmentVariables(): Var[] {
const self = this.getLatest()
return self.__environmentVariables || []
@@ -119,6 +126,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
node.__onFormInputItemRemove,
node.__workflowNodesMap,
node.__getVarType,
node.__nodeOutputVars,
node.__environmentVariables,
node.__conversationVariables,
node.__ragVariables,
@@ -140,6 +148,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
onFormInputItemRemove: (varName: string) => void,
workflowNodesMap: WorkflowNodesMap,
getVarType?: GetVarType,
nodeOutputVars?: NodeOutPutVar[],
environmentVariables?: Var[],
conversationVariables?: Var[],
ragVariables?: Var[],
@@ -156,6 +165,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
this.__onFormInputItemRemove = onFormInputItemRemove
this.__workflowNodesMap = workflowNodesMap
this.__getVarType = getVarType
this.__nodeOutputVars = nodeOutputVars
this.__environmentVariables = environmentVariables
this.__conversationVariables = conversationVariables
this.__ragVariables = ragVariables
@@ -184,6 +194,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
onRemove={this.getOnFormInputItemRemove()}
workflowNodesMap={this.getWorkflowNodesMap()}
getVarType={this.getGetVarType()}
nodeOutputVars={this.getNodeOutputVars()}
environmentVariables={this.getEnvironmentVariables()}
conversationVariables={this.getConversationVariables()}
ragVariables={this.getRagVariables()}
@@ -202,6 +213,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
serializedNode.onFormInputItemRemove,
serializedNode.workflowNodesMap,
serializedNode.getVarType,
serializedNode.nodeOutputVars,
serializedNode.environmentVariables,
serializedNode.conversationVariables,
serializedNode.ragVariables,
@@ -223,6 +235,7 @@ export class HITLInputNode extends DecoratorNode<React.JSX.Element> {
onFormInputItemRemove: this.getOnFormInputItemRemove(),
workflowNodesMap: this.getWorkflowNodesMap(),
getVarType: this.getGetVarType(),
nodeOutputVars: this.getNodeOutputVars(),
environmentVariables: this.getEnvironmentVariables(),
conversationVariables: this.getConversationVariables(),
ragVariables: this.getRagVariables(),
@@ -244,6 +257,7 @@ export function $createHITLInputNode(
onFormInputItemRemove: (varName: string) => void,
workflowNodesMap: WorkflowNodesMap,
getVarType?: GetVarType,
nodeOutputVars?: NodeOutPutVar[],
environmentVariables?: Var[],
conversationVariables?: Var[],
ragVariables?: Var[],
@@ -258,6 +272,7 @@ export function $createHITLInputNode(
onFormInputItemRemove,
workflowNodesMap,
getVarType,
nodeOutputVars,
environmentVariables,
conversationVariables,
ragVariables,

View File

@@ -1,5 +1,6 @@
import type { UpdateWorkflowNodesMapPayload } from '../workflow-variable-block'
import type { WorkflowNodesMap } from '../workflow-variable-block/node'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { mergeRegister } from '@lexical/utils'
import {
@@ -19,6 +20,7 @@ import {
isGlobalVar,
isRagVariableVar,
isSystemVar,
isValueSelectorInNodeOutputVars,
} from '@/app/components/workflow/nodes/_base/components/variable/utils'
import VarFullPathPanel from '@/app/components/workflow/nodes/_base/components/variable/var-full-path-panel'
import {
@@ -32,6 +34,7 @@ import { HITLInputNode } from './node'
type HITLInputVariableBlockComponentProps = {
variables: string[]
workflowNodesMap: WorkflowNodesMap
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -44,6 +47,7 @@ type HITLInputVariableBlockComponentProps = {
const HITLInputVariableBlockComponent = ({
variables,
workflowNodesMap = {},
nodeOutputVars,
getVarType,
environmentVariables,
conversationVariables,
@@ -62,10 +66,14 @@ const HITLInputVariableBlockComponent = ({
}
)()
const [localWorkflowNodesMap, setLocalWorkflowNodesMap] = useState<WorkflowNodesMap>(workflowNodesMap)
const [localNodeOutputVars, setLocalNodeOutputVars] = useState<NodeOutPutVar[]>(nodeOutputVars || [])
const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]]
const isException = isExceptionVariable(varName, node?.type)
const variableValid = useMemo(() => {
if (localNodeOutputVars.length)
return isValueSelectorInNodeOutputVars(variables, localNodeOutputVars)
let variableValid = true
const isEnv = isENV(variables)
const isChatVar = isConversationVar(variables)
@@ -89,7 +97,7 @@ const HITLInputVariableBlockComponent = ({
variableValid = !!node
}
return variableValid
}, [variables, node, environmentVariables, conversationVariables, isRagVar, ragVariables])
}, [variables, node, environmentVariables, conversationVariables, isRagVar, ragVariables, localNodeOutputVars])
useEffect(() => {
if (!editor.hasNodes([HITLInputNode]))
@@ -98,8 +106,9 @@ const HITLInputVariableBlockComponent = ({
return mergeRegister(
editor.registerCommand(
UPDATE_WORKFLOW_NODES_MAP,
(workflowNodesMap: WorkflowNodesMap) => {
setLocalWorkflowNodesMap(workflowNodesMap)
(payload: UpdateWorkflowNodesMapPayload) => {
setLocalWorkflowNodesMap(payload.workflowNodesMap)
setLocalNodeOutputVars(payload.nodeOutputVars)
return true
},

View File

@@ -1,5 +1,6 @@
import type { UpdateWorkflowNodesMapPayload } from './index'
import type { WorkflowNodesMap } from './node'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { mergeRegister } from '@lexical/utils'
import {
@@ -15,7 +16,7 @@ import {
import { useTranslation } from 'react-i18next'
import { useReactFlow, useStoreApi } from 'reactflow'
import Tooltip from '@/app/components/base/tooltip'
import { isConversationVar, isENV, isGlobalVar, isRagVariableVar, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import { isConversationVar, isENV, isGlobalVar, isRagVariableVar, isSystemVar, isValueSelectorInNodeOutputVars } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import VarFullPathPanel from '@/app/components/workflow/nodes/_base/components/variable/var-full-path-panel'
import {
VariableLabelInEditor,
@@ -34,6 +35,7 @@ type WorkflowVariableBlockComponentProps = {
nodeKey: string
variables: string[]
workflowNodesMap: WorkflowNodesMap
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -47,6 +49,7 @@ const WorkflowVariableBlockComponent = ({
nodeKey,
variables,
workflowNodesMap = {},
nodeOutputVars,
getVarType,
environmentVariables,
conversationVariables,
@@ -66,12 +69,16 @@ const WorkflowVariableBlockComponent = ({
}
)()
const [localWorkflowNodesMap, setLocalWorkflowNodesMap] = useState<WorkflowNodesMap>(workflowNodesMap)
const [localNodeOutputVars, setLocalNodeOutputVars] = useState<NodeOutPutVar[]>(nodeOutputVars || [])
const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]]
const isContextVariable = (node?.type === BlockEnum.Agent || node?.type === BlockEnum.LLM)
&& variables[variablesLength - 1] === 'context'
const isException = isExceptionVariable(varName, node?.type)
const variableValid = useMemo(() => {
if (localNodeOutputVars.length)
return isValueSelectorInNodeOutputVars(variables, localNodeOutputVars)
let variableValid = true
const isEnv = isENV(variables)
const isChatVar = isConversationVar(variables)
@@ -95,7 +102,7 @@ const WorkflowVariableBlockComponent = ({
variableValid = !!node
}
return variableValid
}, [variables, node, environmentVariables, conversationVariables, isRagVar, ragVariables])
}, [variables, node, environmentVariables, conversationVariables, isRagVar, ragVariables, localNodeOutputVars])
const reactflow = useReactFlow()
const store = useStoreApi()
@@ -107,8 +114,9 @@ const WorkflowVariableBlockComponent = ({
return mergeRegister(
editor.registerCommand(
UPDATE_WORKFLOW_NODES_MAP,
(workflowNodesMap: WorkflowNodesMap) => {
setLocalWorkflowNodesMap(workflowNodesMap)
(payload: UpdateWorkflowNodesMapPayload) => {
setLocalWorkflowNodesMap(payload.workflowNodesMap)
setLocalNodeOutputVars(payload.nodeOutputVars)
return true
},

View File

@@ -19,7 +19,13 @@ import {
export const INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND = createCommand('INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND')
export const DELETE_WORKFLOW_VARIABLE_BLOCK_COMMAND = createCommand('DELETE_WORKFLOW_VARIABLE_BLOCK_COMMAND')
export const CLEAR_HIDE_MENU_TIMEOUT = createCommand('CLEAR_HIDE_MENU_TIMEOUT')
export const UPDATE_WORKFLOW_NODES_MAP = createCommand('UPDATE_WORKFLOW_NODES_MAP')
export type UpdateWorkflowNodesMapPayload = {
workflowNodesMap: NonNullable<WorkflowVariableBlockType['workflowNodesMap']>
nodeOutputVars: NonNullable<WorkflowVariableBlockType['variables']>
}
export const UPDATE_WORKFLOW_NODES_MAP = createCommand<UpdateWorkflowNodesMapPayload>('UPDATE_WORKFLOW_NODES_MAP')
export type WorkflowVariableBlockProps = {
getWorkflowNode: (nodeId: string) => Node
@@ -29,6 +35,7 @@ export type WorkflowVariableBlockProps = {
}
const WorkflowVariableBlock = memo(({
workflowNodesMap,
variables,
onInsert,
onDelete,
getVarType,
@@ -37,9 +44,12 @@ const WorkflowVariableBlock = memo(({
useEffect(() => {
editor.update(() => {
editor.dispatchCommand(UPDATE_WORKFLOW_NODES_MAP, workflowNodesMap)
editor.dispatchCommand(UPDATE_WORKFLOW_NODES_MAP, {
workflowNodesMap: workflowNodesMap || {},
nodeOutputVars: variables || [],
})
})
}, [editor, workflowNodesMap])
}, [editor, workflowNodesMap, variables])
useEffect(() => {
if (!editor.hasNodes([WorkflowVariableBlockNode]))
@@ -48,9 +58,9 @@ const WorkflowVariableBlock = memo(({
return mergeRegister(
editor.registerCommand(
INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND,
(variables: string[]) => {
(insertedVariables: string[]) => {
editor.dispatchCommand(CLEAR_HIDE_MENU_TIMEOUT, undefined)
const workflowVariableBlockNode = $createWorkflowVariableBlockNode(variables, workflowNodesMap, getVarType)
const workflowVariableBlockNode = $createWorkflowVariableBlockNode(insertedVariables, workflowNodesMap, getVarType, undefined, undefined, undefined, variables)
$insertNodes([workflowVariableBlockNode])
if (onInsert)
@@ -71,7 +81,7 @@ const WorkflowVariableBlock = memo(({
COMMAND_PRIORITY_EDITOR,
),
)
}, [editor, onInsert, onDelete, workflowNodesMap, getVarType])
}, [editor, onInsert, onDelete, workflowNodesMap, getVarType, variables])
return null
})

View File

@@ -1,6 +1,6 @@
import type { LexicalNode, NodeKey, SerializedLexicalNode } from 'lexical'
import type { GetVarType, WorkflowVariableBlockType } from '../../types'
import type { Var } from '@/app/components/workflow/types'
import type { NodeOutPutVar, Var } from '@/app/components/workflow/types'
import { DecoratorNode } from 'lexical'
import { BlockEnum } from '@/app/components/workflow/types'
import WorkflowVariableBlockComponent from './component'
@@ -11,6 +11,7 @@ export type SerializedNode = SerializedLexicalNode & {
variables: string[]
workflowNodesMap: WorkflowNodesMap
getVarType?: GetVarType
nodeOutputVars?: NodeOutPutVar[]
environmentVariables?: Var[]
conversationVariables?: Var[]
ragVariables?: Var[]
@@ -20,6 +21,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
__variables: string[]
__workflowNodesMap: WorkflowNodesMap
__getVarType?: GetVarType
__nodeOutputVars?: NodeOutPutVar[]
__environmentVariables?: Var[]
__conversationVariables?: Var[]
__ragVariables?: Var[]
@@ -29,14 +31,14 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
}
static clone(node: WorkflowVariableBlockNode): WorkflowVariableBlockNode {
return new WorkflowVariableBlockNode(node.__variables, node.__workflowNodesMap, node.__getVarType, node.__key, node.__environmentVariables, node.__conversationVariables, node.__ragVariables)
return new WorkflowVariableBlockNode(node.__variables, node.__workflowNodesMap, node.__getVarType, node.__key, node.__environmentVariables, node.__conversationVariables, node.__ragVariables, node.__nodeOutputVars)
}
isInline(): boolean {
return true
}
constructor(variables: string[], workflowNodesMap: WorkflowNodesMap, getVarType: any, key?: NodeKey, environmentVariables?: Var[], conversationVariables?: Var[], ragVariables?: Var[]) {
constructor(variables: string[], workflowNodesMap: WorkflowNodesMap, getVarType: any, key?: NodeKey, environmentVariables?: Var[], conversationVariables?: Var[], ragVariables?: Var[], nodeOutputVars?: NodeOutPutVar[]) {
super(key)
this.__variables = variables
@@ -45,6 +47,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
this.__environmentVariables = environmentVariables
this.__conversationVariables = conversationVariables
this.__ragVariables = ragVariables
this.__nodeOutputVars = nodeOutputVars
}
createDOM(): HTMLElement {
@@ -63,6 +66,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
nodeKey={this.getKey()}
variables={this.__variables}
workflowNodesMap={this.__workflowNodesMap}
nodeOutputVars={this.__nodeOutputVars}
getVarType={this.__getVarType!}
environmentVariables={this.__environmentVariables}
conversationVariables={this.__conversationVariables}
@@ -72,7 +76,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
}
static importJSON(serializedNode: SerializedNode): WorkflowVariableBlockNode {
const node = $createWorkflowVariableBlockNode(serializedNode.variables, serializedNode.workflowNodesMap, serializedNode.getVarType, serializedNode.environmentVariables, serializedNode.conversationVariables, serializedNode.ragVariables)
const node = $createWorkflowVariableBlockNode(serializedNode.variables, serializedNode.workflowNodesMap, serializedNode.getVarType, serializedNode.environmentVariables, serializedNode.conversationVariables, serializedNode.ragVariables, serializedNode.nodeOutputVars)
return node
}
@@ -84,6 +88,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
variables: this.getVariables(),
workflowNodesMap: this.getWorkflowNodesMap(),
getVarType: this.getVarType(),
nodeOutputVars: this.getNodeOutputVars(),
environmentVariables: this.getEnvironmentVariables(),
conversationVariables: this.getConversationVariables(),
ragVariables: this.getRagVariables(),
@@ -105,6 +110,11 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
return self.__getVarType
}
getNodeOutputVars(): NodeOutPutVar[] {
const self = this.getLatest()
return self.__nodeOutputVars || []
}
getEnvironmentVariables(): any {
const self = this.getLatest()
return self.__environmentVariables
@@ -129,8 +139,8 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
return `{{${marker}${variables.join('.')}${marker}}}`
}
}
export function $createWorkflowVariableBlockNode(variables: string[], workflowNodesMap: WorkflowNodesMap, getVarType?: GetVarType, environmentVariables?: Var[], conversationVariables?: Var[], ragVariables?: Var[]): WorkflowVariableBlockNode {
return new WorkflowVariableBlockNode(variables, workflowNodesMap, getVarType, undefined, environmentVariables, conversationVariables, ragVariables)
export function $createWorkflowVariableBlockNode(variables: string[], workflowNodesMap: WorkflowNodesMap, getVarType?: GetVarType, environmentVariables?: Var[], conversationVariables?: Var[], ragVariables?: Var[], nodeOutputVars?: NodeOutPutVar[]): WorkflowVariableBlockNode {
return new WorkflowVariableBlockNode(variables, workflowNodesMap, getVarType, undefined, environmentVariables, conversationVariables, ragVariables, nodeOutputVars)
}
export function $isWorkflowVariableBlockNode(

View File

@@ -39,7 +39,7 @@ const WorkflowVariableBlockReplacementBlock = ({
onInsert()
const nodePathString = textNode.getTextContent().slice(3, -3)
return $applyNodeReplacement($createWorkflowVariableBlockNode(nodePathString.split('.'), workflowNodesMap, getVarType, variables?.find(o => o.nodeId === 'env')?.vars || [], variables?.find(o => o.nodeId === 'conversation')?.vars || [], ragVariables))
return $applyNodeReplacement($createWorkflowVariableBlockNode(nodePathString.split('.'), workflowNodesMap, getVarType, variables?.find(o => o.nodeId === 'env')?.vars || [], variables?.find(o => o.nodeId === 'conversation')?.vars || [], ragVariables, variables))
}, [onInsert, workflowNodesMap, getVarType, variables, ragVariables])
const getMatch = useCallback((text: string) => {