From b2b56d14cb5319c1d4bf85014b030c94c9871172 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 2 Jan 2025 20:48:50 -0800 Subject: [PATCH] fix: channel thread --- backend/open_webui/models/messages.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/models/messages.py b/backend/open_webui/models/messages.py index 87da2f3fb..a27ae5251 100644 --- a/backend/open_webui/models/messages.py +++ b/backend/open_webui/models/messages.py @@ -189,9 +189,11 @@ class MessageTable: .all() ) - return [ - MessageModel.model_validate(message) for message in all_messages - ] + [MessageModel.model_validate(message)] + # If length of all_messages is less than limit, then add the parent message + if len(all_messages) < limit: + all_messages.append(message) + + return [MessageModel.model_validate(message) for message in all_messages] def update_message_by_id( self, id: str, form_data: MessageForm