From 3b990b1b86355851d932fcb42312ed38b355a49f Mon Sep 17 00:00:00 2001 From: Jaco Bezuidenhout Date: Wed, 27 May 2026 13:21:14 +0000 Subject: [PATCH] fix: filter Open WebUI background task requests from intent classifier Open WebUI sends 4-5 extra requests per chat: query augmentation (Query: ...), title generation, tag generation, and follow-up question suggestions. These all include the full chat history, so they match execute/task intents incorrectly. Added early return to classify_intent for Open WebUI system prompt patterns. --- app/intent.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/intent.py b/app/intent.py index ddee9d4..275d6e1 100644 --- a/app/intent.py +++ b/app/intent.py @@ -61,6 +61,18 @@ def classify_intent(message: str) -> str: msg = message.lower() words = set(msg.split()) + # Open WebUI background tasks — sent automatically after every chat response. + # They include the full chat history, so they'd mis-trigger execute/task intents. + # Patterns: "### Task:", "Query: " (query augmentation), meta-task keywords. + if (msg.startswith("### task:") or + msg.startswith("query:") or + "chat history" in msg or + "summarizing the chat" in msg or + "categorizing the main themes" in msg or + "follow-up questions" in msg or + "3-5 word title" in msg): + return "planning" + # Project creation — check before task/query if any(p in msg for p in CREATE_PROJECT_PHRASES): return "create_project"