Browse Source

remove error messages in toBeSummarizedMsgs

PaRaD1SE98 1 year ago
parent
commit
a9f000e7ef
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/store/chat.ts

+ 4 - 1
app/store/chat.ts

@@ -423,7 +423,10 @@ export const useChatStore = create<ChatStore>()(
         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) {