Support for new webui 1.5.0 lora features

Prefers trigger words over the model-keyword ones
Uses custom per-lora multiplier if set
This commit is contained in:
DominikDoom
2023-07-26 14:38:51 +02:00
parent b28497764f
commit 2e271aea5c
7 changed files with 132 additions and 36 deletions

View File

@@ -38,9 +38,19 @@ async function load() {
}
}
function sanitize(tagType, text) {
async function sanitize(tagType, text) {
if (tagType === ResultType.lyco) {
return `<lyco:${text}:${TAC_CFG.extraNetworksDefaultMultiplier}>`;
let multiplier = TAC_CFG.extraNetworksDefaultMultiplier;
let info = await fetchAPI(`tacapi/v1/lyco-info/${text}`)
if (info && info["preferred weight"]) {
multiplier = info["preferred weight"];
}
const lastDot = text.lastIndexOf(".");
const lastSlash = text.lastIndexOf("/");
const name = text.substring(lastSlash + 1, lastDot);
return `<lyco:${name}:${multiplier}>`;
}
return null;
}