소스 검색

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

tags/1.7.2
-LAN- 2 달 전
부모
커밋
7230497bf4
No account linked to committer's email address
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…
취소
저장