Option to disable group impersonation ban. Hide CFG for simple UI

This commit is contained in:
Cohee 2023-08-30 16:31:53 +03:00
parent 56fc92daca
commit 10148167ba
4 changed files with 25 additions and 1 deletions

View File

@ -2926,6 +2926,10 @@
<input id="encode_tags" type="checkbox" /> <input id="encode_tags" type="checkbox" />
<span data-i18n="Show tags in responses">Show &lt;tags&gt; in responses</span> <span data-i18n="Show tags in responses">Show &lt;tags&gt; in responses</span>
</label> </label>
<label data-newbie-hidden class="checkbox_label" for="disable_group_trimming" title="Allow AI messages in groups to contain lines spoken by other group members.">
<input id="disable_group_trimming" type="checkbox" />
<span data-i18n="Show impersonated replies in groups">Show impersonated replies in groups</span>
</label>
<label data-newbie-hidden class="checkbox_label" for="console_log_prompts"> <label data-newbie-hidden class="checkbox_label" for="console_log_prompts">
<input id="console_log_prompts" type="checkbox" /> <input id="console_log_prompts" type="checkbox" />
<span data-i18n="Log prompts to console">Log prompts to console</span> <span data-i18n="Log prompts to console">Log prompts to console</span>
@ -4322,6 +4326,9 @@
<i class="fa-lg fa-solid fa-note-sticky"></i> <i class="fa-lg fa-solid fa-note-sticky"></i>
<span data-i18n="Author's Note">Author's Note</span> <span data-i18n="Author's Note">Author's Note</span>
</a> </a>
<div data-newbie-hidden id="options_advanced">
</div>
<a id="option_back_to_main"> <a id="option_back_to_main">
<i class="fa-lg fa-solid fa-left-long"></i> <i class="fa-lg fa-solid fa-left-long"></i>
<span data-i18n="Back to parent chat">Back to parent chat</span> <span data-i18n="Back to parent chat">Back to parent chat</span>

View File

@ -1895,7 +1895,17 @@ export function extractMessageBias(message) {
} }
} }
/**
* Removes impersonated group member lines from the group member messages.
* Doesn't do anything if group reply trimming is disabled.
* @param {string} getMessage Group message
* @returns Cleaned-up group message
*/
function cleanGroupMessage(getMessage) { function cleanGroupMessage(getMessage) {
if (power_user.disable_group_trimming) {
return getMessage;
}
const group = groups.find((x) => x.id == selected_group); const group = groups.find((x) => x.id == selected_group);
if (group && Array.isArray(group.members) && group.members) { if (group && Array.isArray(group.members) && group.members) {

View File

@ -385,7 +385,7 @@ jQuery(async () => {
const buttonHtml = $(await $.get(`${extensionFolderPath}/menuButton.html`)); const buttonHtml = $(await $.get(`${extensionFolderPath}/menuButton.html`));
buttonHtml.on('click', onCfgMenuItemClick) buttonHtml.on('click', onCfgMenuItemClick)
buttonHtml.insertAfter("#option_toggle_AN"); buttonHtml.appendTo("#options_advanced");
// Hook events // Hook events
eventSource.on(event_types.CHAT_CHANGED, async () => { eventSource.on(event_types.CHAT_CHANGED, async () => {

View File

@ -165,6 +165,7 @@ let power_user = {
continue_on_send: false, continue_on_send: false,
trim_spaces: true, trim_spaces: true,
relaxed_api_urls: false, relaxed_api_urls: false,
disable_group_trimming: false,
default_instruct: '', default_instruct: '',
instruct: { instruct: {
@ -789,6 +790,7 @@ function loadPowerUserSettings(settings, data) {
$("#trim_sentences_checkbox").prop("checked", power_user.trim_sentences); $("#trim_sentences_checkbox").prop("checked", power_user.trim_sentences);
$("#include_newline_checkbox").prop("checked", power_user.include_newline); $("#include_newline_checkbox").prop("checked", power_user.include_newline);
$('#render_formulas').prop("checked", power_user.render_formulas); $('#render_formulas').prop("checked", power_user.render_formulas);
$('#disable_group_trimming').prop("checked", power_user.disable_group_trimming);
$("#markdown_escape_strings").val(power_user.markdown_escape_strings); $("#markdown_escape_strings").val(power_user.markdown_escape_strings);
$("#fast_ui_mode").prop("checked", power_user.fast_ui_mode); $("#fast_ui_mode").prop("checked", power_user.fast_ui_mode);
$("#waifuMode").prop("checked", power_user.waifuMode); $("#waifuMode").prop("checked", power_user.waifuMode);
@ -2160,6 +2162,11 @@ $(document).ready(() => {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$('#disable_group_trimming').on('input', function () {
power_user.disable_group_trimming = !!$(this).prop('checked');
saveSettingsDebounced();
});
$('#debug_menu').on('click', function () { $('#debug_menu').on('click', function () {
showDebugMenu(); showDebugMenu();
}); });