mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-04-26 01:09:14 +00:00
Extract file load to queue
This enables other parsers to keep their load function in the same file
This commit is contained in:
@@ -202,7 +202,29 @@ function updateUmiTags( tagType, sanitizedText, newPrompt, textArea) {
|
||||
return false;
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (yamlWildcards.length === 0) {
|
||||
try {
|
||||
let yamlTags = (await readFile(`${tagBasePath}/temp/wcet.txt?${new Date().getTime()}`)).split("\n");
|
||||
// Split into tag, count pairs
|
||||
yamlWildcards = yamlTags.map(x => x
|
||||
.trim()
|
||||
.split(","))
|
||||
.map(([i, ...rest]) => [
|
||||
i,
|
||||
rest.reduce((a, b) => {
|
||||
a[b.toLowerCase()] = true;
|
||||
return a;
|
||||
}, {}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.error("Error loading yaml wildcards: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add UMI parser
|
||||
PARSERS.push(new UmiParser(UMI_TRIGGER));
|
||||
// Add tag update after insert
|
||||
QUEUE_AFTER_INSERT.push(updateUmiTags);
|
||||
QUEUE_AFTER_INSERT.push(updateUmiTags);
|
||||
QUEUE_FILE_LOAD.push(load);
|
||||
Reference in New Issue
Block a user