From 20a508e2d6e16252e44f6a9cbb07dd5c195b6fc3 Mon Sep 17 00:00:00 2001 From: imldy Date: Sat, 15 Jul 2023 02:13:39 +0800 Subject: [PATCH 1/2] feat: add autoGenerateTitle option (cherry picked from commit 656ab94a9c4edfee820616b8cfc39f5ee9952a3a) --- app/components/settings.tsx | 16 ++++++++++++++++ app/locales/cn.ts | 5 +++++ app/locales/en.ts | 5 +++++ app/store/chat.ts | 2 ++ app/store/config.ts | 7 ++++++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index c438f68c563..1e6ef7139ba 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -529,6 +529,22 @@ export function Settings() { > + + + updateConfig( + (config) => + (config.enableAutoGenerateTitle = e.currentTarget.checked), + ) + } + > + + ()( }, summarizeSession() { + const config = useAppConfig.getState(); const session = get().currentSession(); // remove error messages if any @@ -487,6 +488,7 @@ export const useChatStore = create()( // 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 ) { diff --git a/app/store/config.ts b/app/store/config.ts index d963d39ddfc..7070ea05e32 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -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()( }), { 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()( state.modelConfig.enableInjectSystemPrompts = true; } + if (version < 3.7) { + state.enableAutoGenerateTitle = true; + } + return state as any; }, }, From 803b66ae9d871300bb077a0b89ddf050d5240936 Mon Sep 17 00:00:00 2001 From: imldy Date: Mon, 14 Aug 2023 20:47:02 +0800 Subject: [PATCH 2/2] chore: Concise description --- app/locales/cn.ts | 3 +-- app/locales/en.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 0636a116af3..3929e09e7ca 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -172,8 +172,7 @@ const cn = { }, AutoGenerateTitle: { Title: "自动生成标题", - SubTitle: - "根据对话内容生成合适的标题(需标题为默认标题,并且内容长度大于设定的最小长度)", + SubTitle: "根据对话内容生成合适的标题", }, Mask: { Splash: { diff --git a/app/locales/en.ts b/app/locales/en.ts index 75cd02ed506..d37149c9298 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -174,8 +174,7 @@ const en: LocaleType = { }, AutoGenerateTitle: { Title: "Auto Generate Title", - SubTitle: - "Generate a suitable title based on the conversation content (requires default title and content length greater than the set minimum length)", + SubTitle: "Generate a suitable title based on the conversation content", }, Mask: { Splash: {