From a673ed241174e0ff80048569cb10a1aed49a38bd Mon Sep 17 00:00:00 2001 From: vladmandic Date: Fri, 23 Jan 2026 10:07:38 +0100 Subject: [PATCH] support comments in wildcard files Signed-off-by: vladmandic --- CHANGELOG.md | 1 + modules/styles.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f237b63f5..7a8b6ee49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - **Features** - **caption** tab support for Booru tagger models, thanks @CalamitousFelicitousness - add SmilingWolf WD14/WaifuDiffusion tagger models, thanks @CalamitousFelicitousness + - support comments in wildcard files, using `#` - support aliases in metadata skip params, thanks @CalamitousFelicitousness - **Internal** - **cuda**: update to `torch==2.10.0` diff --git a/modules/styles.py b/modules/styles.py index 5164f6870..d14e7bc4f 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -144,8 +144,10 @@ def apply_file_wildcards(prompt, replaced = [], not_found = [], recursion=0, see try: with open(file, 'r', encoding='utf-8') as f: lines = f.readlines() + lines = [line.split('#')[0].strip('\n').strip() for line in lines] + lines = [line for line in lines if len(line) > 0] if len(lines) > 0: - choice = random.choice(lines).strip(' \n') + choice = random.choice(lines) if '|' in choice: choice = random.choice(choice.split('|')).strip(' []{}\n') prompt = prompt.replace(f"__{wildcard}__", choice, 1)