mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix newline trimming for the last message
This commit is contained in:
@ -3505,16 +3505,19 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
console.debug('generating prompt');
|
||||
chatString = '';
|
||||
arrMes = arrMes.reverse();
|
||||
arrMes.forEach(function (item, i, arr) {// For added anchors and others
|
||||
arrMes.forEach(function (item, i, arr) {
|
||||
// OAI doesn't need all of this
|
||||
if (main_api === 'openai') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cohee: I'm not even sure what this is for anymore
|
||||
// Cohee: This removes a newline from the end of the last message in the context
|
||||
// Last prompt line will add a newline if it's not a continuation
|
||||
if (i === arrMes.length - 1 && type !== 'continue') {
|
||||
if (!isInstruct || power_user.instruct.wrap) {
|
||||
item = item.replace(/\n?$/, '');
|
||||
}
|
||||
}
|
||||
|
||||
mesSend[mesSend.length] = { message: item, extensionPrompts: [] };
|
||||
});
|
||||
|
Reference in New Issue
Block a user