Integrate killswitch into the block

This commit is contained in:
Cohee
2025-02-15 00:28:38 +02:00
parent a2a15b9978
commit 8a4cf86b65
5 changed files with 29 additions and 21 deletions

View File

@ -399,7 +399,7 @@ function getTokenizerForTokenIds() {
* @returns {TokenBanResult} String with comma-separated banned token IDs
*/
function getCustomTokenBans() {
if (!settings.banned_tokens && !textgenerationwebui_banned_in_macros.length) {
if (!settings.send_banned_tokens || (!settings.banned_tokens && !textgenerationwebui_banned_in_macros.length)) {
return {
banned_tokens: '',
banned_strings: [],
@ -616,9 +616,8 @@ function sortAphroditeItemsByOrder(orderArray) {
}
jQuery(function () {
$('#bannedStringsKillSwitch_textgenerationwebui').on('change', function () {
const checked = $(this).prop('checked');
$('#send_banned_tokens_textgenerationwebui').on('change', function () {
const checked = !!$(this).prop('checked');
if (checked) {
enableBannedStringsKillSwitch();
} else {
@ -966,7 +965,7 @@ function setSettingByName(setting, value, trigger) {
$(`#${setting}_textgenerationwebui`).prop('checked', val);
if ('send_banned_tokens' === setting) {
$('#send_banned_tokens_textgenerationwebui').trigger('change');
$(`#${setting}_textgenerationwebui`).trigger('change');
}
}
else if (isText) {