Procházet zdrojové kódy

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

tags/1.7.2
-LAN- před 2 měsíci
rodič
revize
7230497bf4
Žádný účet není propojen s e-mailovou adresou tvůrce revize
1 změnil soubory, kde provedl 10 přidání a 0 odebrání
  1. 10
    0
      api/core/variables/segments.py

+ 10
- 0
api/core/variables/segments.py Zobrazit soubor

@@ -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)



Načítá se…
Zrušit
Uložit