Skip to content

Commit

Permalink
use IsSystemMessage for splicing
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarsh-scottlogic committed Feb 6, 2024
1 parent 32e2346 commit 84cb2c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/utils/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function pushMessageToHistory(
const messagesToRemove = updatedChatHistory.length - maxChatHistoryLength;
if (messagesToRemove < 1) return updatedChatHistory;

const spliceFrom = updatedChatHistory[0].chatMessageType === 'SYSTEM' ? 1 : 0;
const spliceFrom = isSystemMessage(updatedChatHistory[0]) ? 1 : 0;
updatedChatHistory.splice(spliceFrom, messagesToRemove);
return updatedChatHistory;
}
Expand Down

0 comments on commit 84cb2c1

Please sign in to comment.