mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
acac6d5973
commit
3e003a5f17
1 changed files with 4 additions and 1 deletions
|
|
@ -440,7 +440,10 @@ class ChatTable:
|
||||||
order_by = filter.get("order_by")
|
order_by = filter.get("order_by")
|
||||||
direction = filter.get("direction")
|
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":
|
if direction.lower() == "asc":
|
||||||
query = query.order_by(getattr(Chat, order_by).asc())
|
query = query.order_by(getattr(Chat, order_by).asc())
|
||||||
elif direction.lower() == "desc":
|
elif direction.lower() == "desc":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue