From e9ee14b83757133907f1010a7cb7a7e1410225a0 Mon Sep 17 00:00:00 2001 From: Lawrence Ling <5894666+Lawrr@users.noreply.github.com> Date: Mon, 29 Jan 2024 22:10:51 +1100 Subject: [PATCH] Fix autocomplete replacing embedding and lora underscores with spaces --- web/js/autocompleter.js | 2 ++ web/js/common/autocomplete.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/js/autocompleter.js b/web/js/autocompleter.js index cad9b24..55d0f5e 100644 --- a/web/js/autocompleter.js +++ b/web/js/autocompleter.js @@ -285,6 +285,7 @@ app.registerExtension({ words[v] = { text: v, info: () => new EmbeddingInfoDialog(emb).show("embeddings", emb), + use_replacer: false, }; } @@ -303,6 +304,7 @@ app.registerExtension({ words[v] = { text: v, info: () => new LoraInfoDialog(lora).show("loras", lora), + use_replacer: false, }; } diff --git a/web/js/common/autocomplete.js b/web/js/common/autocomplete.js index 08e54b9..8db269e 100644 --- a/web/js/common/autocomplete.js +++ b/web/js/common/autocomplete.js @@ -576,7 +576,8 @@ export class TextAreaAutoComplete { onclick: () => { this.el.focus(); let value = wordInfo.value ?? wordInfo.text; - if (TextAreaAutoComplete.replacer) { + const use_replacer = wordInfo.use_replacer ?? true; + if (TextAreaAutoComplete.replacer && use_replacer) { value = TextAreaAutoComplete.replacer(value); } this.helper.insertAtCursor(value + this.separator, -before.length, wordInfo.caretOffset);