Merge branch 'dev' of https://github.com/SillyTavern/SillyTavern into smartcontext-improvements

This commit is contained in:
50h100a
2023-07-07 13:03:00 -04:00
12 changed files with 246 additions and 114 deletions

View File

@@ -757,7 +757,6 @@ $.get("/csrf-token").then(async (data) => {
function checkOnlineStatus() {
///////// REMOVED LINES THAT DUPLICATE RA_CHeckOnlineStatus FEATURES
if (online_status == "no_connection") {
$("#online_status_indicator2").css("background-color", "red"); //Kobold
$("#online_status_text2").html("No connection...");
@@ -1137,10 +1136,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
mes = mes.replaceAll(substituteParams(power_user.user_prompt_bias), "");
}
const regexResult = getRegexedString(mes, regex_placement.MD_DISPLAY);
if (regexResult) {
mes = regexResult;
}
mes = getRegexedString(mes, regex_placement.MD_DISPLAY);
if (power_user.auto_fix_generated_markdown) {
mes = fixMarkdown(mes);
@@ -2957,10 +2953,7 @@ export function replaceBiasMarkup(str) {
}
export async function sendMessageAsUser(textareaText, messageBias) {
const regexResult = getRegexedString(textareaText, regex_placement.USER_INPUT);
if (regexResult) {
textareaText = regexResult;
}
textareaText = getRegexedString(textareaText, regex_placement.USER_INPUT);
chat[chat.length] = {};
chat[chat.length - 1]['name'] = name1;
@@ -3561,10 +3554,7 @@ function cleanUpMessage(getMessage, isImpersonate, displayIncompleteSentences =
}
// Regex uses vars, so add before formatting
const regexResult = getRegexedString(getMessage, isImpersonate ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT);
if (regexResult) {
getMessage = regexResult;
}
getMessage = getRegexedString(getMessage, isImpersonate ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT);
if (!displayIncompleteSentences && power_user.trim_sentences) {
getMessage = end_trim_to_sentence(getMessage, power_user.include_newline);
@@ -4995,16 +4985,13 @@ function updateMessage(div) {
regexPlacement = regex_placement.SYSTEM;
}
const regexResult = getRegexedString(
text = getRegexedString(
text,
regexPlacement,
{
characterOverride: regexPlacement === regex_placement.SENDAS ? mes.name : undefined
}
);
if (regexResult) {
text = regexResult;
}
if (power_user.trim_spaces) {
text = text.trim();
@@ -6123,10 +6110,7 @@ async function createOrEditCharacter(e) {
) {
// MARK - kingbri: Regex on character greeting message
// May need to be placed somewhere else
const regexResult = getRegexedString(this_ch_mes, regex_placement.AI_OUTPUT);
if (regexResult) {
this_ch_mes = regexResult;
}
this_ch_mes = getRegexedString(this_ch_mes, regex_placement.AI_OUTPUT);
clearChat();
chat.length = 0;
@@ -6504,7 +6488,12 @@ const swipe_right = () => {
}
export function updateCharacterCount(characterSelector) {
const visibleCharacters = $(characterSelector).filter(":visible");
const visibleCharacters = $(characterSelector)
.not(".hiddenBySearch")
.not(".hiddenByTag")
.not(".hiddenByGroup")
.not(".hiddenByGroupMember")
.not(".hiddenByFav");
const visibleCharacterCount = visibleCharacters.length;
const totalCharacterCount = $(characterSelector).length;
@@ -7840,9 +7829,11 @@ $(document).ready(function () {
$(document).on("click", ".mes_edit_delete", async function () {
const confirmation = await callPopup("Are you sure you want to delete this message?", 'confirm');
if (!confirmation) {
return;
if (power_user.confirm_message_delete) {
const confirmation = await callPopup("Are you sure you want to delete this message?", 'confirm');
if (!confirmation) {
return;
}
}
const mes = $(this).closest(".mes");