From 544bab0fe29fa9c62d6d8fd5026c97d2efda3d96 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Thu, 9 Nov 2023 20:56:45 +0700 Subject: [PATCH] Refactor Summarize Logic [+] chore(chat.ts): remove unnecessary comment and refactor variable name [+] feat(chat.ts): add stream: false to config object --- app/store/chat.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index ff7eb51b5c1..6eb4e934f18 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -494,6 +494,7 @@ export const useChatStore = createPersistStore( messages: topicMessages, config: { model: getSummarizeModel(session.mask.modelConfig.model), + stream: false, }, onFinish(message) { get().updateCurrentSession( @@ -539,6 +540,10 @@ export const useChatStore = createPersistStore( historyMsgLength > modelConfig.compressMessageLengthThreshold && modelConfig.sendMemory ) { + /** Destruct max_tokens while summarizing + * this param is just shit + **/ + const { max_tokens, ...modelcfg } = modelConfig; api.llm.chat({ messages: toBeSummarizedMsgs.concat( createMessage({ @@ -548,7 +553,7 @@ export const useChatStore = createPersistStore( }), ), config: { - ...modelConfig, + ...modelcfg, stream: true, model: getSummarizeModel(session.mask.modelConfig.model), },