Skip to content

Commit bcfe6f9

Browse files
committed
fix: Update _serialize_dispatcher to return the object directly instead of its string representation
1 parent 573130c commit bcfe6f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/base/langflow/serialization/serialization.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _serialize_dispatcher(obj: Any, max_length: int | None, max_items: int | Non
180180
return obj.tobytes().decode("utf-8", errors="ignore")
181181
if np.issubdtype(obj.dtype, np.object_) and hasattr(obj, "item"):
182182
return serialize(obj.item())
183-
return str(obj)
183+
return obj
184184

185185

186186
def serialize(
@@ -201,10 +201,12 @@ def serialize(
201201
max_items: Maximum items in list-like structures, None for no truncation
202202
to_str: If True, return a string representation of the object if serialization fails
203203
"""
204+
if obj is None:
205+
return None
204206
try:
205207
# First try type-specific serialization
206208
result = _serialize_dispatcher(obj, max_length, max_items)
207-
if result is not None or obj is None: # Special check for None since it's a valid result
209+
if result is not None: # Special check for None since it's a valid result
208210
return result
209211

210212
# Handle class-based Pydantic types and other types

0 commit comments

Comments
 (0)