Timothy Jaeryang Baek 4 ヶ月 前
コミット
3e003a5f17
1 ファイル変更4 行追加1 行削除
  1. 4 1
      backend/open_webui/models/chats.py

+ 4 - 1
backend/open_webui/models/chats.py

@@ -440,7 +440,10 @@ class ChatTable:
                 order_by = filter.get("order_by")
                 direction = filter.get("direction")
 
-                if order_by and direction and getattr(Chat, order_by):
+                if order_by and direction:
+                    if not getattr(Chat, order_by):
+                        raise ValueError("Invalid order_by field")
+
                     if direction.lower() == "asc":
                         query = query.order_by(getattr(Chat, order_by).asc())
                     elif direction.lower() == "desc":