`{{char_version_url_encoded}}` and macro replace in `creator_notes_spoiler`

This commit is contained in:
steve02081504 2024-05-10 07:24:05 +08:00
parent f6343436b4
commit 7a2f6fb63f
2 changed files with 2 additions and 1 deletions

View File

@ -6684,7 +6684,7 @@ export function select_selected_character(chid) {
$('#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(characters[chid].data?.creator_notes || characters[chid].creatorcomment), { MESSAGE_SANITIZE: true }));
$('#creator_notes_spoiler').html(DOMPurify.sanitize(converter.makeHtml(substituteParams(characters[chid].data?.creator_notes) || characters[chid].creatorcomment), { MESSAGE_SANITIZE: true }));
$('#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 || '');

View File

@ -318,6 +318,7 @@ export function evaluateMacros(content, env) {
content = content.replace(/{{isodate}}/gi, () => moment().format('YYYY-MM-DD'));
content = content.replace(/{{char_version}}/gi, characters[this_chid]?.data?.character_version);
content = content.replace(/{{char_version_url_encoded}}/gi, encodeURIComponent(characters[this_chid]?.data?.character_version));
content = content.replace(/{{datetimeformat +([^}]*)}}/gi, (_, format) => {
const formattedTime = moment().format(format);