adieyal / dynamicprompts

Templating language for generating prompts for text to image generators such as Stable Diffusion
MIT License
118 stars 20 forks source link

(feat) Dynamic Wildcards #114

Closed mwootendev closed 6 months ago

mwootendev commented 9 months ago

This is actually a complete replacement of the work done in #110. This will replace the main source code added in that PR, but retain the test cases to ensure backwards compatibility.

After trying to refactor #110 into a cleaner solution, I came to a better understanding of how the library was structured. The original solution supported variables, but seemed like a hack.

The new solution updates wildcards to support either strings or Commands for the wildcard value. This now permits actual VariableAccessCommand or SequenceCommand instances as the value, which are resolved before resolving the wildcard. This new implementation also supports variants in the wildcard path. Wildcards of the form __wildcard/${variable:default}__ and __wildcard/{opt1|opt2|opt3}__ are now supported.

codecov-commenter commented 9 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ff47441) 97.43% compared to head (744f5f3) 97.45%.

Files Patch % Lines
src/dynamicprompts/commands/wildcard_command.py 66.66% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #114 +/- ## ========================================== + Coverage 97.43% 97.45% +0.01% ========================================== Files 77 77 Lines 3352 3337 -15 ========================================== - Hits 3266 3252 -14 + Misses 86 85 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.