Skip to content

Add parameter string output to Input Parameters node #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

LaVie024
Copy link

This is to easily gather a string from given parameters which is useful in workflows with multiple KSampler nodes and we want to get information from those nodes to put into the final image (currently an extra info embedding for the Image Saver node doesn't exist but I'll look into creating a PR for that), or to also be used as a streamlined way to view the given parameters in a workflow.

2025-05-26_01-07_1

Copy link

coderabbitai bot commented May 26, 2025

📝 Walkthrough

Walkthrough

The InputParameters class in nodes_selectors.py was updated to introduce a new output: a formatted string that summarizes parameter values. This involved adding a "STRING" type and "parameters_string" name to the output declarations, and updating tooltips accordingly. The class's input method now accepts two additional parameters: string_prefix (a customizable string separator) and include_seed (a boolean to toggle seed inclusion). The method generating outputs was modified to sanitize the prefix, format the summary string based on these new options, and append it to the returned values. The re module was imported to assist with prefix sanitization.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 356dbb5 and 4722965.

📒 Files selected for processing (1)
  • nodes_selectors.py (4 hunks)
🔇 Additional comments (3)
nodes_selectors.py (3)

125-126: LGTM! Class output declarations updated correctly.

The RETURN_TYPES and RETURN_NAMES have been properly extended to include the new string output parameter.


136-136: LGTM! Output tooltip added appropriately.

The tooltip for the new parameters string output is consistent with the existing tooltip format.


153-154: LGTM! New input parameters are well-defined.

The new input parameters string_prefix and include_seed have appropriate defaults and helpful tooltips. The string_prefix default of ", " is reasonable for parameter concatenation.

LaVie024 and others added 6 commits May 26, 2025 05:12
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@LaVie024
Copy link
Author

LaVie024 commented Jun 5, 2025

@alexopus It's been two weeks, any thoughts on this PR yet?

@alexopus
Copy link
Owner

alexopus commented Jun 5, 2025

I've actually started something similar here already: https://github.com/alexopus/ComfyUI-Image-Saver/blob/master/nodes.py#L82 but using a typed container instead of a string for exchange. And also introducing a simpler saver node that accepts only the container as input without the individual parameters (but still with image settings).

But I don't have time to work on that at the moment.

@alexopus
Copy link
Owner

alexopus commented Jun 9, 2025

I've now added a saver node that accepts a typed metadata container.
Now, if I understand this PR correctly, you'd like to be able to gather parameters from multiple nodes, so maybe you would need something like a "edit metadata" node.

In any case, I don't like dealing with comma separated strings as exchange format. Can you describe an example of your desired workflow. Then we can see if we can make it work with the new Metadata structure.

@LaVie024
Copy link
Author

LaVie024 commented Jun 9, 2025

I've now added a saver node that accepts a typed metadata container. Now, if I understand this PR correctly, you'd like to be able to gather parameters from multiple nodes, so maybe you would need something like a "edit metadata" node.

In any case, I don't like dealing with comma separated strings as exchange format. Can you describe an example of your desired workflow. Then we can see if we can make it work with the new Metadata structure.

Firstly, I use this in one of my workflows that has both an initial ksampler and a hiresfix ksampler. Due to this, it is basically hard to get the metadata for both of them under normal circumstances. Now I use Comfyui-Image-Saver just for the input parameters nodes, of course I do just use SD-Prompt-Saver node for the actual saving (mainly because it has some benefits, like using sampler/sched/etc. names as combos instead of inputs which is more compatible with rgthree's context nodes), and that has an extra info input that just accepts a string.

Even examining the new sd-prompt-saver nodes, they lack this crucial extra infos input, which to me, is something that is necessary for workflows with a lot of parameters like what I do. My intention with the parameter nodes being able to output a string is simple: collect all necessary information, condense it into a string, and let it be saved, which allows it to be more modular.

@alexopus
Copy link
Owner

alexopus commented Jun 9, 2025

Maybe it's worth making dedicated node(s) just for handling such strings only - create/edit & save them with images. Mixing this string based approach with individual parameters may become confusing. Not sure.

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.

2 participants