feat: Clear all browser storage when deleting chat history and use local instead of sync
This commit is contained in:
parent
143541e915
commit
caf1dfcbe8
@ -239,6 +239,13 @@ export const GeneralSettings = () => {
|
||||
})
|
||||
clearChat()
|
||||
}
|
||||
try {
|
||||
await browser.storage.sync.clear()
|
||||
await browser.storage.local.clear()
|
||||
await browser.storage.session.clear()
|
||||
} catch (e) {
|
||||
console.log("Error clearing storage:", e)
|
||||
}
|
||||
}}
|
||||
className="bg-red-500 dark:bg-red-600 text-white dark:text-gray-200 px-4 py-2 rounded-md">
|
||||
{t("generalSettings.system.deleteChatHistory.button")}
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { Storage } from "@plasmohq/storage"
|
||||
const storage = new Storage()
|
||||
const storage = new Storage({
|
||||
area: "local"
|
||||
})
|
||||
|
||||
type ModelSettings = {
|
||||
f16KV?: boolean
|
||||
@ -63,7 +65,7 @@ const keys = [
|
||||
"vocabOnly"
|
||||
]
|
||||
|
||||
const getAllModelSettings = async () => {
|
||||
export const getAllModelSettings = async () => {
|
||||
try {
|
||||
const settings: ModelSettings = {}
|
||||
for (const key of keys) {
|
||||
@ -80,7 +82,7 @@ const getAllModelSettings = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const setModelSetting = async (
|
||||
export const setModelSetting = async (
|
||||
key: string,
|
||||
value: string | number | boolean
|
||||
) => {
|
||||
@ -144,4 +146,3 @@ export const setLastUsedChatSystemPrompt = async (
|
||||
await storage.set(`lastUsedChatSystemPrompt-${historyId}`, prompt)
|
||||
}
|
||||
|
||||
export { getAllModelSettings, setModelSetting }
|
||||
|
Loading…
x
Reference in New Issue
Block a user