mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 20:32:46 +08:00
feat: add autoGenerateTitle option
(cherry picked from commit 656ab94a9c4edfee820616b8cfc39f5ee9952a3a)
This commit is contained in:
@@ -479,6 +479,7 @@ export const useChatStore = create<ChatStore>()(
|
||||
},
|
||||
|
||||
summarizeSession() {
|
||||
const config = useAppConfig.getState();
|
||||
const session = get().currentSession();
|
||||
|
||||
// remove error messages if any
|
||||
@@ -487,6 +488,7 @@ export const useChatStore = create<ChatStore>()(
|
||||
// should summarize topic after chating more than 50 words
|
||||
const SUMMARIZE_MIN_LEN = 50;
|
||||
if (
|
||||
config.enableAutoGenerateTitle &&
|
||||
session.topic === DEFAULT_TOPIC &&
|
||||
countMessages(messages) >= SUMMARIZE_MIN_LEN
|
||||
) {
|
||||
|
@@ -27,6 +27,7 @@ export const DEFAULT_CONFIG = {
|
||||
theme: Theme.Auto as Theme,
|
||||
tightBorder: !!getClientConfig()?.isApp,
|
||||
sendPreviewBubble: true,
|
||||
enableAutoGenerateTitle: true,
|
||||
sidebarWidth: 300,
|
||||
|
||||
disablePromptHint: false,
|
||||
@@ -147,7 +148,7 @@ export const useAppConfig = create<ChatConfigStore>()(
|
||||
}),
|
||||
{
|
||||
name: StoreKey.Config,
|
||||
version: 3.6,
|
||||
version: 3.7,
|
||||
migrate(persistedState, version) {
|
||||
const state = persistedState as ChatConfig;
|
||||
|
||||
@@ -170,6 +171,10 @@ export const useAppConfig = create<ChatConfigStore>()(
|
||||
state.modelConfig.enableInjectSystemPrompts = true;
|
||||
}
|
||||
|
||||
if (version < 3.7) {
|
||||
state.enableAutoGenerateTitle = true;
|
||||
}
|
||||
|
||||
return state as any;
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user