diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 3644c53e14..3ae7112f3e 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -441,7 +441,7 @@ class ChatTable: direction = filter.get("direction") if order_by and direction: - if not getattr(Chat, order_by): + if not getattr(Chat, order_by, None): raise ValueError("Invalid order_by field") if direction.lower() == "asc":