Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#3205 from H0llyW00dzZ/summarizelogic
Browse files Browse the repository at this point in the history
Refactor Summarize Logic
  • Loading branch information
Dean-YZG authored Mar 28, 2024
2 parents 113d961 + 544bab0 commit e38b527
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ export const useChatStore = createPersistStore(
messages: topicMessages,
config: {
model: getSummarizeModel(session.mask.modelConfig.model),
stream: false,
},
onFinish(message) {
get().updateCurrentSession(
Expand Down Expand Up @@ -600,6 +601,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({
Expand All @@ -609,7 +614,7 @@ export const useChatStore = createPersistStore(
}),
),
config: {
...modelConfig,
...modelcfg,
stream: true,
model: getSummarizeModel(session.mask.modelConfig.model),
},
Expand Down

0 comments on commit e38b527

Please sign in to comment.