From 91d8f9d73e24d90c668b2dcc98b2eb9df98eac5b Mon Sep 17 00:00:00 2001 From: Xiaocheng Song Date: Sat, 24 Jun 2023 05:53:39 +0800 Subject: [PATCH] fix: #2111 make "Attached Messages Count" working --- app/store/chat.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index d311c88f..d4203100 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -405,10 +405,9 @@ export const useChatStore = create()( // 2. pre-defined in-context prompts // 3. short term memory: latest n messages // 4. newest input message - const memoryStartIndex = Math.min( - longTermMemoryStartIndex, - shortTermMemoryStartIndex, - ); + const memoryStartIndex = shouldSendLongTermMemory + ? Math.min(longTermMemoryStartIndex, shortTermMemoryStartIndex) + : shortTermMemoryStartIndex; // and if user has cleared history messages, we should exclude the memory too. const contextStartIndex = Math.max(clearContextIndex, memoryStartIndex); const maxTokenThreshold = modelConfig.max_tokens;