From f7a61f58478d8a67e5685db8f83d6227853b2de7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 26 Jun 2024 16:12:00 -0300 Subject: [PATCH] feat: Add flow_id serialization in Message class This commit adds the `serialize_flow_id` method to the `Message` class in the `message.py` file. This method serializes the `flow_id` attribute of a `Message` object, converting it to a UUID if it is a string. This ensures consistent serialization of the `flow_id` attribute when working with the `Message` class. --- src/backend/base/langflow/schema/message.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/base/langflow/schema/message.py b/src/backend/base/langflow/schema/message.py index c03c0cb71..5ad7d1922 100644 --- a/src/backend/base/langflow/schema/message.py +++ b/src/backend/base/langflow/schema/message.py @@ -41,6 +41,12 @@ class Message(Data): value = str(value) return value + @field_serializer("flow_id") + def serialize_flow_id(value): + if isinstance(value, str): + return UUID(value) + return value + @field_validator("files", mode="before") @classmethod def validate_files(cls, value):