From 25cb97d452e3df3f6f8e380e7e076cdd3b96b676 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Fri, 24 May 2024 23:56:54 +0530 Subject: [PATCH] feat: Add Copilot resume chat and hide current chat model settings --- src/components/Sidepanel/Settings/body.tsx | 142 ++++++++++++++------- 1 file changed, 96 insertions(+), 46 deletions(-) diff --git a/src/components/Sidepanel/Settings/body.tsx b/src/components/Sidepanel/Settings/body.tsx index 88f4450..32d5d1f 100644 --- a/src/components/Sidepanel/Settings/body.tsx +++ b/src/components/Sidepanel/Settings/body.tsx @@ -14,7 +14,15 @@ import { saveForRag } from "~/services/ollama" -import { Skeleton, Radio, Select, Form, InputNumber, Collapse } from "antd" +import { + Skeleton, + Radio, + Select, + Form, + InputNumber, + Collapse, + Switch +} from "antd" import { useDarkMode } from "~/hooks/useDarkmode" import { SaveButton } from "~/components/Common/SaveButton" import { SUPPORTED_LANGUAGES } from "~/utils/supporetd-languages" @@ -24,6 +32,8 @@ import { Trans, useTranslation } from "react-i18next" import { useI18n } from "@/hooks/useI18n" import { TTSModeSettings } from "@/components/Option/Settings/tts-mode" import { AdvanceOllamaSettings } from "@/components/Common/Settings/AdvanceOllamaSettings" +import { useStorage } from "@plasmohq/storage/hook" +import { BetaTag } from "@/components/Common/Beta" export const SettingsBody = () => { const { t } = useTranslation("settings") @@ -34,6 +44,13 @@ export const SettingsBody = () => { const [selectedValue, setSelectedValue] = React.useState<"normal" | "rag">( "normal" ) + const [copilotResumeLastChat, setCopilotResumeLastChat] = useStorage( + "copilotResumeLastChat", + false + ) + + const [hideCurrentChatModelSettings, setHideCurrentChatModelSettings] = + useStorage("hideCurrentChatModelSettings", false) const { speechToTextLanguage, setSpeechToTextLanguage } = useMessage() const { mode, toggleDarkMode } = useDarkMode() @@ -318,54 +335,87 @@ export const SettingsBody = () => { + +
+

+ {t("generalSettings.title")} +

+
+ + {t("generalSettings.settings.copilotResumeLastChat.label")} + + +
+ setCopilotResumeLastChat(checked)} + /> +
+
+
+
+ + {t("generalSettings.settings.hideCurrentChatModelSettings.label")} + +
+
+ setHideCurrentChatModelSettings(checked)} + /> +
+
+
+
+ {t("generalSettings.settings.speechRecognitionLang.label")}{" "} +
+ + option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 || + option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + onChange={(value) => { + changeLocale(value) + }} + style={{ + width: "100%" + }} + /> +
+
+
-
-

- {t("generalSettings.settings.language.label")}{" "} -

- - option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 || - option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } - onChange={(value) => { - setSpeechToTextLanguage(value) - }} - style={{ - width: "100%" - }} - /> -

{t("generalSettings.settings.darkMode.label")}{" "}