浏览代码

fix: empty arrays should convert to empty string in LLM prompts (#23590)

tags/1.7.2
-LAN- 2 个月前
父节点
当前提交
7230497bf4
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      api/core/variables/segments.py

+ 10
- 0
api/core/variables/segments.py 查看文件

@@ -119,6 +119,13 @@ class ObjectSegment(Segment):


class ArraySegment(Segment):
@property
def text(self) -> str:
# Return empty string for empty arrays instead of "[]"
if not self.value:
return ""
return super().text

@property
def markdown(self) -> str:
items = []
@@ -155,6 +162,9 @@ class ArrayStringSegment(ArraySegment):

@property
def text(self) -> str:
# Return empty string for empty arrays instead of "[]"
if not self.value:
return ""
return json.dumps(self.value, ensure_ascii=False)



正在加载...
取消
保存