From f3c8c7045dbc955442b14b6dba11728f5662a636 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 29 Nov 2025 14:19:55 -0500 Subject: [PATCH] refac --- backend/open_webui/models/messages.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/open_webui/models/messages.py b/backend/open_webui/models/messages.py index 00a3b4fa2d..98be21463d 100644 --- a/backend/open_webui/models/messages.py +++ b/backend/open_webui/models/messages.py @@ -373,6 +373,15 @@ class MessageTable: self, id: str, user_id: str, name: str ) -> Optional[MessageReactionModel]: with get_db() as db: + # check for existing reaction + existing_reaction = ( + db.query(MessageReaction) + .filter_by(message_id=id, user_id=user_id, name=name) + .first() + ) + if existing_reaction: + return MessageReactionModel.model_validate(existing_reaction) + reaction_id = str(uuid.uuid4()) reaction = MessageReactionModel( id=reaction_id,