From d1b1d574a6aabc0636b26bc8cac60abf8ca7f587 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Fri, 5 Dec 2025 01:48:07 +0000 Subject: [PATCH] fix(vqa): add graceful error for empty "Use Prompt" task Replace silent fallback to "Describe the image" with explicit error when user selects "Use Prompt" but leaves the prompt field empty. Follows the same pattern as missing image validation. --- modules/interrogate/vqa.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/interrogate/vqa.py b/modules/interrogate/vqa.py index 4df0acaf0..fdedfb201 100644 --- a/modules/interrogate/vqa.py +++ b/modules/interrogate/vqa.py @@ -965,7 +965,6 @@ def smol( else: text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=True) except (TypeError, ValueError) as e: - # Fallback for models that don't support continue_final_message or for mismatched kwargs debug(f'VQA interrogate: handler=smol chat_template fallback add_generation_prompt=True: {e}') text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=True) if use_prefill and use_thinking: @@ -1319,8 +1318,11 @@ def interrogate(question:str='', system_prompt:str=None, prompt:str=None, image: # Convert friendly prompt names to internal tokens/commands if question == "Use Prompt": - # Use content from Prompt field directly - question = prompt if (prompt is not None and len(prompt) > 0) else "" + # Use content from Prompt field directly - requires user input + if not prompt or len(prompt.strip()) < 2: + shared.log.error(f'VQA interrogate: model="{model_name}" error="Please enter a prompt"') + return ('Error: Please enter a question or instruction in the Prompt field.', None) + question = prompt elif question in vlm_prompt_mapping: # Check if this is a mode that requires user input (Point/Detect) raw_mapping = vlm_prompt_mapping.get(question) @@ -1333,10 +1335,6 @@ def interrogate(question:str='', system_prompt:str=None, prompt:str=None, image: question = get_internal_prompt(question, prompt) # else: question is already an internal token or custom text - # Fallback for empty questions - if len(question) < 2: - question = "Describe the image." - """ if shared.sd_loaded: from modules.sd_models import apply_balanced_offload # prevent circular import