From 639766f7f9db47bce8d33a04d0b7bc095b3358aa Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:43:19 +0100 Subject: [PATCH] refac: limit the number of search words used for chat search (#33844) Chat search now uses at most the first 12 distinct words of the query. --- backend/open_webui/models/chats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 1ff62af369..6e5ad30201 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -58,7 +58,7 @@ def chat_search_content_query(text: str) -> str: def chat_search_terms(text: str) -> list[str]: - return list(dict.fromkeys(re.findall(r'[a-z0-9]+', text.lower()))) + return list(dict.fromkeys(re.findall(r'[a-z0-9]+', text.lower())))[:12] def chat_message_list(chat: dict) -> list: