ljleb / prompt-fusion-extension

auto1111 webui extension for all sorts of prompt interpolations!
MIT License
259 stars 16 forks source link

alternating interpolation syntax #54

Closed ljleb closed 11 months ago

ljleb commented 1 year ago

Add a way of using the [ a | b | c ] syntax for interpolated alternation between multiple conds, instead of jumping straight at each cond directly. Work in progress, but I am thinking [ a | b | c : speed] would be somewhat consistent with the other syntax constructs like prompt editing or prompt interpolation.

The default speed is 1, which represents a sequential iteration. This should be the same as the behavior in the webui without the extension.

Speed is a number indicating how quickly should the alternation iterate over its prompts. With [ a | b | c : 0.25 ], 4 steps will be dedicated to a, then 4 to b, then 4 to c, then 4 to a, and on and on. The first step is always the first prompt in the list, while the rest of the steps are always spent interpolating with the next prompts.

Speed can be a float (for example, [ a | b | c : 1.1 ]), which will sample more chaotically the embeds. If speed is greater than 1, then it will start skipping bits of each prompt and land between 2 prompts. For example, a speed of 2 will skip one embed in two, a speed of 3 will skip two embeds in three, a speed of 4 will skip three embeds in four, etc.

Later I may add more options, for example [ a | b | c : 0.333 : pingpong ] could be nice to have.