Force isSystem = false on comment messages so they get formatted properly

This commit is contained in:
Stefan Daniel Schwarz 2023-08-26 19:26:23 +02:00
parent dd7b89aef6
commit b9a95d94a0
2 changed files with 8 additions and 3 deletions

View File

@ -136,7 +136,7 @@ import {
} from "./scripts/utils.js";
import { extension_settings, getContext, loadExtensionSettings, processExtensionHelpers, registerExtensionHelper, runGenerationInterceptors, saveMetadataDebounced } from "./scripts/extensions.js";
import { executeSlashCommands, getSlashCommandsHelp, registerSlashCommand } from "./scripts/slash-commands.js";
import { COMMENT_NAME_DEFAULT, executeSlashCommands, getSlashCommandsHelp, registerSlashCommand } from "./scripts/slash-commands.js";
import {
tag_map,
tags,
@ -1199,6 +1199,11 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
mes = '';
}
// Force isSystem = false on comment messages so they get formatted properly
if (ch_name === COMMENT_NAME_DEFAULT && isSystem && !isUser) {
isSystem = false;
}
// Prompt bias replacement should be applied on the raw message
if (!power_user.show_user_prompt_bias && ch_name && !isUser && !isSystem) {
mes = mes.replaceAll(substituteParams(power_user.user_prompt_bias), "");

View File

@ -131,7 +131,7 @@ parser.addCommand('send', sendUserMessageCallback, ['add'], '<span class="monosp
const NARRATOR_NAME_KEY = 'narrator_name';
const NARRATOR_NAME_DEFAULT = 'System';
const COMMENT_NAME_DEFAULT = 'Note';
export const COMMENT_NAME_DEFAULT = 'Note';
async function sendUserMessageCallback(_, text) {
if (!text) {
@ -385,7 +385,7 @@ async function sendCommentMessage(_, text) {
name: COMMENT_NAME_DEFAULT,
is_user: false,
is_name: true,
is_system: false,
is_system: true,
send_date: getMessageTimeStamp(),
mes: substituteParams(text.trim()),
force_avatar: comment_avatar,