ComfyUI Node Runs on cloud

XY Input: Prompt S/R

Prompt S/R

By jags111·Created 3 years ago·Updated 4 months ago· 1,487
XY Input: Prompt S/R
    • X or Y
    target_prompt
    search_txt
    replace_count3
    replace_1
    replace_2
    replace_3
    replace_4
    replace_5
    replace_6
    replace_7
    replace_8
    replace_9
    replace_10
    replace_11
    replace_12
    replace_13
    replace_14
    replace_15
    replace_16
    replace_17
    replace_18
    replace_19
    replace_20
    replace_21
    replace_22
    replace_23
    replace_24
    replace_25
    replace_26
    replace_27
    replace_28
    replace_29
    replace_30
    replace_31
    replace_32
    replace_33
    replace_34
    replace_35
    replace_36
    replace_37
    replace_38
    replace_39
    replace_40
    replace_41
    replace_42
    replace_43
    replace_44
    replace_45
    replace_46
    replace_47
    replace_48
    replace_49

    Prompt S/R - "search and replace" - is the XY input for comparing prompt wording. You pick a word or phrase in your prompt, then list a bunch of replacements, and the plot generates one image per replacement with everything else held constant. Want to see "a photo of a red car" versus green, blue, and black, same seed and composition? This is the node. It's a straight port of Automatic1111's Prompt S/R plot mode, and it's the cleanest way to isolate the effect of a single prompt change.

    On its own it does nothing - it feeds an XY Plot node.

    How it works

    You tell it the exact text to find (search_txt) and give it a list of things to swap in. The first cell of the plot uses your original prompt as-is (the search text stays), and each subsequent cell replaces the search text with the next replacement value. So with search text "red" and replacements "green", "blue", the plot is three cells: red, green, blue. Everything the KSampler does is identical except that one substituted word.

    The search is literal, so whatever you type in search_txt has to appear exactly in your actual prompt - same spelling, same case.

    The inputs and outputs

    • target_prompt - positive or negative. Which prompt the search-and-replace runs on.
    • search_txt - the text to find in that prompt. This must match a substring of the prompt you're actually using, character for character.
    • replace_count - how many replacement slots to show. Default 3.
    • replace_1, replace_2, … - the replacement values, one per cell.

    The output is labelled X or Y (XY type) → into the X or Y input of an XY Plot node.

    Installing it

    ComfyUI Manager → search Efficiency Nodes for ComfyUI, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jags111/efficiency-nodes-comfyui
    

    Restart after. No extra downloads.

    Common issues

    The number-one failure is a search_txt that doesn't exactly match your prompt. If the search text isn't found, the replacement can't happen and the cell just renders your original prompt - so you get a row of identical images and wonder why. Copy the phrase straight out of your prompt to be safe, and watch the capitalization.

    Second gotcha: your prompt lives on the Efficient Loader (or whatever's encoding it), and the plot only works through an XY Plot feeding an Efficient KSampler. The search runs against that prompt, so make sure you're editing the right one.

    Pack-wide: if the node's missing, look for IMPORT FAILED in the console (often a pip freeze error), and update ComfyUI, the packages and the node. This pack tends to break on ComfyUI frontend updates; updating to the latest commit is the standard fix.

    CategoryEfficiency Nodes/XY Inputs

    Inputs (52)

    NameTypeDefaultDescription
    target_promptCOMBO2 options: positive, negative
    search_txtSTRING
    replace_countINT30–49
    replace_1STRING
    replace_2STRING
    replace_3STRING
    replace_4STRING
    replace_5STRING
    replace_6STRING
    replace_7STRING
    replace_8STRING
    replace_9STRING
    replace_10STRING
    replace_11STRING
    replace_12STRING
    replace_13STRING
    replace_14STRING
    replace_15STRING
    replace_16STRING
    replace_17STRING
    replace_18STRING
    replace_19STRING
    replace_20STRING
    replace_21STRING
    replace_22STRING
    replace_23STRING
    replace_24STRING
    replace_25STRING
    replace_26STRING
    replace_27STRING
    replace_28STRING
    replace_29STRING
    replace_30STRING
    replace_31STRING
    replace_32STRING
    replace_33STRING
    replace_34STRING
    replace_35STRING
    replace_36STRING
    replace_37STRING
    replace_38STRING
    replace_39STRING
    replace_40STRING
    replace_41STRING
    replace_42STRING
    replace_43STRING
    replace_44STRING
    replace_45STRING
    replace_46STRING
    replace_47STRING
    replace_48STRING
    replace_49STRING

    Outputs (1)

    NameTypeDescription
    X or YXY