瀏覽代碼

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)



Loading…
取消
儲存