From 2701ebac07cda5ef2fdc2b4f4af8556c4b410ee6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 18 May 2026 12:21:18 -0400 Subject: [PATCH] Update README with new features and improve autocomplete filtering. --- README.md | 14 ++++++++++---- js/autotag.js | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d428b3a..4b2e1e7 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,15 @@ A sophisticated multi-line text node for ComfyUI that provides weighted autocomp * **Visual Clarity:** Easily see and manage long lists of tags without the clutter of raw text. ### ๐ŸŽฒ Powerful Randomization -* **Randomize Button:** Instantly generate a set of random tags with a single click. -* **Density Control:** Use the `max_tags` input to set a limit (1โ€“100) on how many tags are generated. +* **Random All:** Instantly replaces your current tags with a fresh set of random tags. +* **Add Random:** Appends a new set of unique random tags to your existing list. +* **Density Control:** Use the `max_tags` input to set a limit (1โ€“100) on how many tags are generated or added. * **Category Scoping:** Randomization respects your selected tag files. +### ๐Ÿงน Quick Actions +* **Clear All:** A dedicated "Clear" button to wipe your entire tag list in one click. +* **Flexible Filtering:** Autocomplete treats spaces and underscores as interchangeable, making it easy to find tags regardless of how you type them. + ### ๐Ÿ“ Multi-File Library * **File Selection Menu:** Click the "Files โ–พ" button to choose exactly which tag files to use for suggestions and randomization. * **Category Scoping:** Organize your tags into specialized files (e.g., `style.txt`, `physical.txt`, `settings.txt`). @@ -40,8 +45,9 @@ A sophisticated multi-line text node for ComfyUI that provides weighted autocomp 1. **Add Node:** Search for "Auto Tag Node" in the ComfyUI node menu (Category: `CustomNodes`). 2. **Type Tags:** Click inside the text area and start typing. Use the autocomplete list to find tags quickly. 3. **Manage Files:** Click the **Files โ–พ** button to toggle specific categories on or off. -4. **Randomize:** Set a value for `max_tags` and click **Randomize** to instantly populate your prompt with varied concepts. -5. **Connect:** Plug the `STRING` output into any node that accepts text (e.g., CLIP Text Encode). +4. **Randomize:** Use **Random All** to replace your tags, or **Add Random** to append to them based on the `max_tags` value. +5. **Clear:** Use the **Clear** button to quickly empty the tag list. +6. **Connect:** Plug the `STRING` output into any node that accepts text (e.g., CLIP Text Encode). ## Customizing the Tag Library diff --git a/js/autotag.js b/js/autotag.js index cbad285..3db4371 100644 --- a/js/autotag.js +++ b/js/autotag.js @@ -375,7 +375,11 @@ app.registerExtension({ input.style.height = Math.max(20, input.scrollHeight) + "px"; const query = input.value.toLowerCase().trim(); if (!query) { autocomplete.style.display = "none"; return; } - filteredTags = tagsData.filter(t => t.tag.toLowerCase().includes(query)).slice(0, 20); + + const regexQuery = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\s+/g, '[ _]'); + const regex = new RegExp(regexQuery, "i"); + filteredTags = tagsData.filter(t => regex.test(t.tag)).slice(0, 20); + if (filteredTags.length === 0) { autocomplete.style.display = "none"; return; } autocomplete.innerHTML = "";