Skip to content

Commit e3c4652

Browse files
authored
Merge pull request SillyTavern#3731 from SillyTavern/fix-srw-trim
Fix replacing user_prompt_bias on display
2 parents fb2f8dc + c5d4bdc commit e3c4652

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

public/script.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2069,8 +2069,9 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
20692069
}
20702070

20712071
// Prompt bias replacement should be applied on the raw message
2072-
if (!power_user.show_user_prompt_bias && ch_name && !isUser && !isSystem) {
2073-
mes = mes.replaceAll(substituteParams(power_user.user_prompt_bias), '');
2072+
const replacedPromptBias = power_user.user_prompt_bias && substituteParams(power_user.user_prompt_bias);
2073+
if (!power_user.show_user_prompt_bias && ch_name && !isUser && !isSystem && replacedPromptBias && mes.startsWith(replacedPromptBias)) {
2074+
mes = mes.slice(replacedPromptBias.length);
20742075
}
20752076

20762077
if (!isSystem) {

0 commit comments

Comments
 (0)