Add simplified UI switch

This commit is contained in:
Cohee
2023-08-29 18:04:10 +03:00
parent 7810c411df
commit 44f88c61ff
7 changed files with 171 additions and 100 deletions

View File

@ -71,6 +71,8 @@ import {
renderStoryString,
sortEntitiesList,
registerDebugFunction,
ui_mode,
switchSimpleMode,
} from "./scripts/power-user.js";
import {
@ -290,6 +292,7 @@ export const eventSource = new EventEmitter();
// Check for override warnings every 5 seconds...
setInterval(displayOverrideWarnings, 5000);
// ...or when the chat changes
eventSource.on(event_types.SETTINGS_LOADED, () => { settingsReady = true; });
eventSource.on(event_types.CHAT_CHANGED, displayOverrideWarnings);
eventSource.on(event_types.MESSAGE_RECEIVED, processExtensionHelpers);
eventSource.on(event_types.MESSAGE_SENT, processExtensionHelpers);
@ -325,6 +328,7 @@ let importFlashTimeout;
export let isChatSaving = false;
let chat_create_date = 0;
let firstRun = false;
let settingsReady = false;
const default_ch_mes = "Hello";
let count_view_mes = 0;
@ -4715,7 +4719,11 @@ async function uploadUserAvatar(e) {
async function doOnboarding(avatarId) {
let simpleUiMode = false;
const template = $('#onboarding_template .onboarding');
template.find('input[name="enable_simple_mode"]').on('input', function () {
simpleUiMode = $(this).is(':checked');
});
const userName = await callPopup(template, 'input', name1);
if (userName) {
@ -4727,6 +4735,12 @@ async function doOnboarding(avatarId) {
position: persona_description_positions.IN_PROMPT,
};
}
if (simpleUiMode) {
power_user.ui_mode = ui_mode.SIMPLE;
$('#ui_mode_select').val(power_user.ui_mode);
switchSimpleMode();
}
}
//***************SETTINGS****************//
@ -4915,6 +4929,10 @@ function selectKoboldGuiPreset() {
}
async function saveSettings(type) {
if (!settingsReady) {
console.warn('Settings not ready, aborting save');
return;
}
//console.log('Entering settings with name1 = '+name1);
return jQuery.ajax({