mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-25 23:20:19 +09:00
fix: prevent users from setting a extremly short history that resulting in no content being sent for the title summary
This commit is contained in:
parent
37c0cfe1e9
commit
fa48ace39b
@ -595,9 +595,13 @@ export const useChatStore = createPersistStore(
|
||||
countMessages(messages) >= SUMMARIZE_MIN_LEN) ||
|
||||
refreshTitle
|
||||
) {
|
||||
const startIndex = Math.max(
|
||||
0,
|
||||
messages.length - modelConfig.historyMessageCount,
|
||||
);
|
||||
const topicMessages = messages
|
||||
.slice(
|
||||
messages.length - modelConfig.historyMessageCount,
|
||||
startIndex < messages.length ? startIndex : messages.length - 1,
|
||||
messages.length,
|
||||
)
|
||||
.concat(
|
||||
|
Loading…
Reference in New Issue
Block a user