Browse Source

fix: fix history message count

Bug: The length of `new Array(20).slice(20 - 24) ` is 4 which should be 24.
Cesaryuan 1 year ago
parent
commit
fea4f561b4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/store/app.ts

+ 1 - 1
app/store/app.ts

@@ -384,7 +384,7 @@ export const useChatStore = create<ChatStore>()(
         const config = get().config;
         const n = session.messages.length;
         const recentMessages = session.messages.slice(
-          n - config.historyMessageCount,
+          - config.historyMessageCount,
         );
 
         const memoryPrompt = get().getMemoryPrompt();