From 7f089527c56b1c945a37e52e2396538b4c254ddc Mon Sep 17 00:00:00 2001 From: bedovyy Date: Fri, 6 Feb 2026 11:24:12 +0900 Subject: [PATCH 1/6] feat: add prefixArtist for artist tags --- locales/en/settings.json | 3 +++ locales/ja/settings.json | 3 +++ locales/zh-TW/settings.json | 3 +++ locales/zh/settings.json | 3 +++ web/js/autocomplete.js | 4 +++- web/js/main.js | 12 +++++++++++- web/js/settings.js | 1 + 7 files changed, 27 insertions(+), 2 deletions(-) diff --git a/locales/en/settings.json b/locales/en/settings.json index 25a33cc..902440f 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -31,6 +31,9 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "Enable Loras and Embeddings" }, + "AutocompletePlus_Autocompletion_PrefixArtist": { + "name": "String to add before artist tags" + }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "Replace '_' with 'Space'", "tooltip": "This setting also affects related tags display." diff --git a/locales/ja/settings.json b/locales/ja/settings.json index b163286..91ee2e4 100644 --- a/locales/ja/settings.json +++ b/locales/ja/settings.json @@ -31,6 +31,9 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "LoraとEmbeddingを候補に表示する" }, + "AutocompletePlus_Autocompletion_PrefixArtist": { + "name": "アーティストタグの前に追加する文字列" + }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "'_' を 'スペース' に置き換える", "tooltip": "この設定は関連タグ表示にも影響します" diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json index b4b406c..bf3f578 100644 --- a/locales/zh-TW/settings.json +++ b/locales/zh-TW/settings.json @@ -31,6 +31,9 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "顯示Lora和Embedding" }, + "AutocompletePlus_Autocompletion_PrefixArtist": { + "name": "在藝術家標籤前添加的字串" + }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "將'_'替換為'空格'", "tooltip": "此設定也會影響相關標籤顯示" diff --git a/locales/zh/settings.json b/locales/zh/settings.json index 287b1f4..18a6f3f 100644 --- a/locales/zh/settings.json +++ b/locales/zh/settings.json @@ -31,6 +31,9 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "显示Lora和Embedding" }, + "AutocompletePlus_Autocompletion_PrefixArtist": { + "name": "在艺术家标签前添加的字符串" + }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "将'_'替换为'空格'", "tooltip": "此设置也会影响相关标签显示" diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index 5c86a20..bdd2ee1 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -351,11 +351,13 @@ function insertTagToTextArea(inputElement, tagDataToInsert) { const needsSpaceBefore = text[replaceStart - 1] === ','; const prefix = needsSpaceBefore ? ' ' : ''; + const prefixArtist = tagDataToInsert.categoryText == 'artist' ? settingValues.prefixArtist : ''; + // Standard separator (comma + space, or empty if autoInsertComma is disabled) const needsSuffixAfter = !",:".includes(text[replaceEnd]); // TODO: If ":" is part of the emoticon, a suffix is ​​required (e.g. ":o") const suffix = (needsSuffixAfter && settingValues.autoInsertComma) ? ', ' : ''; - const textToInsertWithAffixes = prefix + normalizedTag + suffix; + const textToInsertWithAffixes = prefix + prefixArtist + normalizedTag + suffix; // --- Use execCommand for Undo support --- // 1. Select the text range to be replaced diff --git a/web/js/main.js b/web/js/main.js index 4673fa5..82e1773 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -377,6 +377,16 @@ app.registerExtension({ settingValues.enableModels = newVal; } }, + { + id: id + ".Autocompletion.PrefixArtist", + name: "String to add before artist tags", + type: "text", + defaultValue: '', + category: [name, "Autocompletion", "String to add before artist tags"], + onChange: (newVal, oldVal) => { + settingValues.prefixArtist = newVal; + } + }, { id: id + ".Autocompletion.ReplaceUnderscoreWithSpace", name: "Replace '_' with 'Space'", @@ -535,4 +545,4 @@ app.registerExtension({ }, }, ] -}); \ No newline at end of file +}); diff --git a/web/js/settings.js b/web/js/settings.js index 726fc79..5688ec6 100644 --- a/web/js/settings.js +++ b/web/js/settings.js @@ -10,6 +10,7 @@ export const settingValues = { enableModels: true, // Enable Lora and Embedding suggestions useFastSearch: false, replaceUnderscoreWithSpace: true, // Replace underscores with spaces in tag insertion + prefixArtist: '', // Prefix to be attached before artist tags autoInsertComma: true, // Related tags feature settings From 4be66d7132f52910d08747746f6f4246a39a79f7 Mon Sep 17 00:00:00 2001 From: Sebastiano Gallo Date: Fri, 13 Feb 2026 16:32:42 +0100 Subject: [PATCH 2/6] FIX: Support new 'element' prop in comfyui frontend The new comfyui-frontend versions don't use the 'inputEl' prop anymore, they use 'element' prop. This change supports the new prop and is backwards compatible --- web/js/main.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/web/js/main.js b/web/js/main.js index 4673fa5..c0edef1 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -50,18 +50,21 @@ function initializeEventHandlers() { ComfyWidgets.STRING = function (node, inputName, inputData, appInstance) { // Use appInstance to avoid conflict with global app const result = originalStringWidget.apply(this, arguments); - // Check if the widget has an inputEl and if it's a TEXTAREA + // Check if the widget has an element and if it's a TEXTAREA // This is to ensure we are targeting multiline text inputs, related to '.comfy-multiline-input' - if (result && result.widget - && result.widget.inputEl && result.widget.inputEl.tagName === 'TEXTAREA' && !result.widget.inputEl.readOnly) { - const widgetConfig = inputData && inputData[1] ? inputData[1] : {}; - // Future: Add checks for Autocomplete Plus specific configurations if needed - // e.g., if (widgetConfig["AutocompletePlus.enabled"] === false) return result; - - const nodeInfo = new NodeInfo(node.comfyClass || node.constructor.name, inputName); - attachListeners(result.widget.inputEl, nodeInfo); + if (result && result.widget) { + // fallback for older Comfyui frontend versions + const inputEl = result.widget.element ?? result.widget.inputEl; + if (inputEl && inputEl.tagName === 'TEXTAREA' && !inputEl.readOnly) { + const widgetConfig = inputData && inputData[1] ? inputData[1] : {}; + // Future: Add checks for Autocomplete Plus specific configurations if needed + // e.g., if (widgetConfig["AutocompletePlus.enabled"] === false) return result; + + const nodeInfo = new NodeInfo(node.comfyClass || node.constructor.name, inputName); + attachListeners(inputEl, nodeInfo); + } + return result; } - return result; }; } @@ -535,4 +538,4 @@ app.registerExtension({ }, }, ] -}); \ No newline at end of file +}); From b8c250e8368dca0bddbf4a5eb7df7f689da23ac2 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Wed, 18 Feb 2026 19:59:55 +0900 Subject: [PATCH 3/6] fix: Update stylelint job config --- .github/workflows/test.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac959c5..23a7e5d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-hub/stylelint@master - env: - PATTERN : 'web/css/*.css' \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run stylelint + run: npx stylelint "web/css/*.css" \ No newline at end of file From 5aa72379e86000a5eff03f7dc8f93212b7d06299 Mon Sep 17 00:00:00 2001 From: Sebastiano Gallo Date: Wed, 18 Feb 2026 13:56:10 +0100 Subject: [PATCH 4/6] outer return statement --- web/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/main.js b/web/js/main.js index c0edef1..0b9838e 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -63,8 +63,8 @@ function initializeEventHandlers() { const nodeInfo = new NodeInfo(node.comfyClass || node.constructor.name, inputName); attachListeners(inputEl, nodeInfo); } - return result; } + return result; }; } From ce07964a68a615cdad6fd11292e04c0703648d89 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Thu, 19 Feb 2026 19:38:48 +0900 Subject: [PATCH 5/6] feat: Implement debounced search update for autocomplete --- web/js/autocomplete.js | 22 +++++++++++++++++++++- web/js/settings.js | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index bdd2ee1..f87f680 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -941,6 +941,25 @@ export class AutocompleteEventHandler { constructor() { this.autocompleteUI = new AutocompleteUI(); this.keyDownWithModifier = new Map(); // Keep track of keydown events with modifiers + this._debounceTimer = null; // Timer ID for debounced search + } + + /** + * Calls autocompleteUI.updateDisplay() with debounce for sequential search, or immediately for fast search. + * @param {HTMLTextAreaElement} target + */ + _triggerUpdateDisplay(target) { + if (settingValues.useFastSearch || settingValues.searchDebounceTime <= 0) { + // FastSearch or debounce disabled: immediate update + this.autocompleteUI.updateDisplay(target); + } else { + // Sequential search: debounced update + clearTimeout(this._debounceTimer); + this._debounceTimer = setTimeout(() => { + this.autocompleteUI.updateDisplay(target); + this._debounceTimer = null; + }, settingValues.searchDebounceTime); + } } /** @@ -954,6 +973,7 @@ export class AutocompleteEventHandler { const partialTag = getCurrentPartialTag(event.target); if (partialTag.length <= 0) { + clearTimeout(this._debounceTimer); // Cancel pending debounced search this.autocompleteUI.hide(); } } @@ -1064,7 +1084,7 @@ export class AutocompleteEventHandler { // and default action is not prevented, update the display. // This will typically be for character inputs, Delete, Backspace or IME composition. if (!event.defaultPrevented) { - this.autocompleteUI.updateDisplay(event.target); + this._triggerUpdateDisplay(event.target); } } diff --git a/web/js/settings.js b/web/js/settings.js index 5688ec6..cbd47ef 100644 --- a/web/js/settings.js +++ b/web/js/settings.js @@ -12,6 +12,7 @@ export const settingValues = { replaceUnderscoreWithSpace: true, // Replace underscores with spaces in tag insertion prefixArtist: '', // Prefix to be attached before artist tags autoInsertComma: true, + searchDebounceTime: 100, // Sequential search debounce time in milliseconds // Related tags feature settings enableRelatedTags: true, From 4066f58d2550c8ec1caac45347a7f7ebb78f2206 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Sat, 21 Feb 2026 19:03:02 +0900 Subject: [PATCH 6/6] feat: tooltip and doc for PrefixArtist --- README.md | 1 + docs/README_jp.md | 1 + locales/en/settings.json | 3 ++- locales/ja/settings.json | 3 ++- locales/zh-TW/settings.json | 3 ++- locales/zh/settings.json | 3 ++- web/js/main.js | 1 + 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5c60def..11d683b 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ For example, by preparing the following CSV, you can quickly insert correspondin - **Max suggestions**: Maximum number of autocomplete suggestions to display. - **Auto-Insert Comma**: Automatically insert a comma after tags when inserting from autocomplete. - **Replace '_' with 'Space'**: Replaces underscores with spaces when inserting tags. This setting also affects related tag display. +- **String to add before artist tags**: Text to prepend when inserting an artist tag. For Anima models, specify `@`. - **Enable Loras and Embeddings**: Display Lora and Embedding in the suggestions. - **Use Fast Search**: Switch autocomplete suggestions search to fast processing (see [About Fast Search for Autocomplete](#about-fast-search-for-autocomplete) for details). diff --git a/docs/README_jp.md b/docs/README_jp.md index 1c44923..67e522d 100644 --- a/docs/README_jp.md +++ b/docs/README_jp.md @@ -167,6 +167,7 @@ worst_quality,5,9999999, - **Max Suggestions**: オートコンプリート候補の最大表示件数 - **Auto-Insert Comma**: タグの挿入時、末尾にカンマを追加する - **Replace '_' with 'Space'**: タグ挿入時にアンダースコアをスペースに置き換えます。この設定は関連タグ表示にも影響します +- **String to add before artist tags**: アーティストタグを挿入する際に付加する文字列。 Anima モデルの場合は「@」を指定します - **Enable Loras and Embeddings**: LoraとEmbeddingを候補に表示する - **Use Fast Search**: オートコンプリート候補の検索を高速な処理に切り替える(詳細は [オートコンプリートの高速検索について](#オートコンプリートの高速検索について) を確認してください) diff --git a/locales/en/settings.json b/locales/en/settings.json index 902440f..4e469ed 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -32,7 +32,8 @@ "name": "Enable Loras and Embeddings" }, "AutocompletePlus_Autocompletion_PrefixArtist": { - "name": "String to add before artist tags" + "name": "String to add before artist tags", + "tooltip": "Text to prepend when inserting an artist tag via autocomplete.\ne.g. '@' -> '@artist_name'." }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "Replace '_' with 'Space'", diff --git a/locales/ja/settings.json b/locales/ja/settings.json index 91ee2e4..2d79f31 100644 --- a/locales/ja/settings.json +++ b/locales/ja/settings.json @@ -32,7 +32,8 @@ "name": "LoraとEmbeddingを候補に表示する" }, "AutocompletePlus_Autocompletion_PrefixArtist": { - "name": "アーティストタグの前に追加する文字列" + "name": "アーティストタグの前に追加する文字列", + "tooltip": "オートコンプリートからアーティストタグを挿入する際に付加する文字列。\n例: '@' -> '@artist_name'" }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "'_' を 'スペース' に置き換える", diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json index bf3f578..b4f3858 100644 --- a/locales/zh-TW/settings.json +++ b/locales/zh-TW/settings.json @@ -32,7 +32,8 @@ "name": "顯示Lora和Embedding" }, "AutocompletePlus_Autocompletion_PrefixArtist": { - "name": "在藝術家標籤前添加的字串" + "name": "在藝術家標籤前添加的字串", + "tooltip": "透過自動完成插入藝術家標籤時,在標籤前添加的文字。\n例: '@' -> '@artist_name'" }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "將'_'替換為'空格'", diff --git a/locales/zh/settings.json b/locales/zh/settings.json index 18a6f3f..8017344 100644 --- a/locales/zh/settings.json +++ b/locales/zh/settings.json @@ -32,7 +32,8 @@ "name": "显示Lora和Embedding" }, "AutocompletePlus_Autocompletion_PrefixArtist": { - "name": "在艺术家标签前添加的字符串" + "name": "在艺术家标签前添加的字符串", + "tooltip": "通过自动完成插入艺术家标签时,在标签前添加的文本。\n例: '@' -> '@artist_name'" }, "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { "name": "将'_'替换为'空格'", diff --git a/web/js/main.js b/web/js/main.js index c9b71bb..db81ecf 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -383,6 +383,7 @@ app.registerExtension({ { id: id + ".Autocompletion.PrefixArtist", name: "String to add before artist tags", + tooltip: "Text to prepend when inserting an artist tag via autocomplete.\ne.g. '@' -> '@artist_name'.", type: "text", defaultValue: '', category: [name, "Autocompletion", "String to add before artist tags"],