Skip to content

Add support for Style & Prompt node in custom workflows#2276

Merged
Acly merged 1 commit intoAcly:mainfrom
leha-games:krita-prompt-style-node
Jan 24, 2026
Merged

Add support for Style & Prompt node in custom workflows#2276
Acly merged 1 commit intoAcly:mainfrom
leha-games:krita-prompt-style-node

Conversation

@leha-games
Copy link
Copy Markdown
Contributor

@leha-games leha-games commented Jan 16, 2026

Acly/comfyui-tooling-nodes#57

Closes #1380

Features:

  • Prompts and Style sync across Generate/Live/Animation and now Graph workspaces
  • Full prompt evaluation: wildcards, comments, style merging, LoRA extraction (uses existing implementation, no code duplication)
  • LoRAs applied to model output
  • Error shown if workflow contains multiple KritaPromptStyle nodes (only one allowed since prompts sync to shared fields)
  • "Copy Prompt", "Copy Prompt (Evaluated)", "Copy Style" works as expected across workspaces

@leha-games leha-games changed the title Add support for ETN_KritaPromptStyle node Add support for Prompt Style node in custom workflows Jan 16, 2026
Copy link
Copy Markdown
Owner

@Acly Acly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice to have! Just had a few change requests.

case ("ETN_KritaPromptStyle", _):
name = node.input("name", "Style")
yield CustomParam(ParamKind.style, name, node.input("sampler_preset", "auto"))
yield CustomParam(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably enough to just use 1 yield CustomParam(ParamKind.synced_prompt), name)

It's only used to detect whether to show the prompt widget, right? The default also makes no sense to me, since the node doesn't have these inputs.

prompt_style_count = sum(1 for _ in wf.find(type="ETN_KritaPromptStyle"))
if prompt_style_count > 1:
self.validation_error = _(
"Workflow contains multiple Krita Prompt Style nodes. "
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure, but I think you need to put the string in 1 line so it's picked up by the translation script (it's just a crude regex that scans the code for things to translate)

return self.workflow_id or "Custom Workflow"

def collect_parameters(self, layers: "LayerManager", bounds: Bounds, animation=False):
def collect_parameters(self, layers: "LayerManager", bounds: Bounds, animation=False, model=None):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this since it's kinda cyclical.

From what I see, writing the prompt to custom params isn't useful? The prompt comes from the model, which calls this function to write to params, then later it reads it out of params again to prepare/evaluate it. Seems kind of pointless round-trip to me, the model can just read the prompts directly when it prepares them.

if style is None:
return {}

positive = params.get(f"{style_name}/positive_prompt", "")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as noted above, can just read self.regions.positive directly here

arch = resolve_arch(style, self._connection.client_if_connected)
prepared = workflow.prepare_prompts(cond, style, seed, arch, FileLibrary.instance())

params[f"{style_name}/_prepared"] = {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than putting this fake entry into params, I'd prefer to keep it separate.

Extend api.py:

@dataclass
class CustomWorkflowInput:
    workflow: dict
    params: dict[str, Any]
    positive_evaluated: str = ""
    negative_evaluated: str = ""
    loras: list[LoraInput] = field(default_factory=list)

that way it's more explicit and typed

@leha-games
Copy link
Copy Markdown
Contributor Author

Thanks for suggestions. Looks more clean now.
Also added proper Style widget "sync" between workspaces

image

@leha-games leha-games changed the title Add support for Prompt Style node in custom workflows Add support for Style & Prompt node in custom workflows Jan 23, 2026
positive_evaluated: str = ""
negative_evaluated: str = ""
loras: list[LoraInput] = field(default_factory=list)
style: Style | None = None
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some test failures because we can't have Style as part of api structures.

One way to resolve would be to use the exsting fields WorkflowInput.models and WorkflowInput.sampling to pass in the style.get_models() and sampler stuff instead.

@leha-games
Copy link
Copy Markdown
Contributor Author

Something like this?

@Acly
Copy link
Copy Markdown
Owner

Acly commented Jan 23, 2026

This should work. There seems to be a conflict now, please rebase onto main so the tests can run.

If you still need to deal with the formatting issues, you can just run ruff format and it should pass.

@leha-games leha-games force-pushed the krita-prompt-style-node branch from b64cdfc to 29f49c3 Compare January 24, 2026 09:52
Features:
- Prompt and Style widgets sync across Generate/Live/Animation and now Graph workspaces
- Full prompt evaluation: wildcards, comments, layer extraction,
  style merging, LoRA extraction
- LoRAs applied to model output
- Error shown if workflow contains multiple KritaPromptStyle nodes
  (only one allowed since prompts sync to shared fields)
@leha-games leha-games force-pushed the krita-prompt-style-node branch from ea16fa2 to 32b4040 Compare January 24, 2026 10:15
@leha-games
Copy link
Copy Markdown
Contributor Author

Rebased, formatted, squashed the commits

@Acly Acly merged commit 1fcfff2 into Acly:main Jan 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Make Prompt Parameter in Custom Workflows more usable.

2 participants