diff --git a/javascript/ext_modelKeyword.js b/javascript/ext_modelKeyword.js index 8f80c4f..698466a 100644 --- a/javascript/ext_modelKeyword.js +++ b/javascript/ext_modelKeyword.js @@ -5,11 +5,16 @@ async function load() { if (modelKeywordPath.length > 0 && modelKeywordDict.size === 0) { try { - let lines = (await readFile(`${modelKeywordPath}/lora-keyword.txt`)).split("\n"); + let lines = []; + // Only add default keywords if wanted by the user + if (TAC_CFG.modelKeywordCompletion !== "Only user list") + lines = (await readFile(`${modelKeywordPath}/lora-keyword.txt`)).split("\n"); // Add custom user keywords if the file exists if (customFileExists) lines = lines.concat((await readFile(`${modelKeywordPath}/lora-keyword-user.txt`)).split("\n")); + if (lines.length === 0) return; + lines = lines.filter(x => x.trim().length > 0 && x.trim()[0] !== "#") // Remove empty lines and comments // Add to the dict diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index d7ee40a..b3deb3f 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -445,7 +445,7 @@ async function insertTextAtCursor(textArea, result, tagword, tabCompletedWithout // Add lora/lyco keywords if enabled and found let keywordsLength = 0; - if (TAC_CFG.modelKeywordCompletion && modelKeywordPath.length > 0 && (tagType === ResultType.lora || tagType === ResultType.lyco)) { + if (TAC_CFG.modelKeywordCompletion !== "Never" && modelKeywordPath.length > 0 && (tagType === ResultType.lora || tagType === ResultType.lyco)) { if (result.hash && result.hash !== "NOFILE" && result.hash.length > 0) { let keywords = null; let nameDict = modelKeywordDict.get(result.hash); @@ -805,7 +805,7 @@ function rubyTagClicked(node, textBefore, prompt, textArea) { // Check if the last edit was the keyword insertion, and catch undo/redo in that case function checkKeywordInsertionUndo(textArea, event) { - if (!TAC_CFG.modelKeywordCompletion) return; + if (TAC_CFG.modelKeywordCompletion === "Never") return; switch (event.inputType) { case "historyUndo": diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 4a1821d..00cd432 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -324,7 +324,7 @@ def on_ui_settings(): "tac_appendComma": shared.OptionInfo(True, "Append comma on tag autocompletion"), "tac_appendSpace": shared.OptionInfo(True, "Append space on tag autocompletion").info("will append after comma if the above is enabled"), "tac_alwaysSpaceAtEnd": shared.OptionInfo(True, "Always append space if inserting at the end of the textbox").info("takes precedence over the regular space setting for that position"), - "tac_modelKeywordCompletion": shared.OptionInfo(False, "Try to add known trigger words for LORA/LyCO models", gr.Checkbox, lambda: {"interactive": model_keyword_installed}).info("Requires the model-keyword extension to be installed, but will work with it disabled"), + "tac_modelKeywordCompletion": shared.OptionInfo("Never", "Try to add known trigger words for LORA/LyCO models", gr.Dropdown, lambda: {"interactive": model_keyword_installed, "choices": ["Never","Only user list","Always"]}).info("Requires the model-keyword extension to be installed, but will work with it disabled.").needs_restart(), "tac_wildcardCompletionMode": shared.OptionInfo("To next folder level", "How to complete nested wildcard paths", gr.Dropdown, lambda: {"choices": ["To next folder level","To first difference","Always fully"]}).info("e.g. \"hair/colours/light/...\""), # Alias settings "tac_alias.searchByAlias": shared.OptionInfo(True, "Search by alias"),