From 6d8c7ba1403248e1d3c01515d58824bff74bc826 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Sat, 20 May 2023 20:08:17 +0800 Subject: [PATCH] feat: close #1626 hide context prompts in mask config --- app/components/chat.tsx | 4 +++- app/components/mask.tsx | 40 ++++++++++++++++++++++++++++------------ app/locales/cn.ts | 4 ++++ app/locales/en.ts | 6 +++++- app/store/mask.ts | 1 + 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 755901f2..e1cb78de 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -585,7 +585,9 @@ export function Chat() { inputRef.current?.focus(); }; - const context: RenderMessage[] = session.mask.context.slice(); + const context: RenderMessage[] = session.mask.hideContext + ? [] + : session.mask.context.slice(); const accessStore = useAccessStore(); diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 09acaeef..de724e26 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -104,25 +104,41 @@ export function MaskConfig(props: { > { - if ( - e.currentTarget.checked && - confirm(Locale.Mask.Config.Sync.Confirm) - ) { - props.updateMask((mask) => { - mask.syncGlobalConfig = e.currentTarget.checked; - mask.modelConfig = { ...globalConfig.modelConfig }; - }); - } + props.updateMask((mask) => { + mask.hideContext = e.currentTarget.checked; + }); }} > + {props.shouldSyncFromGlobal ? ( + + { + if ( + e.currentTarget.checked && + confirm(Locale.Mask.Config.Sync.Confirm) + ) { + props.updateMask((mask) => { + mask.syncGlobalConfig = e.currentTarget.checked; + mask.modelConfig = { ...globalConfig.modelConfig }; + }); + } + }} + > + + ) : null} diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 9f0ea044..4250178c 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -210,6 +210,10 @@ const cn = { SubTitle: "当前对话是否使用全局模型设置", Confirm: "当前对话的自定义设置将会被自动覆盖,确认启用全局设置?", }, + HideContext: { + Title: "隐藏预设对话", + SubTitle: "隐藏后预设对话不会出现在聊天界面", + }, }, }, NewChat: { diff --git a/app/locales/en.ts b/app/locales/en.ts index dc02aa66..cd7e7c71 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -213,6 +213,10 @@ const en: RequiredLocaleType = { SubTitle: "Use global config in this chat", Confirm: "Confirm to override custom config with global config?", }, + HideContext: { + Title: "Hide Context Prompts", + SubTitle: "Do not show in-context prompts in chat", + }, }, }, NewChat: { @@ -221,7 +225,7 @@ const en: RequiredLocaleType = { Title: "Pick a Mask", SubTitle: "Chat with the Soul behind the Mask", More: "Find More", - NotShow: "Not Show Again", + NotShow: "Dont Show Again", ConfirmNoShow: "Confirm to disable?You can enable it in settings later.", }, diff --git a/app/store/mask.ts b/app/store/mask.ts index a691a7cf..ed45241f 100644 --- a/app/store/mask.ts +++ b/app/store/mask.ts @@ -10,6 +10,7 @@ export type Mask = { id: number; avatar: string; name: string; + hideContext?: boolean; context: ChatMessage[]; syncGlobalConfig?: boolean; modelConfig: ModelConfig;