[Feature Request] Can we please have <xml_tags> visibility back? #907

This commit is contained in:
Cohee 2023-08-10 11:47:17 +03:00
parent 4200f1da0a
commit 1a07fa8365
4 changed files with 37 additions and 20 deletions

View File

@ -2482,11 +2482,11 @@
<div id="power-user-options-block" class="flex-container drawer33pWidth">
<div id="power-user-option-checkboxes">
<h4 data-i18n="Power User Options">Power User Options</h4>
<label for="swipes-checkbox">
<label class="checkbox_label" for="swipes-checkbox">
<input id="swipes-checkbox" type="checkbox" />
<span data-i18n="Swipes">Swipes</span>
</label>
<label for="fuzzy_search_checkbox">
<label class="checkbox_label" for="fuzzy_search_checkbox">
<input id="fuzzy_search_checkbox" type="checkbox" />
<span data-i18n="Advanced Character Search">Advanced Character Search</span>
</label>
@ -2504,13 +2504,15 @@
Press "Send" to continue
</span>
</label>
<label for="auto-load-chat-checkbox"><input id="auto-load-chat-checkbox" type="checkbox" />
<label class="checkbox_label" for="auto-load-chat-checkbox">
<input id="auto-load-chat-checkbox" type="checkbox" />
<span data-i18n="Auto-load Last Chat">Auto-load Last Chat</span>
</label>
<label for="auto_save_msg_edits"><input id="auto_save_msg_edits" type="checkbox" />
<label class="checkbox_label" for="auto_save_msg_edits">
<input id="auto_save_msg_edits" type="checkbox" />
<span data-i18n="Auto-save Message Edits">Auto-save Message Edits</span>
</label>
<label for="auto_fix_generated_markdown">
<label class="checkbox_label" for="auto_fix_generated_markdown">
<input id="auto_fix_generated_markdown" type="checkbox" />
<span data-i18n="Auto-fix Markdown">Auto-fix Markdown</span>
</label>
@ -2522,37 +2524,43 @@
<input id="allow_name1_display" type="checkbox" />
<span data-i18n="Allow {{user}}: in bot messages">Show {{user}}: in responses</span>
</label>
<!-- <label class="checkbox_label" for="removeXML">
<input id="removeXML" type="checkbox" />
<span data-i18n="Remove XML/HTML tags from responses">Remove &lt;tags&gt; from responses</span>
</label> -->
<label for="console_log_prompts">
<label class="checkbox_label" for="encode_tags">
<input id="encode_tags" type="checkbox" />
<span data-i18n="Show tags in responses">Show &lt;tags&gt; in responses</span>
</label>
<label class="checkbox_label" for="console_log_prompts">
<input id="console_log_prompts" type="checkbox" />
<span data-i18n="Log prompts to console">Log prompts to console</span>
</label>
<label for="render_formulas">
<label class="checkbox_label" for="render_formulas">
<input id="render_formulas" type="checkbox" />
<span data-i18n="Render Formulas">Render Formulas</span>
<a href="https://docs.sillytavern.app/usage/core-concepts/uicustomization/#formulas-rendering" class="notes-link" target="_blank">
<span class="note-link-span">?</span>
</a>
</label>
<label for="never_resize_avatars"><input id="never_resize_avatars" type="checkbox" />
<label class="checkbox_label" for="never_resize_avatars">
<input id="never_resize_avatars" type="checkbox" />
<span data-i18n="Never resize avatars">Never resize avatars</span>
</label>
<label for="show_card_avatar_urls"><input id="show_card_avatar_urls" type="checkbox" />
<label class="checkbox_label" for="show_card_avatar_urls">
<input id="show_card_avatar_urls" type="checkbox" />
<span data-i18n="Show avatar filenames">Show avatar filenames</span>
</label>
<label for="import_card_tags"><input id="import_card_tags" type="checkbox" />
<label class="checkbox_label" for="import_card_tags">
<input id="import_card_tags" type="checkbox" />
<span data-i18n="Import Card Tags">Import Card Tags</span>
</label>
<label for="confirm_message_delete"><input id="confirm_message_delete" type="checkbox" />
<label class="checkbox_label" for="confirm_message_delete">
<input id="confirm_message_delete" type="checkbox" />
<span data-i18n="Confirm message deletion">Confirm message deletion</span>
</label>
<label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
<label class="checkbox_label" for="spoiler_free_mode">
<input id="spoiler_free_mode" type="checkbox" />
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
</label>
<label for="relaxed_api_urls" title="Reduce the formatting requirements on API URLS"><input id="relaxed_api_urls" type="checkbox" />
<label class="checkbox_label" for="relaxed_api_urls" title="Reduce the formatting requirements on API URLS">
<input id="relaxed_api_urls" type="checkbox" />
<span data-i18n="Relaxed API URLS">Relaxed API URLS</span>
</label>

View File

@ -1269,8 +1269,10 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
mes = fixMarkdown(mes);
}
//if (this_chid != undefined && !isSystem)
// mes = mes.replaceAll("<", "&lt;").replaceAll(">", "&gt;"); //for welcome message
if (!isSystem && power_user.encode_tags) {
mes = mes.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
}
if ((this_chid === undefined || this_chid === "invalid-safety-id") && !selected_group) {
mes = mes
.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>")

View File

@ -192,6 +192,7 @@ let power_user = {
custom_stopping_strings: '',
custom_stopping_strings_macro: true,
fuzzy_search: false,
encode_tags: false,
};
let themes = [];
@ -686,6 +687,7 @@ function loadPowerUserSettings(settings, data) {
$("#custom_stopping_strings_macro").prop("checked", power_user.custom_stopping_strings_macro);
$('#fuzzy_search_checkbox').prop("checked", power_user.fuzzy_search);
$('#persona_show_notifications').prop("checked", power_user.persona_show_notifications);
$('#encode_tags').prop("checked", power_user.encode_tags);
$("#console_log_prompts").prop("checked", power_user.console_log_prompts);
$('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown);
@ -2032,6 +2034,12 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$('#encode_tags').on('input', async function () {
power_user.encode_tags = !!$(this).prop('checked');
await reloadCurrentChat();
saveSettingsDebounced();
});
$(window).on('focus', function () {
browser_has_focus = true;
});

View File

@ -2776,7 +2776,6 @@ input[type="range"]::-webkit-slider-thumb {
#power-user-option-checkboxes {
display: flex;
flex-direction: column;
row-gap: 5px;
flex-grow: 1;
}