From dad9f7b7262dc7df25ba64da0b510317b84259d0 Mon Sep 17 00:00:00 2001 From: Peter Nagy <155898084+Skoteinos1@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:42:26 +0100 Subject: [PATCH] Update lora-prompt-parser.plugin.js Issue: When copy/pasting prompt with sub-prompts and lora, lora is extracted, but sub-prompts are merged into one big prompt. Because I use script to copy/paste bunch of prompts with different lora's and let it run overnight, to test which lora is the best. Solution: To keep /n in prompts. I removed this part: .replace(/(\s*,\s*(?=\s*,|$))|(^\s*,\s*)|\s+/g, ' ') --- ui/plugins/ui/lora-prompt-parser.plugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/plugins/ui/lora-prompt-parser.plugin.js b/ui/plugins/ui/lora-prompt-parser.plugin.js index 0510b47f..98a6467b 100644 --- a/ui/plugins/ui/lora-prompt-parser.plugin.js +++ b/ui/plugins/ui/lora-prompt-parser.plugin.js @@ -82,7 +82,9 @@ } // Clean up the prompt string, e.g. from "apple, banana, , orange, , pear , " to "apple, banana, orange, pear" - let cleanedPrompt = prompt.replace(regex, '').replace(/(\s*,\s*(?=\s*,|$))|(^\s*,\s*)|\s+/g, ' ').trim(); + // let cleanedPrompt = prompt.replace(regex, '').replace(/(\s*,\s*(?=\s*,|$))|(^\s*,\s*)|\s+/g, ' ').trim(); + // This line keeps /n in prompts. Good if you want to make prompt with multiple sub-prompts. Previous line would merge sub-prompts into one big prompt + let cleanedPrompt = prompt.replace(regex, '').trim(); //console.log('Matches: ' + JSON.stringify(matches)); // Return the array of matches and cleaned prompt string