Added ability to resume previous chat on copilot

This commit is contained in:
n4ze3m
2024-05-24 21:01:10 +05:30
parent 9e2ef72486
commit 961f5180c6
7 changed files with 88 additions and 26 deletions

View File

@@ -1,13 +1,11 @@
import { BetaTag } from "@/components/Common/Beta"
import { SaveButton } from "@/components/Common/SaveButton"
import { getAllModelSettings, setModelSetting } from "@/services/model-settings"
import { useQuery, useQueryClient } from "@tanstack/react-query"
import { Form, Skeleton, Input, InputNumber, Collapse } from "antd"
import React from "react"
import { useTranslation } from "react-i18next"
// keepAlive?: string
// temperature?: number
// topK?: number
// topP?: number
export const ModelSettings = () => {
const { t } = useTranslation("common")
@@ -25,9 +23,12 @@ export const ModelSettings = () => {
return (
<div>
<div>
<div className="inline-flex items-center gap-3">
<BetaTag />
<h2 className="text-base font-semibold leading-7 text-gray-900 dark:text-white">
{t("modelSettings.label")}
{t("modelSettings.label")}
</h2>
</div>
<p className="text-sm text-gray-500 dark:text-neutral-400 mt-1">
{t("modelSettings.description")}
</p>

View File

@@ -2,7 +2,7 @@ import { useQueryClient } from "@tanstack/react-query"
import { useDarkMode } from "~/hooks/useDarkmode"
import { useMessageOption } from "~/hooks/useMessageOption"
import { PageAssitDatabase } from "@/db"
import { Select } from "antd"
import { Select, Switch } from "antd"
import { SUPPORTED_LANGUAGES } from "~/utils/supporetd-languages"
import { MoonIcon, SunIcon } from "lucide-react"
import { SearchModeSettings } from "./search-mode"
@@ -14,11 +14,20 @@ import {
importPageAssistData
} from "@/libs/export-import"
import { BetaTag } from "@/components/Common/Beta"
import { useStorage } from "@plasmohq/storage/hook"
export const SettingOther = () => {
const { clearChat, speechToTextLanguage, setSpeechToTextLanguage } =
useMessageOption()
const [copilotResumeLastChat, setCopilotResumeLastChat] = useStorage(
"copilotResumeLastChat",
false
)
const [hideCurrentChatModelSettings, setHideCurrentChatModelSettings] =
useStorage("hideCurrentChatModelSettings", false)
const queryClient = useQueryClient()
const { mode, toggleDarkMode } = useDarkMode()
@@ -34,7 +43,7 @@ export const SettingOther = () => {
<div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div>
</div>
<div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-neutral-50">
<span className="text-gray-500 dark:text-neutral-50">
{t("generalSettings.settings.speechRecognitionLang.label")}
</span>
@@ -76,6 +85,29 @@ export const SettingOther = () => {
}}
/>
</div>
<div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-neutral-50">
{t("generalSettings.settings.copilotResumeLastChat.label")}
</span>
<Switch
checked={copilotResumeLastChat}
onChange={(checked) => setCopilotResumeLastChat(checked)}
/>
</div>
<div className="flex flex-row justify-between">
<div className="inline-flex items-center gap-2">
<BetaTag />
<span className="text-gray-500 dark:text-neutral-50">
{t("generalSettings.settings.hideCurrentChatModelSettings.label")}
</span>
</div>
<Switch
checked={hideCurrentChatModelSettings}
onChange={(checked) => setHideCurrentChatModelSettings(checked)}
/>
</div>
<div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-neutral-50 ">
{t("generalSettings.settings.darkMode.label")}
@@ -129,7 +161,7 @@ export const SettingOther = () => {
</div>
<div className="flex flex-row mb-3 justify-between">
<span className="text-gray-500 dark:text-neutral-50 ">
<BetaTag /> {t("generalSettings.system.export.label")}
{t("generalSettings.system.export.label")}
</span>
<button
onClick={exportPageAssistData}
@@ -139,7 +171,7 @@ export const SettingOther = () => {
</div>
<div className="flex flex-row mb-3 justify-between">
<span className="text-gray-500 dark:text-neutral-50 ">
<BetaTag /> {t("generalSettings.system.import.label")}
{t("generalSettings.system.import.label")}
</span>
<label
htmlFor="import"