From 2cc23b8399e5807d8a57923b7fd93af67ad625b2 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 16 Jun 2024 17:29:36 -0300 Subject: [PATCH] refactor: Update timestamp handling in Message schema Refactor the `timestamp` field in the `Message` schema to use the `datetime.now(timezone.utc)` function instead of the `utc_now` utility. This change ensures consistency with other modules and reduces redundancy. No behavioral changes are intended; only the implementation detail is modified to leverage the built-in function for getting the current UTC datetime. --- src/backend/base/langflow/schema/message.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/base/langflow/schema/message.py b/src/backend/base/langflow/schema/message.py index 1bb3363ae..fd7c17a1f 100644 --- a/src/backend/base/langflow/schema/message.py +++ b/src/backend/base/langflow/schema/message.py @@ -8,7 +8,6 @@ from pydantic import BeforeValidator, ConfigDict, Field, field_serializer from langflow.schema.data import Data from langflow.schema.image import Image, get_file_paths, is_image_file -from langflow.utils.util import utc_now def _timestamp_to_str(timestamp: datetime) -> str: return timestamp.strftime("%Y-%m-%d %H:%M:%S") @@ -24,7 +23,7 @@ class Message(Data): files: Optional[list[str | Image]] = Field(default=[]) session_id: Optional[str] = Field(default="") timestamp: Annotated[str, BeforeValidator(_timestamp_to_str)] = Field( - default=utc_now(stringify=True) + default=datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S") ) flow_id: Optional[str] = None