fix: update iteration node to use correct variable segment types (#25315)
This commit is contained in:
parent
b623224d07
commit
7e629fd783
1 changed files with 3 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ from typing import TYPE_CHECKING, Any, Optional, cast
|
||||||
from flask import Flask, current_app
|
from flask import Flask, current_app
|
||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
from core.variables import ArrayVariable, IntegerVariable, NoneVariable
|
from core.variables import IntegerVariable, NoneSegment
|
||||||
from core.variables.segments import ArrayAnySegment, ArraySegment
|
from core.variables.segments import ArrayAnySegment, ArraySegment
|
||||||
from core.workflow.entities.node_entities import (
|
from core.workflow.entities.node_entities import (
|
||||||
NodeRunResult,
|
NodeRunResult,
|
||||||
|
|
@ -112,10 +112,10 @@ class IterationNode(BaseNode):
|
||||||
if not variable:
|
if not variable:
|
||||||
raise IteratorVariableNotFoundError(f"iterator variable {self._node_data.iterator_selector} not found")
|
raise IteratorVariableNotFoundError(f"iterator variable {self._node_data.iterator_selector} not found")
|
||||||
|
|
||||||
if not isinstance(variable, ArrayVariable) and not isinstance(variable, NoneVariable):
|
if not isinstance(variable, ArraySegment) and not isinstance(variable, NoneSegment):
|
||||||
raise InvalidIteratorValueError(f"invalid iterator value: {variable}, please provide a list.")
|
raise InvalidIteratorValueError(f"invalid iterator value: {variable}, please provide a list.")
|
||||||
|
|
||||||
if isinstance(variable, NoneVariable) or len(variable.value) == 0:
|
if isinstance(variable, NoneSegment) or len(variable.value) == 0:
|
||||||
# Try our best to preserve the type informat.
|
# Try our best to preserve the type informat.
|
||||||
if isinstance(variable, ArraySegment):
|
if isinstance(variable, ArraySegment):
|
||||||
output = variable.model_copy(update={"value": []})
|
output = variable.model_copy(update={"value": []})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue