TextGenerate: use_default_template semantics are counterintuitive and system_prompt handling is confusing
Summary
When TextGenerate is configured with use_default_template=True, the node currently passes the user-provided system_prompt into clip.tokenize(...) instead of ignoring it, even though the label and user expectation suggest that the default model/template system prompt should be used.
This makes the behavior counterintuitive: users naturally expect that enabling the default template means the node will use the built-in template/system prompt, while turning it off means skip-template behavior.
Reproduction
This issue reproduces in the current code in comfy_extras/nodes_textgen.py:
tokens = clip.tokenize(prompt, image=image, skip_template=not use_default_template, min_length=1, thinking=thinking, video=video, audio=audio, system_prompt=system_prompt if use_default_template else "")The current behavior is:
use_default_template=True:skip_template=False, and the user-providedsystem_promptis passed to the tokenizer.use_default_template=False:skip_template=True, andsystem_promptis set to an empty string.
Expected behavior
A more intuitive behavior would be:
use_default_template=True: use the node/model default template and default system prompt; ignore the user-providedsystem_promptvalue.use_default_template=Falseandsystem_promptprovided: still apply a template so the user-specifiedsystem_promptcan be inserted, or otherwise clearly document that customsystem_promptis ignored when templates are disabled.use_default_template=Falseand nosystem_prompt: skip template and pass raw text through.
This matches the plain-English meaning of the flag and matches the expectation most users have when they see the option name.
Why this is confusing
The tooltip currently describes the field as:
"Use the built in system prompt/template if the model has one."
and the system_prompt field says:
"Replaces the system prompt in the model's chat template. Ignored when the default template is not used."
Those descriptions suggest that use_default_template=True is the path that should actually use the built-in default template/system prompt, not the path that allows overriding it.
Affected files
comfy_extras/nodes_textgen.py- likely tokenizer implementations under
comfy/text_encoders/*that interpretskip_templateandsystem_prompt
Proposed fix direction
Adjust the logic so that the template skip behavior matches the flag semantics more closely:
skip_template = not use_default_template and not bool(system_prompt)
tokens = clip.tokenize(
prompt,
image=image,
skip_template=skip_template,
min_length=1,
thinking=thinking,
video=video,
audio=audio,
system_prompt="" if use_default_template else system_prompt,
)This preserves the default-template behavior when enabled, while allowing a user-provided system_prompt to take effect when the default template is intentionally disabled.
Context
User report and local version information were provided in the session context:
- Repo:
Comfy-Org/ComfyUI - Current local program version noted in the provided document: ComfyUI version
0.37.0 - Relevant model:
CILP/qwen3.5_9B_qwen_image_2.1_pe_t2i.int8_convort.safetensors
Notes
This is a behavior clarification / likely bug report about use_default_template semantics, not a request to add a completely new feature.
Source: Comfy-Org/ComfyUI