mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add awaits to event emissions
This commit is contained in:
@ -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
|
||||
|
@ -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');
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user