From b2a1f71d920e55b143f1c02e61104938d2588762 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Fri, 9 Jan 2026 03:06:24 +0400 Subject: [PATCH] refac: get feedback ids --- backend/open_webui/models/feedbacks.py | 21 +++++++++++++++++++++ backend/open_webui/routers/evaluations.py | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/models/feedbacks.py b/backend/open_webui/models/feedbacks.py index 02379cd87..6b1231e45 100644 --- a/backend/open_webui/models/feedbacks.py +++ b/backend/open_webui/models/feedbacks.py @@ -250,6 +250,27 @@ class FeedbackTable: .all() ] + def get_all_feedback_ids( + self, db: Optional[Session] = None + ) -> list[FeedbackIdResponse]: + with get_db_context(db) as db: + return [ + FeedbackIdResponse( + id=row.id, + user_id=row.user_id, + created_at=row.created_at, + updated_at=row.updated_at, + ) + for row in db.query( + Feedback.id, + Feedback.user_id, + Feedback.created_at, + Feedback.updated_at, + ) + .order_by(Feedback.updated_at.desc()) + .all() + ] + def get_feedbacks_by_type( self, type: str, db: Optional[Session] = None ) -> list[FeedbackModel]: diff --git a/backend/open_webui/routers/evaluations.py b/backend/open_webui/routers/evaluations.py index a445be5f9..1bc6f1421 100644 --- a/backend/open_webui/routers/evaluations.py +++ b/backend/open_webui/routers/evaluations.py @@ -73,8 +73,7 @@ async def get_all_feedbacks( async def get_all_feedback_ids( user=Depends(get_admin_user), db: Session = Depends(get_session) ): - feedbacks = Feedbacks.get_all_feedbacks(db=db) - return feedbacks + return Feedbacks.get_all_feedback_ids(db=db) @router.delete("/feedbacks/all")