mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Implement creator's note style tag preferences (#3979)
* Implement creator's note style tag preferences * Decouple external media preference from style preference * Allow explicitly empty prefixes in decodeStyleTags * Fix Copilot comments * Refactor global styles management into StylesPreference class * Refactor openAttachmentManager to return an object instead of an array * Unify header structure * Re-render characters panel on setting initial preference * Add note about classname prefixing * Rename event handler
This commit is contained in:
@ -251,7 +251,7 @@ import { getBackgrounds, initBackgrounds, loadBackgroundSettings, background_set
|
||||
import { hideLoader, showLoader } from './scripts/loader.js';
|
||||
import { BulkEditOverlay, CharacterContextMenu } from './scripts/BulkEditOverlay.js';
|
||||
import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels, initTextGenModels, loadTabbyModels, loadGenericModels } from './scripts/textgen-models.js';
|
||||
import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, decodeStyleTags, encodeStyleTags, isExternalMediaAllowed, getCurrentEntityId, preserveNeutralChat, restoreNeutralChat } from './scripts/chats.js';
|
||||
import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, decodeStyleTags, encodeStyleTags, isExternalMediaAllowed, getCurrentEntityId, preserveNeutralChat, restoreNeutralChat, formatCreatorNotes, initChatUtilities } from './scripts/chats.js';
|
||||
import { getPresetManager, initPresetManager } from './scripts/preset-manager.js';
|
||||
import { evaluateMacros, getLastMessageId, initMacros } from './scripts/macros.js';
|
||||
import { currentUser, setUserControls } from './scripts/user.js';
|
||||
@ -544,7 +544,7 @@ console.debug('Character context menu initialized', characterContextMenu);
|
||||
// Markdown converter
|
||||
export let mesForShowdownParse; //intended to be used as a context to compare showdown strings against
|
||||
/** @type {import('showdown').Converter} */
|
||||
let converter;
|
||||
export let converter;
|
||||
|
||||
// array for prompt token calculations
|
||||
console.debug('initializing Prompt Itemization Array on Startup');
|
||||
@ -978,6 +978,7 @@ async function firstLoadInit() {
|
||||
await getClientVersion();
|
||||
await readSecretState();
|
||||
await initLocales();
|
||||
initChatUtilities();
|
||||
initDefaultSlashCommands();
|
||||
initTextGenModels();
|
||||
initOpenAI();
|
||||
@ -2232,7 +2233,7 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
|
||||
};
|
||||
mes = encodeStyleTags(mes);
|
||||
mes = DOMPurify.sanitize(mes, config);
|
||||
mes = decodeStyleTags(mes);
|
||||
mes = decodeStyleTags(mes, { prefix: '.mes_text ' });
|
||||
|
||||
return mes;
|
||||
}
|
||||
@ -8248,7 +8249,7 @@ export function select_selected_character(chid, { switchMenu = true } = {}) {
|
||||
$('#description_textarea').val(characters[chid].description);
|
||||
$('#character_world').val(characters[chid].data?.extensions?.world || '');
|
||||
$('#creator_notes_textarea').val(characters[chid].data?.creator_notes || characters[chid].creatorcomment);
|
||||
$('#creator_notes_spoiler').html(DOMPurify.sanitize(converter.makeHtml(substituteParams(characters[chid].data?.creator_notes) || characters[chid].creatorcomment), { MESSAGE_SANITIZE: true }));
|
||||
$('#creator_notes_spoiler').html(formatCreatorNotes(characters[chid].data?.creator_notes || characters[chid].creatorcomment, characters[chid].avatar));
|
||||
$('#character_version_textarea').val(characters[chid].data?.character_version || '');
|
||||
$('#system_prompt_textarea').val(characters[chid].data?.system_prompt || '');
|
||||
$('#post_history_instructions_textarea').val(characters[chid].data?.post_history_instructions || '');
|
||||
@ -8329,7 +8330,7 @@ function select_rm_create({ switchMenu = true } = {}) {
|
||||
$('#description_textarea').val(create_save.description);
|
||||
$('#character_world').val(create_save.world);
|
||||
$('#creator_notes_textarea').val(create_save.creator_notes);
|
||||
$('#creator_notes_spoiler').html(DOMPurify.sanitize(converter.makeHtml(create_save.creator_notes), { MESSAGE_SANITIZE: true }));
|
||||
$('#creator_notes_spoiler').html(formatCreatorNotes(create_save.creator_notes, ''));
|
||||
$('#post_history_instructions_textarea').val(create_save.post_history_instructions);
|
||||
$('#system_prompt_textarea').val(create_save.system_prompt);
|
||||
$('#tags_textarea').val(create_save.tags);
|
||||
|
Reference in New Issue
Block a user