remove error messages in toBeSummarizedMsgs

This commit is contained in:
PaRaD1SE98 2023-05-14 01:24:20 +09:00 committed by GitHub
parent d9be63e6cb
commit a9f000e7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,6 +424,9 @@ export const useChatStore = create<ChatStore>()(
session.lastSummarizeIndex,
);
// remove error messages if any
toBeSummarizedMsgs = toBeSummarizedMsgs.filter((msg) => !msg.isError);
const historyMsgLength = countMessages(toBeSummarizedMsgs);
if (historyMsgLength > modelConfig?.max_tokens ?? 4000) {