import { useQueryClient } from "@tanstack/react-query" import { useDarkMode } from "~/hooks/useDarkmode" import { useMessageOption } from "~/hooks/useMessageOption" import { PageAssitDatabase } from "@/db" import { Select, Switch } from "antd" import { SUPPORTED_LANGUAGES } from "~/utils/supported-languages" import { MoonIcon, SunIcon } from "lucide-react" import { SearchModeSettings } from "./search-mode" import { useTranslation } from "react-i18next" import { useI18n } from "@/hooks/useI18n" import { TTSModeSettings } from "./tts-mode" import { exportPageAssistData, importPageAssistData } from "@/libs/export-import" import { useStorage } from "@plasmohq/storage/hook" export const GeneralSettings = () => { const { clearChat } = useMessageOption() const [speechToTextLanguage, setSpeechToTextLanguage] = useStorage( "speechToTextLanguage", "en-US" ) const [copilotResumeLastChat, setCopilotResumeLastChat] = useStorage( "copilotResumeLastChat", false ) const [webUIResumeLastChat, setWebUIResumeLastChat] = useStorage( "webUIResumeLastChat", false ) const [defaultChatWithWebsite, setDefaultChatWithWebsite] = useStorage( "defaultChatWithWebsite", false ) const [restoreLastChatModel, setRestoreLastChatModel] = useStorage( "restoreLastChatModel", false ) const [generateTitle, setGenerateTitle] = useStorage("titleGenEnabled", false) const [hideCurrentChatModelSettings, setHideCurrentChatModelSettings] = useStorage("hideCurrentChatModelSettings", false) const [sendNotificationAfterIndexing, setSendNotificationAfterIndexing] = useStorage("sendNotificationAfterIndexing", false) const [checkOllamaStatus, setCheckOllamaStatus] = useStorage( "checkOllamaStatus", true ) const queryClient = useQueryClient() const { mode, toggleDarkMode } = useDarkMode() const { t } = useTranslation("settings") const { changeLocale, locale, supportLanguage } = useI18n() return (

{t("generalSettings.title")}

{t("generalSettings.settings.speechRecognitionLang.label")} option!.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 || option!.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 } onChange={(value) => { changeLocale(value) }} />
{t("generalSettings.settings.copilotResumeLastChat.label")}
setCopilotResumeLastChat(checked)} />
{t("generalSettings.settings.turnOnChatWithWebsite.label")}
setDefaultChatWithWebsite(checked)} />
{t("generalSettings.settings.webUIResumeLastChat.label")}
setWebUIResumeLastChat(checked)} />
{t("generalSettings.settings.hideCurrentChatModelSettings.label")}
setHideCurrentChatModelSettings(checked)} />
{t("generalSettings.settings.restoreLastChatModel.label")}
setRestoreLastChatModel(checked)} />
{t("generalSettings.settings.sendNotificationAfterIndexing.label")}
{t("generalSettings.settings.generateTitle.label")}
setGenerateTitle(checked)} />
{t("generalSettings.settings.ollamaStatus.label")}
setCheckOllamaStatus(checked)} />
{t("generalSettings.settings.darkMode.label")}

{t("generalSettings.system.heading")}

{t("generalSettings.system.export.label")}
{t("generalSettings.system.import.label")} { if (e.target.files) { importPageAssistData(e.target.files[0]) } }} />
{t("generalSettings.system.deleteChatHistory.label")}
) }