Browse Source

fix: historyMessageCount

Cesaryuan 1 year ago
parent
commit
12f342f015
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(
-          - config.historyMessageCount,
+          Math.max(0, n - config.historyMessageCount),
         );
 
         const memoryPrompt = get().getMemoryPrompt();