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.
This commit is contained in:
@@ -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: <text>" (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"
|
||||
|
||||
Reference in New Issue
Block a user