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:
JasonVV 2024-10-30 21:56:38 +08:00 committed by GitHub
parent ba60e0f692
commit 219f5d9845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ from core.variables import (
ArrayNumberVariable,
ArrayObjectSegment,
ArrayObjectVariable,
ArraySegment,
ArrayStringSegment,
ArrayStringVariable,
FileSegment,
@ -79,7 +80,7 @@ def build_segment(value: Any, /) -> Segment:
if isinstance(value, list):
items = [build_segment(item) for item in value]
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)
match types.pop():
case SegmentType.STRING: