Fixed optional params

This commit is contained in:
Sirshendu Ganguly
2026-06-04 22:57:16 +05:30
parent bc916d597f
commit 1b4b89f55d
3 changed files with 37 additions and 8 deletions
+15 -1
View File
@@ -225,7 +225,21 @@ class txt2img:
def VALIDATE_INPUTS(cls, **kwargs):
positivePrompt = kwargs.get("positivePrompt", "")
negativePrompt = kwargs.get("negativePrompt", "")
settings = kwargs.get("settings")
structured_prompt = None
if isinstance(settings, dict):
structured_prompt = settings.get("structuredPrompt")
has_structured_prompt = (
isinstance(structured_prompt, dict) and len(structured_prompt) > 0
)
has_positive_prompt = bool(positivePrompt and str(positivePrompt).strip())
if has_structured_prompt and has_positive_prompt:
return (
"settings.structuredPrompt and positivePrompt are mutually exclusive. "
"Clear positivePrompt or disconnect Structured Prompt from Settings."
)
# Only validate positivePrompt length if it's provided
if positivePrompt and len(positivePrompt) > 10000:
return "Positive Prompt is too long. Maximum length is 10000 characters."