fix: squashing system messages would fail to skip example messages
This commit is contained in:
parent
a5d00d356b
commit
41860bdc57
|
@ -2233,8 +2233,12 @@ export class ChatCompletion {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!excludeList.includes(message.identifier) && message.role === 'system' && !message.name) {
|
||||
if (lastMessage && lastMessage.role === 'system') {
|
||||
const shouldSquash = (message) => {
|
||||
return !excludeList.includes(message.identifier) && message.role === 'system' && !message.name;
|
||||
}
|
||||
|
||||
if (shouldSquash(message)) {
|
||||
if (lastMessage && shouldSquash(lastMessage)) {
|
||||
lastMessage.content += '\n' + message.content;
|
||||
lastMessage.tokens = tokenHandler.count({ role: lastMessage.role, content: lastMessage.content });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue