mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat(autocomplete): restrict embeddings autocomplete to explicit prefix
Only trigger autocomplete for embeddings when the current token starts with "emb:" prefix. This prevents interrupting normal prompt typing while maintaining quick manual access to embeddings suggestions.
This commit is contained in:
@@ -300,10 +300,23 @@ class AutoComplete {
|
|||||||
if (this.debounceTimer) {
|
if (this.debounceTimer) {
|
||||||
clearTimeout(this.debounceTimer);
|
clearTimeout(this.debounceTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the search term (text after last comma)
|
// Get the search term (text after last comma / '>')
|
||||||
const searchTerm = this.getSearchTerm(value);
|
const rawSearchTerm = this.getSearchTerm(value);
|
||||||
|
let searchTerm = rawSearchTerm;
|
||||||
|
|
||||||
|
// For embeddings, only trigger autocomplete when the current token
|
||||||
|
// starts with the explicit "emb:" prefix. This avoids interrupting
|
||||||
|
// normal prompt typing while still allowing quick manual triggering.
|
||||||
|
if (this.modelType === 'embeddings') {
|
||||||
|
const match = rawSearchTerm.match(/^emb:(.*)$/i);
|
||||||
|
if (!match) {
|
||||||
|
this.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
searchTerm = (match[1] || '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (searchTerm.length < this.options.minChars) {
|
if (searchTerm.length < this.options.minChars) {
|
||||||
this.hide();
|
this.hide();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user