diff --git a/public/script.js b/public/script.js index 753262ac9..b5b161555 100644 --- a/public/script.js +++ b/public/script.js @@ -3514,7 +3514,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy break; } case 'textgenerationwebui': - generateData = getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet'); + generateData = await getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet'); TempResponseLength.restore(api); break; case 'openai': { @@ -4651,7 +4651,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro break; case 'textgenerationwebui': { const cfgValues = useCfgPrompt ? { guidanceScale: cfgGuidanceScale, negativePrompt: await getCombinedPrompt(true) } : null; - generate_data = getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type); + generate_data = await getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type); break; } case 'novel': { @@ -6991,7 +6991,7 @@ export async function getSettings() { loadProxyPresets(settings); // Allow subscribers to mutate settings - eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings); + await eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings); // Set context size after loading power user (may override the max value) $('#max_context').val(max_context); @@ -7051,7 +7051,7 @@ export async function getSettings() { } await validateDisabledSamplers(); settingsReady = true; - eventSource.emit(event_types.SETTINGS_LOADED); + await eventSource.emit(event_types.SETTINGS_LOADED); } function selectKoboldGuiPreset() { @@ -11468,7 +11468,7 @@ jQuery(async function () { ); break;*/ default: - eventSource.emit('charManagementDropdown', target); + await eventSource.emit('charManagementDropdown', target); } $('#char-management-dropdown').prop('selectedIndex', 0); }); @@ -11630,7 +11630,7 @@ jQuery(async function () { $(document).on('click', '.open_characters_library', async function () { await getCharacters(); - eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY); + await eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY); }); // Added here to prevent execution before script.js is loaded and get rid of quirky timeouts diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 8d90b24f6..66b298954 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -2451,7 +2451,7 @@ async function resetMovablePanels(type) { } saveSettingsDebounced(); - eventSource.emit(event_types.MOVABLE_PANELS_RESET); + await eventSource.emit(event_types.MOVABLE_PANELS_RESET); eventSource.once(event_types.SETTINGS_UPDATED, () => { $('.resizing').removeClass('resizing'); diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 29bce0858..50c630841 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1221,7 +1221,7 @@ function replaceMacrosInList(str) { } } -export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) { +export async function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) { const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet'; const dynatemp = isDynamicTemperatureSupported(); const { banned_tokens, banned_strings } = getCustomTokenBans(); @@ -1449,7 +1449,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, } } - eventSource.emitAndWait(event_types.TEXT_COMPLETION_SETTINGS_READY, params); + await eventSource.emit(event_types.TEXT_COMPLETION_SETTINGS_READY, params); // Grammar conflicts with with json_schema if (settings.type === LLAMACPP) { diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 6f071f84e..2dfb4c869 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -3452,7 +3452,7 @@ async function _save(name, data) { headers: getRequestHeaders(), body: JSON.stringify({ name: name, data: data }), }); - eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); + await eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); }