diff --git a/web/comfyui/autocomplete.js b/web/comfyui/autocomplete.js index 11653538..2e94f8df 100644 --- a/web/comfyui/autocomplete.js +++ b/web/comfyui/autocomplete.js @@ -1,7 +1,7 @@ import { api } from "../../scripts/api.js"; import { app } from "../../scripts/app.js"; import { TextAreaCaretHelper } from "./textarea_caret_helper.js"; -import { getPromptCustomWordsAutocompletePreference } from "./settings.js"; +import { getPromptTagAutocompletePreference } from "./settings.js"; // Command definitions for category filtering const TAG_COMMANDS = { @@ -461,7 +461,7 @@ class AutoComplete { searchTerm = (match[1] || '').trim(); } - // For prompt model type, check if we're searching embeddings or custom words + // For prompt model type, check if we're searching embeddings, commands, or tags if (this.modelType === 'prompt') { const match = rawSearchTerm.match(/^emb:(.*)$/i); if (match) { @@ -471,8 +471,8 @@ class AutoComplete { this.searchType = 'embeddings'; this.activeCommand = null; this.showingCommands = false; - } else if (getPromptCustomWordsAutocompletePreference()) { - // Setting enabled - check for command mode + } else { + // Check for command mode FIRST (always runs, regardless of setting) const commandResult = this._parseCommandInput(rawSearchTerm); if (commandResult.showCommands) { @@ -498,18 +498,18 @@ class AutoComplete { endpoint = `/lm/custom-words/search?category=${categories}`; this.searchType = 'custom_words'; } - } else { - // No command - regular custom words search with enriched results + } else if (getPromptTagAutocompletePreference()) { + // No command and setting enabled - regular tag search with enriched results this.showingCommands = false; this.activeCommand = null; endpoint = '/lm/custom-words/search?enriched=true'; searchTerm = rawSearchTerm; this.searchType = 'custom_words'; + } else { + // No command and setting disabled - no autocomplete for direct typing + this.hide(); + return; } - } else { - // Setting disabled - no autocomplete for non-emb: terms - this.hide(); - return; } } diff --git a/web/comfyui/settings.js b/web/comfyui/settings.js index 3917f8af..7610a6df 100644 --- a/web/comfyui/settings.js +++ b/web/comfyui/settings.js @@ -10,8 +10,8 @@ const TRIGGER_WORD_WHEEL_SENSITIVITY_DEFAULT = 0.02; const AUTO_PATH_CORRECTION_SETTING_ID = "loramanager.auto_path_correction"; const AUTO_PATH_CORRECTION_DEFAULT = true; -const PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_SETTING_ID = "loramanager.prompt_custom_words_autocomplete"; -const PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_DEFAULT = true; +const PROMPT_TAG_AUTOCOMPLETE_SETTING_ID = "loramanager.prompt_tag_autocomplete"; +const PROMPT_TAG_AUTOCOMPLETE_DEFAULT = true; // ============================================================================ // Helper Functions @@ -69,28 +69,28 @@ const getAutoPathCorrectionPreference = (() => { }; })(); -const getPromptCustomWordsAutocompletePreference = (() => { +const getPromptTagAutocompletePreference = (() => { let settingsUnavailableLogged = false; return () => { const settingManager = app?.extensionManager?.setting; if (!settingManager || typeof settingManager.get !== "function") { if (!settingsUnavailableLogged) { - console.warn("LoRA Manager: settings API unavailable, using default custom words autocomplete setting."); + console.warn("LoRA Manager: settings API unavailable, using default tag autocomplete setting."); settingsUnavailableLogged = true; } - return PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_DEFAULT; + return PROMPT_TAG_AUTOCOMPLETE_DEFAULT; } try { - const value = settingManager.get(PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_SETTING_ID); - return value ?? PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_DEFAULT; + const value = settingManager.get(PROMPT_TAG_AUTOCOMPLETE_SETTING_ID); + return value ?? PROMPT_TAG_AUTOCOMPLETE_DEFAULT; } catch (error) { if (!settingsUnavailableLogged) { - console.warn("LoRA Manager: unable to read custom words autocomplete setting, using default.", error); + console.warn("LoRA Manager: unable to read tag autocomplete setting, using default.", error); settingsUnavailableLogged = true; } - return PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_DEFAULT; + return PROMPT_TAG_AUTOCOMPLETE_DEFAULT; } }; })(); @@ -124,11 +124,11 @@ app.registerExtension({ category: ["LoRA Manager", "Automation", "Auto path correction"], }, { - id: PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_SETTING_ID, - name: "Enable Custom Words Autocomplete in Prompt Nodes", + id: PROMPT_TAG_AUTOCOMPLETE_SETTING_ID, + name: "Enable Tag Autocomplete in Prompt Nodes", type: "boolean", - defaultValue: PROMPT_CUSTOM_WORDS_AUTOCOMPLETE_DEFAULT, - tooltip: "When enabled, prompt nodes will autocomplete custom words. When disabled, only 'emb:' prefix will trigger embeddings autocomplete.", + defaultValue: PROMPT_TAG_AUTOCOMPLETE_DEFAULT, + tooltip: "When enabled, typing will trigger tag autocomplete suggestions. Commands (e.g., /character, /artist) always work regardless of this setting.", category: ["LoRA Manager", "Autocomplete", "Prompt"], }, ], @@ -138,4 +138,4 @@ app.registerExtension({ // Exports // ============================================================================ -export { getWheelSensitivity, getAutoPathCorrectionPreference, getPromptCustomWordsAutocompletePreference }; +export { getWheelSensitivity, getAutoPathCorrectionPreference, getPromptTagAutocompletePreference };