From 3348f6877806b0d73a5dee5f6e2dc84b4541680f Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:19:28 +0200 Subject: [PATCH] fix: keep attachment-only messages intact when skills are bound (#30045) Sending an image or file with no typed text to a model with skills bound replaced the (empty) message text with the list of skill names, so the model answered with its skill catalog instead of handling the attachment. The empty-message guard added for #24929 fired on any empty last user text without checking for attachments. The guard now skips the fallback when the current message carries files, read from the user_message object the frontend sends with the request. Attachment-only messages then go out exactly as they do on models without skills. A bare skill selection with no attachment still gets the fallback, so the provider 400 from #24929 stays fixed. Request-level files were not usable as the signal: that list carries the model's knowledge and folder files, so a bare skill selection on a knowledge model would have gone out empty again. Fixes #30040 --- backend/open_webui/utils/middleware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 3dca01d8bb..e0337fe553 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2888,7 +2888,8 @@ async def process_chat_payload(request, form_data, user, metadata, model): # that reject empty content blocks (e.g. AWS Bedrock ConverseStream). if not prompt or not prompt.strip(): fallback = ', '.join([s.name for s in available_skills] + [s['name'] for s in terminal_skills]) - if fallback: + # Attachment-only messages keep their empty text, same as on models without skills. + if fallback and not (metadata.get('user_message') or {}).get('files'): set_last_user_message_content(fallback, form_data['messages']) prompt = fallback # TODO: re-enable URL extraction from prompt