Make tag regex work with more < configurations

Will now allow completion of a < tag if the one directly after is also a < tag only separated by a space.
(Happens often now that Loras are a thing and <>'s stay in the prompt with them)
This commit is contained in:
Dominik Reh
2023-02-02 18:56:07 +01:00
parent db3319b0d3
commit c70a18919b

View File

@@ -286,7 +286,9 @@ function isEnabled() {
}
const WEIGHT_REGEX = /[([]([^,()[\]:| ]+)(?::(?:\d+(?:\.\d+)?|\.\d+))?[)\]]/g;
const TAG_REGEX = /(<[^\t\n\r,>]+>?|[^\s,|<>]+|<)/g
const POINTY_REGEX = /<[^\s,<](?:[^\t\n\r,<>]*>|[^\t\n\r,> ]*)/g;
const NORMAL_TAG_REGEX = /[^\s,|<>]+|</g;
const TAG_REGEX = new RegExp(`${POINTY_REGEX.source}|${NORMAL_TAG_REGEX.source}`, "g");
// On click, insert the tag into the prompt textbox with respect to the cursor position
async function insertTextAtCursor(textArea, result, tagword) {