mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
feat: consolidate ComfyUI settings and add custom words autocomplete toggle
Create unified settings.js extension to centralize all Lora Manager ComfyUI settings registration, eliminating code duplication across multiple files. Add new setting "Enable Custom Words Autocomplete in Prompt Nodes" (enabled by default) to control custom words autocomplete in prompt node text widgets. When disabled, only 'emb:' prefix triggers embeddings autocomplete. Changes: - Create web/comfyui/settings.js with all three settings: * Trigger Word Wheel Sensitivity (existing) * Auto path correction (existing) * Enable Custom Words Autocomplete in Prompt Nodes (new) - Refactor autocomplete.js to respect the new setting - Update trigger_word_toggle.js to import from settings.js - Update usage_stats.js to import from settings.js
This commit is contained in:
@@ -1,6 +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";
|
||||
|
||||
function parseUsageTipNumber(value) {
|
||||
if (typeof value === 'number' && Number.isFinite(value)) {
|
||||
@@ -420,15 +421,19 @@ class AutoComplete {
|
||||
if (this.modelType === 'prompt') {
|
||||
const match = rawSearchTerm.match(/^emb:(.*)$/i);
|
||||
if (match) {
|
||||
// User typed "emb:" prefix - search embeddings
|
||||
// User typed "emb:" prefix - always allow embeddings search
|
||||
endpoint = '/lm/embeddings/relative-paths';
|
||||
searchTerm = (match[1] || '').trim();
|
||||
this.searchType = 'embeddings';
|
||||
} else {
|
||||
// No prefix - search custom words
|
||||
} else if (getPromptCustomWordsAutocompletePreference()) {
|
||||
// Setting enabled - allow custom words search
|
||||
endpoint = '/lm/custom-words/search';
|
||||
searchTerm = rawSearchTerm;
|
||||
this.searchType = 'custom_words';
|
||||
} else {
|
||||
// Setting disabled - no autocomplete for non-emb: terms
|
||||
this.hide();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user