mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-09 08:30:13 +01:00
Re-Render prompt manager on worldinfo settings change
This commit is contained in:
parent
4509df0fd9
commit
011278c533
@ -344,9 +344,12 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
|
|||||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_close').addEventListener('click', closeAndClearPopup);
|
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_close').addEventListener('click', closeAndClearPopup);
|
||||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_close_button').addEventListener('click', closeAndClearPopup);
|
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_close_button').addEventListener('click', closeAndClearPopup);
|
||||||
|
|
||||||
// Re-render Prompt manager on openai preset change
|
// Re-render prompt manager on openai preset change
|
||||||
eventSource.on(event_types.OAI_PRESET_CHANGED, settings => this.render());
|
eventSource.on(event_types.OAI_PRESET_CHANGED, settings => this.render());
|
||||||
|
|
||||||
|
// Re-render prompt manager on world settings update
|
||||||
|
eventSource.on(event_types.WORLDINFO_SETTINGS_UPDATED, () => this.render());
|
||||||
|
|
||||||
this.log('Initialized')
|
this.log('Initialized')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type } from "../script.js";
|
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types } from "../script.js";
|
||||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, delay, getCharaFilename, deepClone } from "./utils.js";
|
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, delay, getCharaFilename, deepClone } from "./utils.js";
|
||||||
import { getContext } from "./extensions.js";
|
import { getContext } from "./extensions.js";
|
||||||
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
|
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
|
||||||
@ -1369,6 +1369,7 @@ function onWorldInfoChange(_, text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
eventSource.emit(event_types.WORLDINFO_SETTINGS_UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function importWorldInfo(file) {
|
export async function importWorldInfo(file) {
|
||||||
@ -1505,36 +1506,41 @@ jQuery(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const saveSettings = () => {
|
||||||
|
saveSettingsDebounced()
|
||||||
|
eventSource.emit(event_types.WORLDINFO_SETTINGS_UPDATED);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on("input", "#world_info_depth", function () {
|
$(document).on("input", "#world_info_depth", function () {
|
||||||
world_info_depth = Number($(this).val());
|
world_info_depth = Number($(this).val());
|
||||||
$("#world_info_depth_counter").text($(this).val());
|
$("#world_info_depth_counter").text($(this).val());
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("input", "#world_info_budget", function () {
|
$(document).on("input", "#world_info_budget", function () {
|
||||||
world_info_budget = Number($(this).val());
|
world_info_budget = Number($(this).val());
|
||||||
$("#world_info_budget_counter").text($(this).val());
|
$("#world_info_budget_counter").text($(this).val());
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("input", "#world_info_recursive", function () {
|
$(document).on("input", "#world_info_recursive", function () {
|
||||||
world_info_recursive = !!$(this).prop('checked');
|
world_info_recursive = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#world_info_case_sensitive').on('input', function () {
|
$('#world_info_case_sensitive').on('input', function () {
|
||||||
world_info_case_sensitive = !!$(this).prop('checked');
|
world_info_case_sensitive = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#world_info_match_whole_words').on('input', function () {
|
$('#world_info_match_whole_words').on('input', function () {
|
||||||
world_info_match_whole_words = !!$(this).prop('checked');
|
world_info_match_whole_words = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#world_info_character_strategy').on('change', function () {
|
$('#world_info_character_strategy').on('change', function () {
|
||||||
world_info_character_strategy = $(this).val();
|
world_info_character_strategy = $(this).val();
|
||||||
saveSettingsDebounced();
|
saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#world_info_overflow_alert').on('change', function () {
|
$('#world_info_overflow_alert').on('change', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user