adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
2.02k stars 261 forks source link

support new SYNTAX something like `__&wildcard__` in yaml #791

Open bluelovers opened 3 months ago

bluelovers commented 3 months ago
test-wildcards-root:
  # new Syntax
  random1:
    # should for return >= 2
    - >-
      {2-$$__test-wildcards-root/a1__}
    # should for return >= 3
    - >-
      {3-$$__test-wildcards-root/a3__}
    # should for return >= 6
    - >-
      {6-$$__test-wildcards-root/a4__}
  # new Syntax for make a1 = [bbb1, bbb2, bbb3, bbb4]
  a1:
    - __&test-wildcards-root/b1__
  # new Syntax for make a3 = [bbb1, bbb2, bbb3, bbb4, a333]
  a3:
    - __&test-wildcards-root/b1__
    - a333
  # new Syntax for make a4 = [bbb1, bbb2, bbb3, bbb4, b222, b2222, b22222, a333]
  a4:
    - __&test-wildcards-root/b*__
    - a333
  # current always return only 1
  random2:
    - >-
      {2-$$__test-wildcards-root/a2__}
  a2:
    - __test-wildcards-root/b1__
  b1:
    - bbb1
    - bbb2
    - bbb3
    - bbb4
  b2:
    - b222
    - b2222
    - b22222
ryankhart commented 3 weeks ago

Any luck on finding a solution to this yet? This is what I've been trying to figure out as well. I'm trying to figure out which extension is the best place to request this change since I use this, plus a1111-sd-webui-tagcomplete, plus Umi-AI-Embeds to allow the autocomplete to work with YAML wildcards as per the tagcomplete extension's readme. But it seems like those other two extensions might just deal with the autocomplete aspect as YAML wildcards still work with just sd-dymanic-prompts installed alone.

akx commented 3 weeks ago

I'm sorry, the examples don't help me understand what this feature would do.

ryankhart commented 2 weeks ago

I don't really know what of all that example yaml text has to do with anything. I was just looking at the title of this issue.

The problem is that the sd-dymanic-prompt feature to "Save template to metadata: Write prompt template into the PNG metadata" does not work when the prompt template includes wildcards that come from .yaml files. Instead, it just takes the end prompt with the expanded text taken from all wildcards (.yaml or .txt) and puts that into the template metadata instead.

What we want is for that template to include the text that existed in the positive and negative prompt boxes before we clicked on the "Generate" button.

Edit: I'm just realizing that this might be a separate issue. I might just open this up in a new issues and copy and paste what I wrote there. I just saw "wildcard" and "yaml" and my mind made an assumption.