Merge pull request #2256 from marcusschiesser/main

feat: add setting to hide built-in masks
This commit is contained in:
Yifei Zhang 2023-07-05 22:30:28 +08:00 committed by GitHub
commit a75e2b0c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 135 additions and 31 deletions

View File

@ -542,10 +542,12 @@ export function Settings() {
} }
></input> ></input>
</ListItem> </ListItem>
</List>
<List>
<ListItem <ListItem
title={Locale.Settings.Mask.Title} title={Locale.Settings.Mask.Splash.Title}
subTitle={Locale.Settings.Mask.SubTitle} subTitle={Locale.Settings.Mask.Splash.SubTitle}
> >
<input <input
type="checkbox" type="checkbox"
@ -559,6 +561,22 @@ export function Settings() {
} }
></input> ></input>
</ListItem> </ListItem>
<ListItem
title={Locale.Settings.Mask.Builtin.Title}
subTitle={Locale.Settings.Mask.Builtin.SubTitle}
>
<input
type="checkbox"
checked={!config.dontAddBuiltinMasks}
onChange={(e) =>
updateConfig(
(config) =>
(config.dontAddBuiltinMasks = !e.currentTarget.checked),
)
}
></input>
</ListItem>
</List> </List>
<List> <List>

View File

@ -130,8 +130,14 @@ const ar: PartialLocaleType = {
SubTitle: "معاينة Markdown في فقاعة", SubTitle: "معاينة Markdown في فقاعة",
}, },
Mask: { Mask: {
Title: "شاشة تظهر الأقنعة", Splash: {
SubTitle: "عرض شاشة تظهر الأقنعة قبل بدء الدردشة الجديدة", Title: "شاشة تظهر الأقنعة",
SubTitle: "عرض شاشة تظهر الأقنعة قبل بدء الدردشة الجديدة",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -156,8 +156,14 @@ const cn = {
SubTitle: "在预览气泡中预览 Markdown 内容", SubTitle: "在预览气泡中预览 Markdown 内容",
}, },
Mask: { Mask: {
Title: "面具启动页", Splash: {
SubTitle: "新建聊天时,展示面具启动页", Title: "面具启动页",
SubTitle: "新建聊天时,展示面具启动页",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const cs: PartialLocaleType = {
SubTitle: "Zobrazit v náhledu bubliny", SubTitle: "Zobrazit v náhledu bubliny",
}, },
Mask: { Mask: {
Title: "Úvodní obrazovka Masek", Splash: {
SubTitle: "Před zahájením nového chatu zobrazte úvodní obrazovku Masek", Title: "Úvodní obrazovka Masek",
SubTitle: "Před zahájením nového chatu zobrazte úvodní obrazovku Masek",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const de: PartialLocaleType = {
SubTitle: "Preview markdown in bubble", SubTitle: "Preview markdown in bubble",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Show a mask splash screen before starting new chat", Title: "Mask Splash Screen",
SubTitle: "Show a mask splash screen before starting new chat",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -157,8 +157,14 @@ const en: LocaleType = {
SubTitle: "Preview markdown in bubble", SubTitle: "Preview markdown in bubble",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Show a mask splash screen before starting new chat", Title: "Mask Splash Screen",
SubTitle: "Show a mask splash screen before starting new chat",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const es: PartialLocaleType = {
SubTitle: "Preview markdown in bubble", SubTitle: "Preview markdown in bubble",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Show a mask splash screen before starting new chat", Title: "Mask Splash Screen",
SubTitle: "Show a mask splash screen before starting new chat",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -88,9 +88,15 @@ const fr: PartialLocaleType = {
SubTitle: "Aperçu du Markdown dans une bulle", SubTitle: "Aperçu du Markdown dans une bulle",
}, },
Mask: { Mask: {
Title: "Écran de masque", Splash: {
SubTitle: Title: "Écran de masque",
"Afficher un écran de masque avant de démarrer une nouvelle discussion", SubTitle:
"Afficher un écran de masque avant de démarrer une nouvelle discussion",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const it: PartialLocaleType = {
SubTitle: "Preview markdown in bubble", SubTitle: "Preview markdown in bubble",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Show a mask splash screen before starting new chat", Title: "Mask Splash Screen",
SubTitle: "Show a mask splash screen before starting new chat",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -104,8 +104,14 @@ const jp: PartialLocaleType = {
SubTitle: "プレビューバブルでマークダウンコンテンツをプレビュー", SubTitle: "プレビューバブルでマークダウンコンテンツをプレビュー",
}, },
Mask: { Mask: {
Title: "キャラクターページ", Splash: {
SubTitle: "新規チャット作成時にキャラクターページを表示する", Title: "キャラクターページ",
SubTitle: "新規チャット作成時にキャラクターページを表示する",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const ko: PartialLocaleType = {
SubTitle: "버블에서 마크다운 미리 보기", SubTitle: "버블에서 마크다운 미리 보기",
}, },
Mask: { Mask: {
Title: "마스크 시작 화면", Splash: {
SubTitle: "새로운 채팅 시작 전에 마스크 시작 화면 표시", Title: "마스크 시작 화면",
SubTitle: "새로운 채팅 시작 전에 마스크 시작 화면 표시",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const ru: PartialLocaleType = {
SubTitle: "Предварительный просмотр markdown в пузыре", SubTitle: "Предварительный просмотр markdown в пузыре",
}, },
Mask: { Mask: {
Title: "Экран заставки маски", Splash: {
SubTitle: "Показывать экран заставки маски перед началом нового чата", Title: "Экран заставки маски",
SubTitle: "Показывать экран заставки маски перед началом нового чата",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const tr: PartialLocaleType = {
SubTitle: "Preview markdown in bubble", SubTitle: "Preview markdown in bubble",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Show a mask splash screen before starting new chat", Title: "Mask Splash Screen",
SubTitle: "Show a mask splash screen before starting new chat",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -85,8 +85,14 @@ const tw: PartialLocaleType = {
SubTitle: "在预览气泡中预览 Markdown 内容", SubTitle: "在预览气泡中预览 Markdown 内容",
}, },
Mask: { Mask: {
Title: "面具启动页", Splash: {
SubTitle: "新建聊天时,展示面具启动页", Title: "面具启动页",
SubTitle: "新建聊天时,展示面具启动页",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -87,8 +87,14 @@ const vi: PartialLocaleType = {
SubTitle: "Xem trước nội dung markdown bằng bong bóng", SubTitle: "Xem trước nội dung markdown bằng bong bóng",
}, },
Mask: { Mask: {
Title: "Mask Splash Screen", Splash: {
SubTitle: "Chớp màn hình khi bắt đầu cuộc trò chuyện mới", Title: "Mask Splash Screen",
SubTitle: "Chớp màn hình khi bắt đầu cuộc trò chuyện mới",
},
Builtin: {
Title: "Show Builtin Masks",
SubTitle: "Show builtin masks in mask list",
},
}, },
Prompt: { Prompt: {
Disable: { Disable: {

View File

@ -32,6 +32,7 @@ export const DEFAULT_CONFIG = {
disablePromptHint: false, disablePromptHint: false,
dontShowMaskSplashScreen: false, // dont show splash screen when create chat dontShowMaskSplashScreen: false, // dont show splash screen when create chat
dontAddBuiltinMasks: false, // dont add builtin masks
models: DEFAULT_MODELS as any as LLMModel[], models: DEFAULT_MODELS as any as LLMModel[],

View File

@ -90,6 +90,7 @@ export const useMaskStore = create<MaskStore>()(
(a, b) => b.id - a.id, (a, b) => b.id - a.id,
); );
const config = useAppConfig.getState(); const config = useAppConfig.getState();
if (config.dontAddBuiltinMasks) return userMasks;
const buildinMasks = BUILTIN_MASKS.map( const buildinMasks = BUILTIN_MASKS.map(
(m) => (m) =>
({ ({