diff --git a/app/store/chat.ts b/app/store/chat.ts index cb11087d..b8cdecb6 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -423,7 +423,10 @@ export const useChatStore = create()( let toBeSummarizedMsgs = session.messages.slice( session.lastSummarizeIndex, ); - + + // remove error messages if any + toBeSummarizedMsgs = toBeSummarizedMsgs.filter((msg) => !msg.isError); + const historyMsgLength = countMessages(toBeSummarizedMsgs); if (historyMsgLength > modelConfig?.max_tokens ?? 4000) {