Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#2112 from songxiaocheng/PR/history-…
Browse files Browse the repository at this point in the history
…message-count

fix: ChatGPTNextWeb#2111 make "Attached Messages Count" working
  • Loading branch information
Yidadaa authored Jun 24, 2023
2 parents c636993 + 91d8f9d commit 35ba898
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,9 @@ export const useChatStore = create<ChatStore>()(
// 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;
Expand Down

0 comments on commit 35ba898

Please sign in to comment.