From 97a9c51d1b01af480899056f316a100821db0030 Mon Sep 17 00:00:00 2001 From: Kalo Chin Date: Thu, 17 Jul 2025 20:33:45 +0900 Subject: [PATCH] Add custom log property to ArrayAnySegment Introduces a log property to ArrayAnySegment that returns an empty string when the array is empty, instead of '[]'. This improves log output readability for empty arrays. --- api/core/variables/segments.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/core/variables/segments.py b/api/core/variables/segments.py index 13274f4e0e..ebb80339b9 100644 --- a/api/core/variables/segments.py +++ b/api/core/variables/segments.py @@ -148,6 +148,15 @@ class ArrayAnySegment(ArraySegment): value_type: SegmentType = SegmentType.ARRAY_ANY value: Sequence[Any] + @property + def log(self) -> str: + """ + When the array is empty, return an empty string rather than "[]". + """ + if len(self.value) == 0: + return "" + return str(self.value) + class ArrayStringSegment(ArraySegment): value_type: SegmentType = SegmentType.ARRAY_STRING