Api/Model icon option

This commit is contained in:
city-unit
2023-08-13 18:43:16 -04:00
parent dd21091807
commit ad04344392
10 changed files with 406 additions and 1 deletions

View File

@ -158,6 +158,7 @@ let power_user = {
hotswap_enabled: true,
timer_enabled: true,
timestamps_enabled: true,
timestamp_model_icon: false,
mesIDDisplay_enabled: false,
max_context_unlocked: false,
prefer_character_prompt: true,
@ -224,6 +225,7 @@ const storage_keys = {
hotswap_enabled: 'HotswapEnabled',
timer_enabled: 'TimerEnabled',
timestamps_enabled: 'TimestampsEnabled',
timestamp_model_icon: 'TimestampModelIcon',
mesIDDisplay_enabled: 'mesIDDisplayEnabled',
};
@ -302,6 +304,13 @@ function switchTimestamps() {
$("#messageTimestampsEnabled").prop("checked", power_user.timestamps_enabled);
}
function switchIcons() {
const value = localStorage.getItem(storage_keys.timestamp_model_icon);
power_user.timestamp_model_icon = value === null ? true : value == "true";
$("body").toggleClass("no-modelIcons", !power_user.timestamp_model_icon);
$("#messageModelIconEnabled").prop("checked", power_user.timestamp_model_icon);
}
function switchMesIDDisplay() {
const value = localStorage.getItem(storage_keys.mesIDDisplay_enabled);
power_user.mesIDDisplay_enabled = value === null ? true : value == "true";
@ -565,6 +574,13 @@ async function applyTheme(name) {
switchTimestamps();
}
},
{
key: 'timestamp_model_icon',
action: async () => {
localStorage.setItem(storage_keys.timestamp_model_icon, power_user.timestamp_model_icon);
switchIcons();
}
},
{
key: 'mesIDDisplay_enabled',
action: async () => {
@ -624,6 +640,7 @@ noShadows();
switchHotswap();
switchTimer();
switchTimestamps();
switchIcons();
switchMesIDDisplay();
function loadPowerUserSettings(settings, data) {
@ -733,6 +750,7 @@ function loadPowerUserSettings(settings, data) {
$("#hotswapEnabled").prop("checked", power_user.hotswap_enabled);
$("#messageTimerEnabled").prop("checked", power_user.timer_enabled);
$("#messageTimestampsEnabled").prop("checked", power_user.timestamps_enabled);
$("#messageModelIconEnabled").prop("checked", power_user.timestamp_model_icon);
$("#mesIDDisplayEnabled").prop("checked", power_user.mesIDDisplay_enabled);
$("#prefer_character_prompt").prop("checked", power_user.prefer_character_prompt);
$("#prefer_character_jailbreak").prop("checked", power_user.prefer_character_jailbreak);
@ -1082,6 +1100,7 @@ async function saveTheme() {
chat_width: power_user.chat_width,
timer_enabled: power_user.timer_enabled,
timestamps_enabled: power_user.timestamps_enabled,
timestamp_model_icon: power_user.timestamp_model_icon,
mesIDDisplay_enabled: power_user.mesIDDisplay_enabled,
hotswap_enabled: power_user.hotswap_enabled,
@ -1961,6 +1980,13 @@ $(document).ready(() => {
switchTimestamps();
});
$("#messageModelIconEnabled").on("input", function () {
const value = !!$(this).prop('checked');
power_user.timestamp_model_icon = value;
localStorage.setItem(storage_keys.timestamp_model_icon, power_user.timestamp_model_icon);
switchIcons();
});
$("#mesIDDisplayEnabled").on("input", function () {
const value = !!$(this).prop('checked');
power_user.mesIDDisplay_enabled = value;