mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Messages + Instruct: Fix /send with name= if name is empty
If name is empty, don't try appending it to the message. This applies for both instruct and non-instruct modes. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -4387,7 +4387,8 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
|
|||||||
const itemName = chatItem.is_user ? chatItem['name'] : characterName;
|
const itemName = chatItem.is_user ? chatItem['name'] : characterName;
|
||||||
const shouldPrependName = !isNarratorType;
|
const shouldPrependName = !isNarratorType;
|
||||||
|
|
||||||
let textResult = shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;
|
// Don't include a name if it's empty
|
||||||
|
let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;
|
||||||
|
|
||||||
if (isInstruct) {
|
if (isInstruct) {
|
||||||
textResult = formatInstructModeChat(itemName, chatItem.mes, chatItem.is_user, isNarratorType, chatItem.force_avatar, name1, name2, forceOutputSequence);
|
textResult = formatInstructModeChat(itemName, chatItem.mes, chatItem.is_user, isNarratorType, chatItem.force_avatar, name1, name2, forceOutputSequence);
|
||||||
|
@@ -340,8 +340,11 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata
|
|||||||
}
|
}
|
||||||
|
|
||||||
const separator = power_user.instruct.wrap ? '\n' : '';
|
const separator = power_user.instruct.wrap ? '\n' : '';
|
||||||
const textArray = includeNames ? [prefix, `${name}: ${mes}` + suffix] : [prefix, mes + suffix];
|
|
||||||
|
// Don't include the name if it's empty
|
||||||
|
const textArray = includeNames && name ? [prefix, `${name}: ${mes}` + suffix] : [prefix, mes + suffix];
|
||||||
const text = textArray.filter(x => x).join(separator);
|
const text = textArray.filter(x => x).join(separator);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user