Use <lora: for models in lycoris folder by default

Added a backcompat option to keep using <lyco: if needed.
Closes #263
This commit is contained in:
DominikDoom
2023-12-24 14:11:19 +01:00
parent 0a4c17cada
commit c659ed2155
3 changed files with 6 additions and 3 deletions

View File

@@ -5,8 +5,8 @@ class LycoParser extends BaseTagParser {
parse() {
// Show lyco
let tempResults = [];
if (tagword !== "<" && tagword !== "<l:" && tagword !== "<lyco:") {
let searchTerm = tagword.replace("<lyco:", "").replace("<l:", "").replace("<", "");
if (tagword !== "<" && tagword !== "<l:" && tagword !== "<lyco:" && tagword !== "<lora:") {
let searchTerm = tagword.replace("<lyco:", "").replace("<lora:", "").replace("<l:", "").replace("<", "");
let filterCondition = x => x.toLowerCase().includes(searchTerm) || x.toLowerCase().replaceAll(" ", "_").includes(searchTerm);
tempResults = lycos.filter(x => filterCondition(x[0])); // Filter by tagword
} else {
@@ -52,7 +52,8 @@ async function sanitize(tagType, text) {
multiplier = info["preferred weight"];
}
return `<lyco:${text}:${multiplier}>`;
let prefix = TAC_CFG.useLoraPrefixForLycos ? "lora" : "lyco";
return `<${prefix}:${text}:${multiplier}>`;
}
return null;
}

View File

@@ -217,6 +217,7 @@ async function syncOptions() {
useHypernetworks: opts["tac_useHypernetworks"],
useLoras: opts["tac_useLoras"],
useLycos: opts["tac_useLycos"],
useLoraPrefixForLycos: opts["tac_useLoraPrefixForLycos"],
showWikiLinks: opts["tac_showWikiLinks"],
showExtraNetworkPreviews: opts["tac_showExtraNetworkPreviews"],
modelSortOrder: opts["tac_modelSortOrder"],