mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2026-04-22 02:54:26 +08:00
Merge aa23458c6a into 0af04e0f2f
This commit is contained in:
@@ -83,6 +83,8 @@ export interface ChatSession {
|
||||
clearContextIndex?: number;
|
||||
|
||||
mask: Mask;
|
||||
|
||||
overrideModelConfig?: Partial<ModelConfig>;
|
||||
}
|
||||
|
||||
export const DEFAULT_TOPIC = Locale.Store.DefaultTopic;
|
||||
@@ -542,7 +544,9 @@ export const useChatStore = createPersistStore(
|
||||
// short term memory
|
||||
const shortTermMemoryStartIndex = Math.max(
|
||||
0,
|
||||
totalMessageCount - modelConfig.historyMessageCount,
|
||||
totalMessageCount -
|
||||
(session.overrideModelConfig?.historyMessageCount ??
|
||||
modelConfig.historyMessageCount),
|
||||
);
|
||||
|
||||
// lets concat send messages, including 4 parts:
|
||||
@@ -679,7 +683,12 @@ export const useChatStore = createPersistStore(
|
||||
if (historyMsgLength > (modelConfig?.max_tokens || 4000)) {
|
||||
const n = toBeSummarizedMsgs.length;
|
||||
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
|
||||
Math.max(0, n - modelConfig.historyMessageCount),
|
||||
Math.max(
|
||||
0,
|
||||
n -
|
||||
(session.overrideModelConfig?.historyMessageCount ??
|
||||
modelConfig.historyMessageCount),
|
||||
),
|
||||
);
|
||||
}
|
||||
const memoryPrompt = get().getMemoryPrompt();
|
||||
|
||||
Reference in New Issue
Block a user