From 21297d98f24a05b5624dc728d88e60f4fc1e37ef Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 3 Aug 2023 18:38:25 +0530 Subject: [PATCH] Option to disable LoRA tag parsing --- ui/media/js/auto-save.js | 1 + ui/media/js/parameters.js | 9 +++++++++ ui/plugins/ui/lora-prompt-parser.plugin.js | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/ui/media/js/auto-save.js b/ui/media/js/auto-save.js index 670fee0d..f70b19c7 100644 --- a/ui/media/js/auto-save.js +++ b/ui/media/js/auto-save.js @@ -54,6 +54,7 @@ const SETTINGS_IDS_LIST = [ "zip_toggle", "tree_toggle", "json_toggle", + "extract_lora_from_prompt", ] const IGNORE_BY_DEFAULT = ["prompt"] diff --git a/ui/media/js/parameters.js b/ui/media/js/parameters.js index 9db01807..671451eb 100644 --- a/ui/media/js/parameters.js +++ b/ui/media/js/parameters.js @@ -121,6 +121,15 @@ var PARAMETERS = [ icon: "fa-arrow-down-short-wide", default: false, }, + { + id: "extract_lora_from_prompt", + type: ParameterType.checkbox, + label: "Extract LoRA tags from the prompt", + note: + "Automatically extract lora tags like <lora:name:0.4> from the prompt, and apply the correct LoRA (if present)", + icon: "fa-code", + default: true, + }, { id: "ui_open_browser_on_start", type: ParameterType.checkbox, diff --git a/ui/plugins/ui/lora-prompt-parser.plugin.js b/ui/plugins/ui/lora-prompt-parser.plugin.js index 5030b74c..201d49af 100644 --- a/ui/plugins/ui/lora-prompt-parser.plugin.js +++ b/ui/plugins/ui/lora-prompt-parser.plugin.js @@ -8,6 +8,11 @@ "use strict" promptField.addEventListener('input', function(e) { + let loraExtractSetting = document.getElementById("extract_lora_from_prompt") + if (!loraExtractSetting.checked) { + return + } + const { LoRA, prompt } = extractLoraTags(e.target.value); //console.log('e.target: ' + JSON.stringify(LoRA));