Add awaits to event emissions

d5959a4681481582640b78c4c73a0a3208a6421f

Cohee <18619528+Cohee1207@users.noreply.github.com>

4 files changed, +10 -10Ignore whitespace
public/script.js+6 -6
@@ -3514,7 +3514,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy
35143514 break;
35153515 }
35163516 case 'textgenerationwebui':
35173517 generateData = await getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet');
35183518 TempResponseLength.restore(api);
35193519 break;
35203520 case 'openai': {
@@ -4651,7 +4651,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
46514651 break;
46524652 case 'textgenerationwebui': {
46534653 const cfgValues = useCfgPrompt ? { guidanceScale: cfgGuidanceScale, negativePrompt: await getCombinedPrompt(true) } : null;
46544654 generate_data = await getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type);
46554655 break;
46564656 }
46574657 case 'novel': {
@@ -6991,7 +6991,7 @@ export async function getSettings() {
69916991 loadProxyPresets(settings);
69926992
69936993 // Allow subscribers to mutate settings
69946994 await eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings);
69956995
69966996 // Set context size after loading power user (may override the max value)
69976997 $('#max_context').val(max_context);
@@ -7051,7 +7051,7 @@ export async function getSettings() {
70517051 }
70527052 await validateDisabledSamplers();
70537053 settingsReady = true;
70547054 await eventSource.emit(event_types.SETTINGS_LOADED);
70557055}
70567056
70577057function selectKoboldGuiPreset() {
@@ -11468,7 +11468,7 @@ jQuery(async function () {
1146811468 );
1146911469 break;*/
1147011470 default:
1147111471 await eventSource.emit('charManagementDropdown', target);
1147211472 }
1147311473 $('#char-management-dropdown').prop('selectedIndex', 0);
1147411474 });
@@ -11630,7 +11630,7 @@ jQuery(async function () {
1163011630
1163111631 $(document).on('click', '.open_characters_library', async function () {
1163211632 await getCharacters();
1163311633 await eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY);
1163411634 });
1163511635
1163611636 // Added here to prevent execution before script.js is loaded and get rid of quirky timeouts
public/scripts/power-user.js+1 -1
@@ -2451,7 +2451,7 @@ async function resetMovablePanels(type) {
24512451 }
24522452
24532453 saveSettingsDebounced();
24542454 await eventSource.emit(event_types.MOVABLE_PANELS_RESET);
24552455
24562456 eventSource.once(event_types.SETTINGS_UPDATED, () => {
24572457 $('.resizing').removeClass('resizing');
public/scripts/textgen-settings.js+2 -2
@@ -1221,7 +1221,7 @@ function replaceMacrosInList(str) {
12211221 }
12221222}
12231223
12241224export async function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) {
12251225 const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet';
12261226 const dynatemp = isDynamicTemperatureSupported();
12271227 const { banned_tokens, banned_strings } = getCustomTokenBans();
@@ -1449,7 +1449,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
14491449 }
14501450 }
14511451
14521452 await eventSource.emitAndWaitemit(event_types.TEXT_COMPLETION_SETTINGS_READY, params);
14531453
14541454 // Grammar conflicts with with json_schema
14551455 if (settings.type === LLAMACPP) {
public/scripts/world-info.js+1 -1
@@ -3452,7 +3452,7 @@ async function _save(name, data) {
34523452 headers: getRequestHeaders(),
34533453 body: JSON.stringify({ name: name, data: data }),
34543454 });
34553455 await eventSource.emit(event_types.WORLDINFO_UPDATED, name, data);
34563456}
34573457
34583458