From 256034e28505eb77e83a5eca05c057675f43d3b9 Mon Sep 17 00:00:00 2001 From: cheadings71 Date: Mon, 26 May 2025 14:55:48 -0700 Subject: [PATCH] Update misc.py Before fix: Chat engagement failed with TypeError and KeyError After fix: Chat works smoothly with automatic title generation and proper history --- backend/open_webui/utils/misc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/open_webui/utils/misc.py b/backend/open_webui/utils/misc.py index 79f483d04..602794f05 100644 --- a/backend/open_webui/utils/misc.py +++ b/backend/open_webui/utils/misc.py @@ -34,6 +34,10 @@ def get_message_list(messages, message_id): :return: List of ordered messages starting from the root to the given message """ + # Handle case where messages is None + if not messages: + return [] # Return empty list instead of None to prevent iteration errors + # Find the message by its id current_message = messages.get(message_id)