feat(dynamicprompts): support wildcards and prevent hang on unknown wildcards#9290
Open
Pfannkuchensack wants to merge 2 commits into
Open
feat(dynamicprompts): support wildcards and prevent hang on unknown wildcards#9290Pfannkuchensack wants to merge 2 commits into
Pfannkuchensack wants to merge 2 commits into
Conversation
…ildcards Wire up dynamicprompts' WildcardManager so `__name__` references resolve against .txt files in a new `wildcards/` directory (configurable via the `wildcards_dir` setting). Both the /utilities/dynamicprompts endpoint and the DynamicPrompt node now build the manager from this path. Referencing an unknown wildcard previously hung the combinatorial generator forever: its not-found fallback yields the wrapped wildcard infinitely, and the variant dedup logic discards those duplicates without ever advancing. This froze the UI prompt preview. Unknown wildcards are now detected up front and reported as a clear error instead of attempting generation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wire up dynamicprompts' WildcardManager so
__name__references resolve against .txt files in a newwildcards/directory (configurable via thewildcards_dirsetting). Both the /utilities/dynamicprompts endpoint and the DynamicPrompt node now build the manager from this path.Referencing an unknown wildcard previously hung the combinatorial generator forever: its not-found fallback yields the wrapped wildcard infinitely, and the variant dedup logic discards those duplicates without ever advancing. This froze the UI prompt preview. Unknown wildcards are now detected up front and reported as a clear error instead of attempting generation.
Related Issues / Discussions
N/A — reported by a user whose dynamic prompt (
{__random__8chan|fenster|stuff}) froze the prompt preview. The__random__was parsed as a wildcard reference rather than literal text.#9137 adds wildcard too.
QA Instructions
Hang fix (the actual bug):
{__random__a|b|c}.No values found for wildcard(s): random.Wildcard feature:
<invokeai_root>/wildcards/animals.txtwith one value per line:__animals__in a prompt (also works inside variants, e.g.a {__animals__|house}).__subdir/name__.wildcards/directory is created automatically on first use; the location is configurable via thewildcards_dirsetting.Automated tests:
Merge Plan
Standard merge — no special handling required. Changes are additive and backwards-compatible:
wildcards_dirconfig setting (defaults towildcards/); no migration needed.docs/src/generated/settings.jsonwas regenerated to include the new setting.Checklist
settings.jsonWhat's Newcopy (if doing a release after this PR)