Add awaits to event emissions
| @@ -3514,7 +3514,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy | ||
| 3514 | 3514 | break; |
| 3515 | 3515 | } |
| 3516 | 3516 | case 'textgenerationwebui': |
| 3517 | 3517 | generateData = await getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet'); |
| 3518 | 3518 | TempResponseLength.restore(api); |
| 3519 | 3519 | break; |
| 3520 | 3520 | case 'openai': { |
| @@ -4651,7 +4651,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 4651 | 4651 | break; |
| 4652 | 4652 | case 'textgenerationwebui': { |
| 4653 | 4653 | const cfgValues = useCfgPrompt ? { guidanceScale: cfgGuidanceScale, negativePrompt: await getCombinedPrompt(true) } : null; |
| 4654 | 4654 | generate_data = await getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type); |
| 4655 | 4655 | break; |
| 4656 | 4656 | } |
| 4657 | 4657 | case 'novel': { |
| @@ -6991,7 +6991,7 @@ export async function getSettings() { | ||
| 6991 | 6991 | loadProxyPresets(settings); |
| 6992 | 6992 | |
| 6993 | 6993 | // Allow subscribers to mutate settings |
| 6994 | 6994 | await eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings); |
| 6995 | 6995 | |
| 6996 | 6996 | // Set context size after loading power user (may override the max value) |
| 6997 | 6997 | $('#max_context').val(max_context); |
| @@ -7051,7 +7051,7 @@ export async function getSettings() { | ||
| 7051 | 7051 | } |
| 7052 | 7052 | await validateDisabledSamplers(); |
| 7053 | 7053 | settingsReady = true; |
| 7054 | 7054 | await eventSource.emit(event_types.SETTINGS_LOADED); |
| 7055 | 7055 | } |
| 7056 | 7056 | |
| 7057 | 7057 | function selectKoboldGuiPreset() { |
| @@ -11468,7 +11468,7 @@ jQuery(async function () { | ||
| 11468 | 11468 | ); |
| 11469 | 11469 | break;*/ |
| 11470 | 11470 | default: |
| 11471 | 11471 | await eventSource.emit('charManagementDropdown', target); |
| 11472 | 11472 | } |
| 11473 | 11473 | $('#char-management-dropdown').prop('selectedIndex', 0); |
| 11474 | 11474 | }); |
| @@ -11630,7 +11630,7 @@ jQuery(async function () { | ||
| 11630 | 11630 | |
| 11631 | 11631 | $(document).on('click', '.open_characters_library', async function () { |
| 11632 | 11632 | await getCharacters(); |
| 11633 | 11633 | await eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY); |
| 11634 | 11634 | }); |
| 11635 | 11635 | |
| 11636 | 11636 | // Added here to prevent execution before script.js is loaded and get rid of quirky timeouts |
| @@ -2451,7 +2451,7 @@ async function resetMovablePanels(type) { | ||
| 2451 | 2451 | } |
| 2452 | 2452 | |
| 2453 | 2453 | saveSettingsDebounced(); |
| 2454 | 2454 | await eventSource.emit(event_types.MOVABLE_PANELS_RESET); |
| 2455 | 2455 | |
| 2456 | 2456 | eventSource.once(event_types.SETTINGS_UPDATED, () => { |
| 2457 | 2457 | $('.resizing').removeClass('resizing'); |
| @@ -1221,7 +1221,7 @@ function replaceMacrosInList(str) { | ||
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | export async function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) { |
| 1225 | 1225 | const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet'; |
| 1226 | 1226 | const dynatemp = isDynamicTemperatureSupported(); |
| 1227 | 1227 | const { banned_tokens, banned_strings } = getCustomTokenBans(); |
| @@ -1449,7 +1449,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, | ||
| 1449 | 1449 | } |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | await eventSource.emitAndWaitemit(event_types.TEXT_COMPLETION_SETTINGS_READY, params); |
| 1453 | 1453 | |
| 1454 | 1454 | // Grammar conflicts with with json_schema |
| 1455 | 1455 | if (settings.type === LLAMACPP) { |
| @@ -3452,7 +3452,7 @@ async function _save(name, data) { | ||
| 3452 | 3452 | headers: getRequestHeaders(), |
| 3453 | 3453 | body: JSON.stringify({ name: name, data: data }), |
| 3454 | 3454 | }); |
| 3455 | 3455 | await eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); |
| 3456 | 3456 | } |
| 3457 | 3457 | |
| 3458 | 3458 | |