Fix replacing user_prompt_bias on display

This commit is contained in:
Cohee
2025-03-19 15:52:51 +00:00
parent d5d3516e18
commit 0607ac98db

View File

@ -2069,8 +2069,9 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
} }
// Prompt bias replacement should be applied on the raw message // Prompt bias replacement should be applied on the raw message
if (!power_user.show_user_prompt_bias && ch_name && !isUser && !isSystem) { const replacedPromptBias = power_user.user_prompt_bias && substituteParams(power_user.user_prompt_bias);
mes = mes.replaceAll(substituteParams(power_user.user_prompt_bias), ''); if (!power_user.show_user_prompt_bias && ch_name && !isUser && !isSystem && replacedPromptBias && mes.startsWith(replacedPromptBias)) {
mes = mes.slice(replacedPromptBias.length);
} }
if (!isSystem) { if (!isSystem) {