mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
Fixed the issue where recall the knowledge base in the iteration of the workflow and report errors when executing (#10060)
This commit is contained in:
parent
952847ed29
commit
b8c2e5359b
|
@ -10,6 +10,7 @@ from core.variables import (
|
||||||
ArrayNumberVariable,
|
ArrayNumberVariable,
|
||||||
ArrayObjectSegment,
|
ArrayObjectSegment,
|
||||||
ArrayObjectVariable,
|
ArrayObjectVariable,
|
||||||
|
ArraySegment,
|
||||||
ArrayStringSegment,
|
ArrayStringSegment,
|
||||||
ArrayStringVariable,
|
ArrayStringVariable,
|
||||||
FileSegment,
|
FileSegment,
|
||||||
|
@ -79,7 +80,7 @@ def build_segment(value: Any, /) -> Segment:
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
items = [build_segment(item) for item in value]
|
items = [build_segment(item) for item in value]
|
||||||
types = {item.value_type for item in items}
|
types = {item.value_type for item in items}
|
||||||
if len(types) != 1:
|
if len(types) != 1 or all(isinstance(item, ArraySegment) for item in items):
|
||||||
return ArrayAnySegment(value=value)
|
return ArrayAnySegment(value=value)
|
||||||
match types.pop():
|
match types.pop():
|
||||||
case SegmentType.STRING:
|
case SegmentType.STRING:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user