From 96ba7d80557a760213b7aeae5870865990889d79 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Wed, 12 Nov 2025 20:00:35 +0900 Subject: [PATCH 1/7] feat: Add auto insert comma setting for tag insertion (#44) --- web/js/autocomplete.js | 4 ++-- web/js/main.js | 11 +++++++++++ web/js/settings.js | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index da1c52b..1b164ce 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -347,9 +347,9 @@ function insertTagToTextArea(inputElement, tagDataToInsert) { const needsSpaceBefore = text[replaceStart - 1] === ','; const prefix = needsSpaceBefore ? ' ' : ''; - // Standard separator (comma + space) + // 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 ? ', ' : ''; + const suffix = (needsSuffixAfter && settingValues.autoInsertComma) ? ', ' : ''; const textToInsertWithAffixes = prefix + normalizedTag + suffix; diff --git a/web/js/main.js b/web/js/main.js index 4ac711a..dea96ef 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -317,6 +317,17 @@ app.registerExtension({ settingValues.replaceUnderscoreWithSpace = newVal; } }, + { + id: id + ".auto_insert_comma", + name: "Auto Insert Comma", + tooltip: "Automatically insert a comma after tags when inserting from autocomplete or related tags", + type: "boolean", + defaultValue: true, + category: [name, "Autocompletion", "Auto Insert Comma"], + onChange: (newVal, oldVal) => { + settingValues.autoInsertComma = newVal; + } + }, { id: id + ".max_suggestions", name: "Max suggestions", diff --git a/web/js/settings.js b/web/js/settings.js index c1d8397..1e12424 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 + autoInsertComma: true, // Related tags feature settings enableRelatedTags: true, From 2552e8d746f79104b05c68609f38f0d94edb72eb Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Wed, 12 Nov 2025 20:19:27 +0900 Subject: [PATCH 2/7] feat: Implement addWeightToLora function (#46) --- tests/js/autocomplete.test.js | 13 ++++- tests/js/utils.test.js | 101 +++++++++++++++++++++++++++++++++- web/js/autocomplete.js | 10 +++- web/js/utils.js | 31 ++++++++++- 4 files changed, 148 insertions(+), 7 deletions(-) diff --git a/tests/js/autocomplete.test.js b/tests/js/autocomplete.test.js index 90e3d6a..f6bc0a0 100644 --- a/tests/js/autocomplete.test.js +++ b/tests/js/autocomplete.test.js @@ -353,7 +353,18 @@ describe('Autocomplete Functions', () => { insertTagToTextArea(textarea, tagData); }).not.toThrow(); - expect(textarea.value).toBe(', '); + expect(textarea.value).toBe(', '); + }); + + test('should complete embedding tag without adding weight', () => { + const textarea = createMockTextarea('embedding:', 10); + const tagData = { tag: 'embedding:my_embedding', source: 'embeddings' }; + + expect(() => { + insertTagToTextArea(textarea, tagData); + }).not.toThrow(); + + expect(textarea.value).toBe('embedding:my_embedding, '); }); test('should handle wildcard tag insertion', () => { diff --git a/tests/js/utils.test.js b/tests/js/utils.test.js index 38b23a1..8a2a9f1 100644 --- a/tests/js/utils.test.js +++ b/tests/js/utils.test.js @@ -4,7 +4,8 @@ import { normalizeTagToSearch, normalizeTagToInsert, getCurrentTagRange, - findAllTagPositions + findAllTagPositions, + addWeightToLora } from '../../web/js/utils.js'; // filepath: web/js/utils.test.js @@ -440,3 +441,101 @@ describe('findAllTagPositions', () => { expect(positions[5].tag).toBe('last'); }); }); + +describe('addWeightToModel', () => { + test('should return null or empty string for invalid inputs', () => { + expect(addWeightToLora(null)).toBeNull(); + expect(addWeightToLora(undefined)).toBeUndefined(); + expect(addWeightToLora('')).toBe(''); + }); + + // LoRA format tests + test('should add default weight to LoRA without weight', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + test('should preserve existing weight in LoRA', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + test('should handle LoRA with path separators', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + test('should handle LoRA with symbols', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + test('should handle case-insensitive LoRA tags', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + // Custom default weight tests + test('should use custom default weight for LoRA', () => { + expect(addWeightToLora('', 0.5)).toBe(''); + expect(addWeightToLora('', 1.5)).toBe(''); + expect(addWeightToLora('', 2.0)).toBe(''); + }); + + test('should not override existing weight even with custom default', () => { + expect(addWeightToLora('', 2.0)).toBe(''); + }); + + // Non-model format tests + test('should return non-model tags as-is', () => { + expect(addWeightToLora('blue_hair')).toBe('blue_hair'); + expect(addWeightToLora('1girl')).toBe('1girl'); + expect(addWeightToLora('standing:1.2')).toBe('standing:1.2'); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('random:text:format')).toBe('random:text:format'); + }); + + // Edge cases + test('should handle malformed LoRA tags', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('lora:my_style01')).toBe('lora:my_style01'); + }); + + test('should handle decimal weights correctly', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + test('should handle special characters in model names', () => { + expect(addWeightToLora('')).toBe(''); + expect(addWeightToLora('')).toBe(''); + }); + + // Embedding format tests - should not be modified + test('should not modify embedding tags without weight', () => { + expect(addWeightToLora('embedding:my_embedding')).toBe('embedding:my_embedding'); + expect(addWeightToLora('embedding:character_emb')).toBe('embedding:character_emb'); + expect(addWeightToLora('embedding:style_embedding')).toBe('embedding:style_embedding'); + }); + + test('should not modify embedding tags with existing weight', () => { + expect(addWeightToLora('embedding:my_embedding:0.8')).toBe('embedding:my_embedding:0.8'); + expect(addWeightToLora('embedding:character_emb:1.2')).toBe('embedding:character_emb:1.2'); + expect(addWeightToLora('embedding:style_embedding:0.5')).toBe('embedding:style_embedding:0.5'); + }); + + test('should not modify embedding tags regardless of case', () => { + expect(addWeightToLora('EMBEDDING:my_embedding')).toBe('EMBEDDING:my_embedding'); + expect(addWeightToLora('Embedding:character_emb')).toBe('Embedding:character_emb'); + expect(addWeightToLora('EmBeDdInG:style_emb')).toBe('EmBeDdInG:style_emb'); + expect(addWeightToLora('EMBEDDING:my_embedding:0.9')).toBe('EMBEDDING:my_embedding:0.9'); + }); +}); diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index 1b164ce..0c20796 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -18,7 +18,8 @@ import { getCurrentTagRange, getViewportMargin, getScrollbarWidth, - IconSvgHtmlString + IconSvgHtmlString, + addWeightToLora } from './utils.js'; import { settingValues } from './settings.js'; @@ -331,8 +332,11 @@ function insertTagToTextArea(inputElement, tagDataToInsert) { let replaceEnd = cursorPos; let normalizedTag; - if (Object.values(ModelTagSource).includes(tagDataToInsert.source)) { - // If the tag is from a model tag source, don't want to normalize it + if (tagDataToInsert.source === ModelTagSource.Lora) { + // If the tag is from a LoRA source, add weight to it + normalizedTag = addWeightToLora(tagDataToInsert.tag); + } else if (Object.values(ModelTagSource).includes(tagDataToInsert.source)) { + // If the tag is from other model tag sources (e.g., Embeddings), don't normalize it normalizedTag = tagDataToInsert.tag; } else { normalizedTag = normalizeTagToInsert(tagDataToInsert.tag); diff --git a/web/js/utils.js b/web/js/utils.js index 969c973..ed59fc8 100644 --- a/web/js/utils.js +++ b/web/js/utils.js @@ -558,11 +558,38 @@ export function getCurrentTagRange(text, cursorPos) { return { start: adjustedStart, end: adjustedEnd, tag: adjustedTag }; } +/** + * Adds weight to a lora tag if it doesn't already have one. + * @param {string} loraTag The model tag string (e.g., "" + * @param {number} defaultWeight The default weight to add if not present + * @returns {string} The model tag with weight (e.g., "") + */ +export function addWeightToLora(loraTag, defaultWeight = 1.0) { + if (!loraTag) return loraTag; + + // Match LoRA format: or + const loraMatch = loraTag.match(/^(:]+)(:[0-9.]+)?>$/i); + if (loraMatch) { + const existingWeight = loraMatch[2]; + + // If weight already exists, return as-is + if (existingWeight) { + return loraTag; + } + + // Add default weight, preserving original case + return `${loraMatch[1]}:${defaultWeight.toFixed(1)}>`; + } + + // If it's not a recognized model format, return as-is + return loraTag; +} + // --- End String Helper Functions --- /** * Load a CSS file dynamically. - * @param {string} href + * @param {string} href */ export function loadCSS(href) { const link = document.createElement('link'); @@ -624,6 +651,6 @@ export function getScrollbarWidth() { _cachedScrollbarWidth = outer.offsetWidth - inner.offsetWidth; document.body.removeChild(outer); - + return _cachedScrollbarWidth; } From d6f53ebb0f91cc9fcd03544153c2aadf65ae4157 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Mon, 20 Oct 2025 02:33:22 +0900 Subject: [PATCH 3/7] fix: Update setting IDs to follow i18n-friendly naming conventions --- web/js/main.js | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/web/js/main.js b/web/js/main.js index dea96ef..c2b1e5e 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -171,13 +171,13 @@ async function addExtraSettings() { checkButton.disabled = false; } } - + // Fetch last check time from API let lastCheckTimeText = "Loading..."; try { const response = await fetch('/autocomplete-plus/csv/last-check-time'); const data = await response.json(); - + if (data.last_check_time) { const lastCheckDate = new Date(data.last_check_time); lastCheckTimeText = "Last checked: " + lastCheckDate.toLocaleString(); @@ -248,7 +248,7 @@ app.registerExtension({ settings: [ // --- Tag source Settings --- { - id: id + ".tag_source_icon_position", + id: id + ".TagSource.IconPosition", name: "Tag Source Icon Position", type: "combo", options: ["left", "right", "hidden"], @@ -259,7 +259,7 @@ app.registerExtension({ } }, { - id: id + ".primary_tag_source", + id: id + ".TagSource.PrimaryTagSource", name: "Primary source for 'all' Source", tooltip: "When 'Autocomplete Tag Source' is 'all', this determines which source's tags appear first in suggestions.", type: "combo", @@ -271,7 +271,7 @@ app.registerExtension({ } }, { - id: id + ".tag_source", + id: id + ".TagSource", name: "Autocomplete Tag Source", tooltip: "Select the tag source for autocomplete suggestions. 'all' includes tags from all loaded sources.", type: "combo", @@ -285,7 +285,7 @@ app.registerExtension({ // --- Autocomplete Settings --- { - id: id + ".use_fast_search", + id: id + ".Autocompletion.UseFastSearch", name: "Use Fast Search", tooltip: "Tag search processing during text input operates faster, improving responsiveness", type: "boolean", @@ -296,9 +296,8 @@ app.registerExtension({ } }, { - id: id + ".enable_models", + id: id + ".Autocompletion.EnableModels", name: "Enable Loras and Embeddings", - tooltip: "Enable Lora and Embedding suggestions", type: "boolean", defaultValue: true, category: [name, "Autocompletion", "Enable Loras and Embeddings"], @@ -307,7 +306,7 @@ app.registerExtension({ } }, { - id: id + ".replace_underscore_with_space", + id: id + ".Autocompletion.ReplaceUnderscoreWithSpace", name: "Replace '_' with 'Space'", tooltip: "This setting also affects related tags display.", type: "boolean", @@ -318,7 +317,7 @@ app.registerExtension({ } }, { - id: id + ".auto_insert_comma", + id: id + ".Autocompletion.AutoInsertComma", name: "Auto Insert Comma", tooltip: "Automatically insert a comma after tags when inserting from autocomplete or related tags", type: "boolean", @@ -329,7 +328,7 @@ app.registerExtension({ } }, { - id: id + ".max_suggestions", + id: id + ".Autocompletion.MaxSuggestions", name: "Max suggestions", type: "slider", attrs: { @@ -344,9 +343,8 @@ app.registerExtension({ } }, { - id: id + ".boolean", + id: id + ".Autocompletion.Enable", name: "Enable Autocomplete", - description: "Enable or disable the autocomplete feature.", type: "boolean", defaultValue: true, category: [name, "Autocompletion", "Enable Autocomplete"], @@ -357,9 +355,9 @@ app.registerExtension({ // --- Related Tags Settings --- { - id: id + ".related_tags_trigger_mode", + id: id + ".RelatedTags.RelatedTagsTriggerMode", name: "Related Tags Trigger Mode", - description: "Trigger mode for related tags (click or ctrl+click)", + tooltip: "Choose to display the tag by clicking it or by pressing Ctrl+click.", type: "combo", options: ["click", "ctrl+Click"], defaultValue: "click", @@ -369,9 +367,9 @@ app.registerExtension({ } }, { - id: id + ".related_tags_position", + id: id + ".RelatedTags.DisplayPosition", name: "Default Display Position", - description: "Display position (relative to Textarea)", + tooltip: "Display position (relative to Textarea)", type: "combo", options: ["horizontal", "vertical"], defaultValue: "horizontal", @@ -381,9 +379,8 @@ app.registerExtension({ } }, { - id: id + ".max_related_tags", + id: id + ".RelatedTags.MaxRelatedTags", name: "Max related tags", - description: "Maximum number of related tags to display", type: "slider", attrs: { min: 5, @@ -397,9 +394,8 @@ app.registerExtension({ } }, { - id: id + ".related_tags_enable", + id: id + ".RelatedTags.Enable", name: "Enable Related Tags", - description: "Enable or disable the related tags feature.", type: "boolean", defaultValue: true, category: [name, "Related Tags", "Enable Related Tags"], @@ -410,15 +406,15 @@ app.registerExtension({ // --- Display settings --- { - id: id + ".display_hide_alias", + id: id + ".Display.HideAlias", name: "Hide Alias", - tooltip: "Hide alias in the autocomplete and related tags display", + tooltip: "Hide alias column in the autocomplete and related tags display", type: "boolean", defaultValue: false, category: [name, "Display", "Hide Alias"], onChange: (newVal, oldVal) => { settingValues.hideAlias = newVal; } - } + }, ] }); \ No newline at end of file From f2ff83088d753dd7a5414b472b9151f79759d472 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Mon, 20 Oct 2025 02:36:38 +0900 Subject: [PATCH 4/7] feat: Add Japanese localization files and update setting descriptions in README --- README.md | 2 +- docs/README_jp.md | 2 +- locales/en/main.json | 9 ++++++ locales/en/settings.json | 66 ++++++++++++++++++++++++++++++++++++++++ locales/ja/main.json | 9 ++++++ locales/ja/settings.json | 66 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 locales/en/main.json create mode 100644 locales/en/settings.json create mode 100644 locales/ja/main.json create mode 100644 locales/ja/settings.json diff --git a/README.md b/README.md index 2dbca90..aa42875 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ For example, by preparing the following CSV, you can quickly insert correspondin - **Enable Related Tags**: Enable/disable the related tags feature. - **Max related tags**: Maximum number of related tags to display. - **Default Display Position**: Default display position when ComfyUI starts. -- **Related Tags Trigger Mode**: Which action will trigger displaying related tags (click only, Ctrl+click) +- **Related Tags Trigger Mode**: Which action will trigger displaying related tags for the entered tag (click only, Ctrl+click) ### Display diff --git a/docs/README_jp.md b/docs/README_jp.md index 67c3366..aa62f5a 100644 --- a/docs/README_jp.md +++ b/docs/README_jp.md @@ -157,7 +157,7 @@ worst_quality,5,9999999, - **Enable Related Tags**: 関連タグ機能の有効化/無効化 - **Max related tags**: 関連タグの最大表示件数 - **Default Display Position**: ComfyUI起動時のデフォルト表示位置 -- **Related Tags Trigger Mode** : 関連タグを表示する際、どの操作をトリガーとするか(クリックのみ、Ctrl+クリック) +- **Related Tags Trigger Mode** : 入力済みのタグの関連タグを表示する際、どの操作をトリガーとするか(クリックのみ、Ctrl+クリック) ### 表示 diff --git a/locales/en/main.json b/locales/en/main.json new file mode 100644 index 0000000..be1d093 --- /dev/null +++ b/locales/en/main.json @@ -0,0 +1,9 @@ +{ + "settingsCategories": { + "Autocomplete Plus": "Autocomplete Plus", + "Tag Source": "Tag Source", + "Autocompletion": "Autocompletion", + "Related Tags": "Related Tags", + "Display": "Display" + } +} \ No newline at end of file diff --git a/locales/en/settings.json b/locales/en/settings.json new file mode 100644 index 0000000..a9e583d --- /dev/null +++ b/locales/en/settings.json @@ -0,0 +1,66 @@ +{ + "AutocompletePlus_TagSource_IconPosition": { + "name": "Tag Source Icon Position", + "options": { + "left": "Left", + "right": "Right", + "hidden": "Hidden" + } + }, + "AutocompletePlus_TagSource_PrimaryTagSource": { + "name": "Primary source for 'all' Source", + "tooltip": "When 'Autocomplete Tag Source' is 'all', this determines which source's tags appear first in suggestions.", + "options": { + "danbooru": "Danbooru", + "e621": "e621" + } + }, + "AutocompletePlus_TagSource": { + "name": "Autocomplete Tag Source", + "tooltip": "Select the tag source for autocomplete suggestions. 'all' includes tags from all loaded sources.", + "options": { + "danbooru": "Danbooru", + "e621": "e621", + "all": "all" + } + }, + "AutocompletePlus_Autocompletion_UseFastSearch": { + "name": "Use Fast Search", + "tooltip": "Tag search processing during text input operates faster, improving responsiveness" + }, + "AutocompletePlus_Autocompletion_EnableModels": { + "name": "Enable Loras and Embeddings" + }, + "AutocompletePlus_Autocompletion_MaxSuggestions": { + "name": "Max suggestions" + }, + "AutocompletePlus_Autocompletion_Enable": { + "name": "Enable Autocomplete" + }, + "AutocompletePlus_RelatedTags_RelatedTagsTriggerMode": { + "name": "Related Tags Trigger Mode", + "tooltip": "Which action will trigger displaying related tags for the entered tag (click only, Ctrl+click)", + "options": { + "click": "Click", + "ctrl+Click": "Ctrl+Click" + } + }, + "AutocompletePlus_RelatedTags_DisplayPosition": { + "name": "Default Display Position", + "tooltip": "Display position (relative to Textarea)", + "options": { + "horizontal": "Horizontal", + "vertical": "Vertical" + } + }, + "AutocompletePlus_RelatedTags_MaxRelatedTags": { + "name": "Max related tags" + }, + "AutocompletePlus_RelatedTags_Enable": { + "name": "Enable Related Tags" + }, + "AutocompletePlus_Display_HideAlias": { + "name": "Hide Alias", + "tooltip": "Hide alias column in the autocomplete and related tags display" + } +} \ No newline at end of file diff --git a/locales/ja/main.json b/locales/ja/main.json new file mode 100644 index 0000000..f81e15d --- /dev/null +++ b/locales/ja/main.json @@ -0,0 +1,9 @@ +{ + "settingsCategories": { + "Autocomplete Plus": "Autocomplete Plus", + "Tag Source": "タグソース", + "Autocompletion": "オートコンプリート", + "Related Tags": "関連タグ", + "Display": "表示" + } +} \ No newline at end of file diff --git a/locales/ja/settings.json b/locales/ja/settings.json new file mode 100644 index 0000000..2229c7f --- /dev/null +++ b/locales/ja/settings.json @@ -0,0 +1,66 @@ +{ + "AutocompletePlus_TagSource_IconPosition": { + "name": "タグソースのアイコン位置", + "options": { + "left": "左", + "right": "右", + "hidden": "非表示" + } + }, + "AutocompletePlus_TagSource_PrimaryTagSource": { + "name": "優先して表示するタグソース", + "tooltip": "オートコンプリートのタグソースが「全て」のとき、ここで指定したタグソースが優先して表示されます", + "options": { + "danbooru": "Danbooru", + "e621": "e621" + } + }, + "AutocompletePlus_TagSource": { + "name": "オートコンプリートのタグソース", + "tooltip": "オートコンプリート候補に表示するタグソース。\n「全て」を選択するとロード済みの全てのタグソースを表示します", + "options": { + "danbooru": "Danbooru", + "e621": "e621", + "all": "全て" + } + }, + "AutocompletePlus_Autocompletion_UseFastSearch": { + "name": "高速検索の有効化", + "tooltip": "候補の検索を高速な処理に切り替えます。\n入力時の遅延が改善される場合があります" + }, + "AutocompletePlus_Autocompletion_EnableModels": { + "name": "LoraとEmbeddingを候補に表示する" + }, + "AutocompletePlus_Autocompletion_MaxSuggestions": { + "name": "候補の最大表示件数" + }, + "AutocompletePlus_Autocompletion_Enable": { + "name": "オートコンプリート機能の有効化" + }, + "AutocompletePlus_RelatedTags_RelatedTagsTriggerMode": { + "name": "関連タグを表示する操作", + "tooltip": "入力済みのタグの関連タグを表示する際、どの操作をトリガーとするか(クリックのみ、Ctrl+クリック)", + "options": { + "click": "クリック", + "ctrl+Click": "Ctrl+クリック" + } + }, + "AutocompletePlus_RelatedTags_DisplayPosition": { + "name": "デフォルト表示位置", + "tooltip": "入力中のテキストエリアを基準に、どの位置に表示するか", + "options": { + "horizontal": "水平", + "vertical": "垂直" + } + }, + "AutocompletePlus_RelatedTags_MaxRelatedTags": { + "name": "関連タグの最大表示件数" + }, + "AutocompletePlus_RelatedTags_Enable": { + "name": "関連タグ機能の有効化" + }, + "AutocompletePlus_Display_HideAlias": { + "name": "エイリアスを非表示", + "tooltip": "オートコンプリートと関連タグで表示されるエイリアス列を非表示にします" + } +} \ No newline at end of file From 1203e2f0ef5af2f04eccfc3bb94e7464ec88acff Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Mon, 20 Oct 2025 03:28:44 +0900 Subject: [PATCH 5/7] feat: Add Chinese and Traditional Chinese localization files (machine translated) --- locales/zh-TW/main.json | 9 +++++ locales/zh-TW/settings.json | 66 +++++++++++++++++++++++++++++++++++++ locales/zh/main.json | 9 +++++ locales/zh/settings.json | 66 +++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 locales/zh-TW/main.json create mode 100644 locales/zh-TW/settings.json create mode 100644 locales/zh/main.json create mode 100644 locales/zh/settings.json diff --git a/locales/zh-TW/main.json b/locales/zh-TW/main.json new file mode 100644 index 0000000..10d1af3 --- /dev/null +++ b/locales/zh-TW/main.json @@ -0,0 +1,9 @@ +{ + "settingsCategories": { + "Autocomplete Plus": "Autocomplete Plus", + "Tag Source": "標籤來源", + "Autocompletion": "自動完成", + "Related Tags": "相關標籤", + "Display": "顯示" + } +} \ No newline at end of file diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json new file mode 100644 index 0000000..be65b65 --- /dev/null +++ b/locales/zh-TW/settings.json @@ -0,0 +1,66 @@ +{ + "AutocompletePlus_TagSource_IconPosition": { + "name": "標籤來源圖示位置", + "options": { + "left": "左", + "right": "右", + "hidden": "隱藏" + } + }, + "AutocompletePlus_TagSource_PrimaryTagSource": { + "name": "「全部」選擇時的主要來源", + "tooltip": "當自動完成標籤來源為「全部」時,此設定決定哪個來源的標籤優先顯示在建議中。", + "options": { + "danbooru": "Danbooru", + "e621": "e621" + } + }, + "AutocompletePlus_TagSource": { + "name": "自動完成標籤來源", + "tooltip": "選擇自動完成建議的標籤來源。選擇「全部」將包含所有已載入來源的標籤。", + "options": { + "danbooru": "Danbooru", + "e621": "e621", + "all": "全部" + } + }, + "AutocompletePlus_Autocompletion_UseFastSearch": { + "name": "啟用快速搜尋", + "tooltip": "標籤搜尋處理更快,提高文字輸入時的回應速度" + }, + "AutocompletePlus_Autocompletion_EnableModels": { + "name": "顯示Lora和Embedding" + }, + "AutocompletePlus_Autocompletion_MaxSuggestions": { + "name": "最大提示數" + }, + "AutocompletePlus_Autocompletion_Enable": { + "name": "啟用自動完成" + }, + "AutocompletePlus_RelatedTags_RelatedTagsTriggerMode": { + "name": "顯示相關標籤的操作", + "tooltip": "指定觸發顯示已輸入標籤的相關標籤的操作(僅點擊、Ctrl+點擊)", + "options": { + "click": "點擊", + "ctrl+Click": "Ctrl+點擊" + } + }, + "AutocompletePlus_RelatedTags_DisplayPosition": { + "name": "預設顯示位置", + "tooltip": "相對於文字區域的顯示位置", + "options": { + "horizontal": "水平", + "vertical": "垂直" + } + }, + "AutocompletePlus_RelatedTags_MaxRelatedTags": { + "name": "最大相關標籤數" + }, + "AutocompletePlus_RelatedTags_Enable": { + "name": "啟用相關標籤" + }, + "AutocompletePlus_Display_HideAlias": { + "name": "隱藏別名", + "tooltip": "隱藏自動完成和相關標籤顯示中的別名欄" + } +} \ No newline at end of file diff --git a/locales/zh/main.json b/locales/zh/main.json new file mode 100644 index 0000000..03a1abc --- /dev/null +++ b/locales/zh/main.json @@ -0,0 +1,9 @@ +{ + "settingsCategories": { + "Autocomplete Plus": "Autocomplete Plus", + "Tag Source": "标签来源", + "Autocompletion": "自动完成", + "Related Tags": "相关标签", + "Display": "显示" + } +} \ No newline at end of file diff --git a/locales/zh/settings.json b/locales/zh/settings.json new file mode 100644 index 0000000..a12a3aa --- /dev/null +++ b/locales/zh/settings.json @@ -0,0 +1,66 @@ +{ + "AutocompletePlus_TagSource_IconPosition": { + "name": "标签来源图标位置", + "options": { + "left": "左", + "right": "右", + "hidden": "隐藏" + } + }, + "AutocompletePlus_TagSource_PrimaryTagSource": { + "name": "'全部'选择时的主要来源", + "tooltip": "当自动完成标签来源为\"全部\"时,此设置决定哪个来源的标签优先显示在建议中。", + "options": { + "danbooru": "Danbooru", + "e621": "e621" + } + }, + "AutocompletePlus_TagSource": { + "name": "自动完成标签来源", + "tooltip": "选择自动完成建议的标签来源。选择\"全部\"将包含所有已加载来源的标签。", + "options": { + "danbooru": "Danbooru", + "e621": "e621", + "all": "全部" + } + }, + "AutocompletePlus_Autocompletion_UseFastSearch": { + "name": "启用快速搜索", + "tooltip": "标签搜索处理更快,提高文本输入时的响应速度" + }, + "AutocompletePlus_Autocompletion_EnableModels": { + "name": "显示Lora和Embedding" + }, + "AutocompletePlus_Autocompletion_MaxSuggestions": { + "name": "最大提示数" + }, + "AutocompletePlus_Autocompletion_Enable": { + "name": "启用自动完成" + }, + "AutocompletePlus_RelatedTags_RelatedTagsTriggerMode": { + "name": "显示相关标签的操作", + "tooltip": "指定触发显示已输入标签的相关标签的操作(仅点击、Ctrl+点击)", + "options": { + "click": "点击", + "ctrl+Click": "Ctrl+点击" + } + }, + "AutocompletePlus_RelatedTags_DisplayPosition": { + "name": "默认显示位置", + "tooltip": "相对于文本区域的显示位置", + "options": { + "horizontal": "水平", + "vertical": "垂直" + } + }, + "AutocompletePlus_RelatedTags_MaxRelatedTags": { + "name": "最大相关标签数" + }, + "AutocompletePlus_RelatedTags_Enable": { + "name": "启用相关标签" + }, + "AutocompletePlus_Display_HideAlias": { + "name": "隐藏别名", + "tooltip": "隐藏自动完成和相关标签显示中的别名列" + } +} \ No newline at end of file From 2c8877060c27c1456288278506d7f72c3ef8238f Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Wed, 12 Nov 2025 21:05:46 +0900 Subject: [PATCH 6/7] feat: Added translations for new settings --- locales/en/settings.json | 16 ++++++++++++---- locales/ja/settings.json | 8 ++++++++ locales/zh-TW/settings.json | 8 ++++++++ locales/zh/settings.json | 8 ++++++++ web/js/main.js | 10 +++++----- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/locales/en/settings.json b/locales/en/settings.json index a9e583d..3b552fa 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -26,11 +26,19 @@ }, "AutocompletePlus_Autocompletion_UseFastSearch": { "name": "Use Fast Search", - "tooltip": "Tag search processing during text input operates faster, improving responsiveness" + "tooltip": "Tag search processing during text input operates faster, improving responsiveness." }, "AutocompletePlus_Autocompletion_EnableModels": { "name": "Enable Loras and Embeddings" }, + "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { + "name": "Replace '_' with 'Space'", + "tooltip": "This setting also affects related tags display." + }, + "AutocompletePlus_Autocompletion_AutoInsertComma": { + "name": "Auto Insert Comma", + "tooltip": "Automatically insert a comma after tags when inserting from autocomplete." + }, "AutocompletePlus_Autocompletion_MaxSuggestions": { "name": "Max suggestions" }, @@ -39,7 +47,7 @@ }, "AutocompletePlus_RelatedTags_RelatedTagsTriggerMode": { "name": "Related Tags Trigger Mode", - "tooltip": "Which action will trigger displaying related tags for the entered tag (click only, Ctrl+click)", + "tooltip": "Which action will trigger displaying related tags for the entered tag (click only, Ctrl+click).", "options": { "click": "Click", "ctrl+Click": "Ctrl+Click" @@ -47,7 +55,7 @@ }, "AutocompletePlus_RelatedTags_DisplayPosition": { "name": "Default Display Position", - "tooltip": "Display position (relative to Textarea)", + "tooltip": "Display position (relative to Textarea).", "options": { "horizontal": "Horizontal", "vertical": "Vertical" @@ -61,6 +69,6 @@ }, "AutocompletePlus_Display_HideAlias": { "name": "Hide Alias", - "tooltip": "Hide alias column in the autocomplete and related tags display" + "tooltip": "Hide alias column in the autocomplete and related tags display." } } \ No newline at end of file diff --git a/locales/ja/settings.json b/locales/ja/settings.json index 2229c7f..b66ecda 100644 --- a/locales/ja/settings.json +++ b/locales/ja/settings.json @@ -31,6 +31,14 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "LoraとEmbeddingを候補に表示する" }, + "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { + "name": "'_' を 'スペース' に置き換える", + "tooltip": "この設定は関連タグ表示にも影響します" + }, + "AutocompletePlus_Autocompletion_AutoInsertComma": { + "name": "カンマを自動で追加する", + "tooltip": "オートコンプリート確定時、タグの末尾に自動でカンマを追加する" + }, "AutocompletePlus_Autocompletion_MaxSuggestions": { "name": "候補の最大表示件数" }, diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json index be65b65..591d4d5 100644 --- a/locales/zh-TW/settings.json +++ b/locales/zh-TW/settings.json @@ -31,6 +31,14 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "顯示Lora和Embedding" }, + "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { + "name": "將'_'替換為'空格'", + "tooltip": "此設定也會影響相關標籤顯示" + }, + "AutocompletePlus_Autocompletion_AutoInsertComma": { + "name": "自動插入逗號", + "tooltip": "從自動完成插入標籤時自動在標籤後添加逗號" + }, "AutocompletePlus_Autocompletion_MaxSuggestions": { "name": "最大提示數" }, diff --git a/locales/zh/settings.json b/locales/zh/settings.json index a12a3aa..c795fa0 100644 --- a/locales/zh/settings.json +++ b/locales/zh/settings.json @@ -31,6 +31,14 @@ "AutocompletePlus_Autocompletion_EnableModels": { "name": "显示Lora和Embedding" }, + "AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": { + "name": "将'_'替换为'空格'", + "tooltip": "此设置也会影响相关标签显示" + }, + "AutocompletePlus_Autocompletion_AutoInsertComma": { + "name": "自动插入逗号", + "tooltip": "从自动完成插入标签时自动在标签后添加逗号" + }, "AutocompletePlus_Autocompletion_MaxSuggestions": { "name": "最大提示数" }, diff --git a/web/js/main.js b/web/js/main.js index c2b1e5e..ae50e02 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -287,7 +287,7 @@ app.registerExtension({ { id: id + ".Autocompletion.UseFastSearch", name: "Use Fast Search", - tooltip: "Tag search processing during text input operates faster, improving responsiveness", + tooltip: "Tag search processing during text input operates faster, improving responsiveness.", type: "boolean", defaultValue: false, category: [name, "Autocompletion", "Use Fast Search"], @@ -319,7 +319,7 @@ app.registerExtension({ { id: id + ".Autocompletion.AutoInsertComma", name: "Auto Insert Comma", - tooltip: "Automatically insert a comma after tags when inserting from autocomplete or related tags", + tooltip: "Automatically insert a comma after tags when inserting from autocomplete.", type: "boolean", defaultValue: true, category: [name, "Autocompletion", "Auto Insert Comma"], @@ -357,7 +357,7 @@ app.registerExtension({ { id: id + ".RelatedTags.RelatedTagsTriggerMode", name: "Related Tags Trigger Mode", - tooltip: "Choose to display the tag by clicking it or by pressing Ctrl+click.", + tooltip: "Which action will trigger displaying related tags for the entered tag (click only, Ctrl+click).", type: "combo", options: ["click", "ctrl+Click"], defaultValue: "click", @@ -369,7 +369,7 @@ app.registerExtension({ { id: id + ".RelatedTags.DisplayPosition", name: "Default Display Position", - tooltip: "Display position (relative to Textarea)", + tooltip: "Display position (relative to Textarea).", type: "combo", options: ["horizontal", "vertical"], defaultValue: "horizontal", @@ -408,7 +408,7 @@ app.registerExtension({ { id: id + ".Display.HideAlias", name: "Hide Alias", - tooltip: "Hide alias column in the autocomplete and related tags display", + tooltip: "Hide alias column in the autocomplete and related tags display.", type: "boolean", defaultValue: false, category: [name, "Display", "Hide Alias"], From 397c90275f04991b46f0b9f83ea2e463763c59a6 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Wed, 12 Nov 2025 21:37:14 +0900 Subject: [PATCH 7/7] docs: Add auto insert comma setting to README --- README.md | 1 + docs/README_jp.md | 1 + locales/en/settings.json | 2 +- web/js/main.js | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa42875..f632368 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/docs/README_jp.md b/docs/README_jp.md index aa62f5a..8c1bc10 100644 --- a/docs/README_jp.md +++ b/docs/README_jp.md @@ -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**: オートコンプリート候補の検索を高速な処理に切り替える(詳細は [オートコンプリートの高速検索について](#オートコンプリートの高速検索について) を確認してください) diff --git a/locales/en/settings.json b/locales/en/settings.json index 3b552fa..06b9665 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -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": { diff --git a/web/js/main.js b/web/js/main.js index ae50e02..9facef4 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -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; }