Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbb5f66a1f | ||
|
|
cacee5ddad | ||
|
|
42f5e73515 | ||
|
|
52e5d2fd5f | ||
|
|
397c90275f |
@@ -150,6 +150,7 @@ For example, by preparing the following CSV, you can quickly insert correspondin
|
||||
|
||||
- **Enable Autocomplete**: Enable/disable the autocomplete feature.
|
||||
- **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.
|
||||
- **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).
|
||||
|
||||
@@ -148,6 +148,7 @@ worst_quality,5,9999999,
|
||||
|
||||
- **Enable Autocomplete**: オートコンプリート機能の有効化/無効化
|
||||
- **Max Suggestions**: オートコンプリート候補の最大表示件数
|
||||
- **Auto-Insert Comma**: タグの挿入時、末尾にカンマを追加する
|
||||
- **Replace '_' with 'Space'**: タグ挿入時にアンダースコアをスペースに置き換えます。この設定は関連タグ表示にも影響します
|
||||
- **Enable Loras and Embeddings**: LoraとEmbeddingを候補に表示する
|
||||
- **Use Fast Search**: オートコンプリート候補の検索を高速な処理に切り替える(詳細は [オートコンプリートの高速検索について](#オートコンプリートの高速検索について) を確認してください)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"tooltip": "This setting also affects related tags display."
|
||||
},
|
||||
"AutocompletePlus_Autocompletion_AutoInsertComma": {
|
||||
"name": "Auto Insert Comma",
|
||||
"name": "Auto-Insert Comma",
|
||||
"tooltip": "Automatically insert a comma after tags when inserting from autocomplete."
|
||||
},
|
||||
"AutocompletePlus_Autocompletion_MaxSuggestions": {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-autocomplete-plus"
|
||||
description = "Autocomplete and Related Tag display for ComfyUI"
|
||||
version = "1.6.1"
|
||||
version = "1.7.1"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["",]
|
||||
|
||||
|
||||
+11
-8
@@ -306,7 +306,7 @@ function getCurrentPartialTag(inputElement) {
|
||||
* Inserts the selected tag into the textarea, replacing the partial tag,
|
||||
* making the change undoable.
|
||||
* @param {HTMLTextAreaElement} inputElement
|
||||
* @param {TagData} tagDataToInsert The raw tag string to insert.
|
||||
* @param {TagData} tagDataToInsert
|
||||
*/
|
||||
function insertTagToTextArea(inputElement, tagDataToInsert) {
|
||||
if (!inputElement || !tagDataToInsert) {
|
||||
@@ -408,8 +408,11 @@ class AutocompleteUI {
|
||||
// Add event listener for clicks on items
|
||||
this.tagsList.addEventListener('mousedown', (e) => {
|
||||
const row = e.target.closest('.autocomplete-plus-item');
|
||||
if (row && row.dataset.tag) {
|
||||
this.#insertTag(row.dataset);
|
||||
if (row && row.dataset.index !== undefined) {
|
||||
const tagData = this.candidates[parseInt(row.dataset.index, 10)];
|
||||
if (tagData) {
|
||||
this.#insertTag(tagData);
|
||||
}
|
||||
e.preventDefault(); // Prevent focus loss from input
|
||||
e.stopPropagation();
|
||||
}
|
||||
@@ -500,26 +503,26 @@ class AutocompleteUI {
|
||||
const existingTags = extractTagsFromTextArea(this.target);
|
||||
const currentTag = getCurrentPartialTag(this.target);
|
||||
|
||||
this.candidates.forEach((tagData) => {
|
||||
this.candidates.forEach((tagData, index) => {
|
||||
const isExactMatch = tagData.tag === currentTag && (existingTags.filter(item => item === currentTag).length == 1);
|
||||
const isExistingTag = !isExactMatch && existingTags.includes(tagData.tag);
|
||||
this.#createTagElement(tagData, isExistingTag);
|
||||
this.#createTagElement(tagData, index, isExistingTag);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tag element for the autocomplete list.
|
||||
* @param {TagData} tagData
|
||||
* @param {number} tagDataIndex
|
||||
* @param {boolean} isExisting
|
||||
*/
|
||||
#createTagElement(tagData, isExisting) {
|
||||
#createTagElement(tagData, tagDataIndex, isExisting) {
|
||||
const categoryText = TagCategory[tagData.source][tagData.category] || "unknown";
|
||||
const aliasText = tagData.alias.join(', ');
|
||||
|
||||
const tagRow = document.createElement('div');
|
||||
tagRow.classList.add('autocomplete-plus-item', tagData.source);
|
||||
tagRow.dataset.tag = tagData.tag;
|
||||
tagRow.dataset.tagCategory = categoryText;
|
||||
tagRow.dataset.index = tagDataIndex;
|
||||
|
||||
// Tag icon and name
|
||||
const tagSourceIconHtml = `<svg class="autocomplete-plus-tag-icon-svg"><use xlink:href="#autocomplete-plus-icon-${tagData.source}"></use></svg>`;
|
||||
|
||||
+2
-2
@@ -318,11 +318,11 @@ app.registerExtension({
|
||||
},
|
||||
{
|
||||
id: id + ".Autocompletion.AutoInsertComma",
|
||||
name: "Auto Insert Comma",
|
||||
name: "Auto-Insert Comma",
|
||||
tooltip: "Automatically insert a comma after tags when inserting from autocomplete.",
|
||||
type: "boolean",
|
||||
defaultValue: true,
|
||||
category: [name, "Autocompletion", "Auto Insert Comma"],
|
||||
category: [name, "Autocompletion", "Auto-Insert Comma"],
|
||||
onChange: (newVal, oldVal) => {
|
||||
settingValues.autoInsertComma = newVal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user