From 1db210097c431fa460aea5b8a1bb697fb0f2db6d Mon Sep 17 00:00:00 2001 From: RugerMc <550279039@qq.com> Date: Fri, 31 Mar 2023 13:16:12 +0800 Subject: [PATCH 1/2] feat: add switch of send preview bubble --- app/components/home.tsx | 27 ++++++++++++++------------- app/components/settings.tsx | 12 ++++++++++++ app/locales/cn.ts | 1 + app/locales/en.ts | 1 + app/locales/tw.ts | 1 + app/store/app.ts | 2 ++ 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 2f09aa27..2da10196 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -292,6 +292,8 @@ export function Chat(props: { const latestMessageRef = useRef(null); const [autoScroll, setAutoScroll] = useState(true); + const config = useChatStore((state) => state.config); + // preview messages const messages = (session.messages as RenderMessage[]) .concat( @@ -305,19 +307,18 @@ export function Chat(props: { }, ] : [], - ) - .concat( - userInput.length > 0 - ? [ - { - role: "user", - content: userInput, - date: new Date().toLocaleString(), - preview: true, - }, - ] - : [], - ); + ).concat( + userInput.length > 0 && config.sendPreviewBubble + ? [ + { + role: "user", + content: userInput, + date: new Date().toLocaleString(), + preview: false, + }, + ] + : [], + ); // auto scroll useLayoutEffect(() => { diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 711cb954..06ff76e1 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -278,6 +278,18 @@ export function Settings(props: { closeSettings: () => void }) { } > + + + + updateConfig( + (config) => (config.sendPreviewBubble = e.currentTarget.checked), + ) + } + > + Date: Sun, 2 Apr 2023 20:38:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9E=20fix(locales):=20Fix=20the=20?= =?UTF-8?q?missing=20SendPreviewBubble=20in=20ES=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/locales/es.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/locales/es.ts b/app/locales/es.ts index 1850e4cf..a78bf1aa 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -78,6 +78,7 @@ const es: LocaleType = { SendKey: "Tecla de envío", Theme: "Tema", TightBorder: "Borde ajustado", + SendPreviewBubble: "Send preview bubble", Prompt: { Disable: { Title: "Desactivar autocompletado",