Add queue processing & callbacks

This commit is contained in:
Dominik Reh
2023-01-28 23:28:15 +01:00
parent b70b0b72cb
commit d1d3cd2bf5
3 changed files with 34 additions and 4 deletions

View File

@@ -224,6 +224,9 @@ async function syncOptions() {
// Apply changes
CFG = newCFG;
// Callback
processQueue(afterConfigChangeQueue, null);
}
// Create the result list div and necessary styling
@@ -359,6 +362,9 @@ function insertTextAtCursor(textArea, result, tagword) {
}
previousTags = tags;
// Callback
processQueue(afterInsertQueue, null, tagType);
// If it was a yaml wildcard, also update the umiPreviousTags
if (tagType === ResultType.yamlWildcard && originalTagword.length > 0) {
let umiSubPrompts = [...newPrompt.matchAll(UMI_PROMPT_REGEX)];
@@ -612,6 +618,8 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
results = [];
tagword = tagword.toLowerCase().replace(/[\n\r]/g, "");
let resultCandidates = processParsers(textArea, prompt);
if (CFG.useWildcards && [...tagword.matchAll(WC_REGEX)].length > 0) {
// Show wildcards from a file with that name
wcMatch = [...tagword.matchAll(WC_REGEX)]
@@ -1286,6 +1294,9 @@ async function setup() {
acStyle.appendChild(document.createTextNode(css));
}
gradioApp().appendChild(acStyle);
// Callback
processQueue(afterSetupQueue, null);
}
onUiUpdate(async () => {