mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 10:56:52 +08:00
fix: workflow loop node break conditions (#15549)
This commit is contained in:
@@ -28,9 +28,6 @@ const nodeDefault: NodeDefault<LoopNodeType> = {
|
||||
checkValid(payload: LoopNodeType, t: any) {
|
||||
let errorMessages = ''
|
||||
|
||||
if (!errorMessages && (!payload.break_conditions || payload.break_conditions.length === 0))
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.loop.breakCondition') })
|
||||
|
||||
payload.break_conditions!.forEach((condition) => {
|
||||
if (!errorMessages && (!condition.variable_selector || condition.variable_selector.length === 0))
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variable`) })
|
||||
|
||||
@@ -55,6 +55,7 @@ const Panel: FC<NodePanelProps<LoopNodeType>> = ({
|
||||
<div>
|
||||
<Field
|
||||
title={<div className='pl-3'>{t(`${i18nPrefix}.breakCondition`)}</div>}
|
||||
tooltip={t(`${i18nPrefix}.breakConditionTip`)}
|
||||
>
|
||||
<ConditionWrap
|
||||
nodeId={id}
|
||||
|
||||
@@ -17,12 +17,14 @@ import { getOperators } from './utils'
|
||||
import { LogicalOperator } from './types'
|
||||
import type { HandleAddCondition, HandleAddSubVariableCondition, HandleRemoveCondition, HandleToggleConditionLogicalOperator, HandleToggleSubVariableConditionLogicalOperator, HandleUpdateCondition, HandleUpdateSubVariableCondition, LoopNodeType } from './types'
|
||||
import useIsVarFileAttribute from './use-is-var-file-attribute'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
|
||||
const DELIMITER = '@@@@@'
|
||||
const useConfig = (id: string, payload: LoopNodeType) => {
|
||||
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
||||
const { isNodeInLoop } = useIsNodeInLoop(id)
|
||||
const isChatMode = useIsChatMode()
|
||||
const conversationVariables = useStore(s => s.conversationVariables)
|
||||
|
||||
const { inputs, setInputs } = useNodeCrud<LoopNodeType>(id, payload)
|
||||
|
||||
@@ -35,7 +37,7 @@ const useConfig = (id: string, payload: LoopNodeType) => {
|
||||
const beforeNodes = getBeforeNodesInSameBranch(id)
|
||||
const loopChildrenNodes = getLoopNodeChildren(id)
|
||||
const canChooseVarNodes = [...beforeNodes, ...loopChildrenNodes]
|
||||
const childrenNodeVars = toNodeOutputVars(loopChildrenNodes, isChatMode)
|
||||
const childrenNodeVars = toNodeOutputVars(loopChildrenNodes, isChatMode, undefined, [], conversationVariables)
|
||||
|
||||
// single run
|
||||
const loopInputKey = `${id}.input_selector`
|
||||
|
||||
Reference in New Issue
Block a user