Browse Source

refactor: #2256 hide builtin masks

Yidadaa 1 year ago
parent
commit
54bd07702c

+ 2 - 2
app/components/settings.tsx

@@ -568,11 +568,11 @@ export function Settings() {
           >
             <input
               type="checkbox"
-              checked={!config.dontAddBuiltinMasks}
+              checked={config.hideBuiltinMasks}
               onChange={(e) =>
                 updateConfig(
                   (config) =>
-                    (config.dontAddBuiltinMasks = !e.currentTarget.checked),
+                    (config.hideBuiltinMasks = e.currentTarget.checked),
                 )
               }
             ></input>

+ 0 - 4
app/locales/ar.ts

@@ -134,10 +134,6 @@ const ar: PartialLocaleType = {
         Title: "شاشة تظهر الأقنعة",
         SubTitle: "عرض شاشة تظهر الأقنعة قبل بدء الدردشة الجديدة",
       },
-      Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
-      },
     },
     Prompt: {
       Disable: {

+ 2 - 2
app/locales/cn.ts

@@ -161,8 +161,8 @@ const cn = {
         SubTitle: "新建聊天时,展示面具启动页",
       },
       Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
+        Title: "隐藏内置面具",
+        SubTitle: "在所有面具列表中隐藏内置面具",
       },
     },
     Prompt: {

+ 0 - 4
app/locales/cs.ts

@@ -91,10 +91,6 @@ const cs: PartialLocaleType = {
         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: {
       Disable: {

+ 0 - 4
app/locales/de.ts

@@ -91,10 +91,6 @@ const de: PartialLocaleType = {
         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: {
       Disable: {

+ 2 - 2
app/locales/en.ts

@@ -162,8 +162,8 @@ const en: LocaleType = {
         SubTitle: "Show a mask splash screen before starting new chat",
       },
       Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
+        Title: "Hide Builtin Masks",
+        SubTitle: "Hide builtin masks in mask list",
       },
     },
     Prompt: {

+ 0 - 4
app/locales/es.ts

@@ -91,10 +91,6 @@ const es: PartialLocaleType = {
         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: {
       Disable: {

+ 0 - 4
app/locales/fr.ts

@@ -93,10 +93,6 @@ const fr: PartialLocaleType = {
         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: {
       Disable: {

+ 0 - 4
app/locales/it.ts

@@ -91,10 +91,6 @@ const it: PartialLocaleType = {
         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: {
       Disable: {

+ 0 - 4
app/locales/jp.ts

@@ -108,10 +108,6 @@ const jp: PartialLocaleType = {
         Title: "キャラクターページ",
         SubTitle: "新規チャット作成時にキャラクターページを表示する",
       },
-      Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
-      },
     },
     Prompt: {
       Disable: {

+ 0 - 4
app/locales/ko.ts

@@ -91,10 +91,6 @@ const ko: PartialLocaleType = {
         Title: "마스크 시작 화면",
         SubTitle: "새로운 채팅 시작 전에 마스크 시작 화면 표시",
       },
-      Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
-      },
     },
     Prompt: {
       Disable: {

+ 0 - 4
app/locales/ru.ts

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

+ 0 - 4
app/locales/tr.ts

@@ -91,10 +91,6 @@ const tr: PartialLocaleType = {
         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: {
       Disable: {

+ 0 - 4
app/locales/tw.ts

@@ -89,10 +89,6 @@ const tw: PartialLocaleType = {
         Title: "面具启动页",
         SubTitle: "新建聊天时,展示面具启动页",
       },
-      Builtin: {
-        Title: "Show Builtin Masks",
-        SubTitle: "Show builtin masks in mask list",
-      },
     },
     Prompt: {
       Disable: {

+ 0 - 4
app/locales/vi.ts

@@ -91,10 +91,6 @@ const vi: PartialLocaleType = {
         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: {
       Disable: {

+ 4 - 3
app/store/config.ts

@@ -32,7 +32,7 @@ export const DEFAULT_CONFIG = {
   disablePromptHint: false,
 
   dontShowMaskSplashScreen: false, // dont show splash screen when create chat
-  dontAddBuiltinMasks: false, // dont add builtin masks
+  hideBuiltinMasks: false, // dont add builtin masks
 
   models: DEFAULT_MODELS as any as LLMModel[],
 
@@ -137,9 +137,9 @@ export const useAppConfig = create<ChatConfigStore>()(
     }),
     {
       name: StoreKey.Config,
-      version: 3.3,
+      version: 3.4,
       migrate(persistedState, version) {
-        if (version === 3.3) return persistedState as any;
+        if (version === 3.4) return persistedState as any;
 
         const state = persistedState as ChatConfig;
         state.modelConfig.sendMemory = true;
@@ -149,6 +149,7 @@ export const useAppConfig = create<ChatConfigStore>()(
         state.modelConfig.top_p = 1;
         state.modelConfig.template = DEFAULT_INPUT_TEMPLATE;
         state.dontShowMaskSplashScreen = false;
+        state.hideBuiltinMasks = false;
 
         return state;
       },

+ 1 - 1
app/store/mask.ts

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