diff --git a/backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py b/backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py index c8a3647aec..567f7d673a 100644 --- a/backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py +++ b/backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py @@ -127,6 +127,11 @@ def upgrade() -> None: timestamp = message.get("timestamp", now) + try: + timestamp = int(float(timestamp)) + except Exception as e: + timestamp = now + # Normalize timestamp: convert ms to seconds, validate range if timestamp > 10_000_000_000: timestamp = timestamp // 1000