Browse Source

feat: add indexDB

Dogtiti 1 năm trước cách đây
mục cha
commit
492b55c893
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      app/store/chat.ts

+ 3 - 1
app/store/chat.ts

@@ -27,6 +27,7 @@ import { createPersistStore } from "../utils/store";
 import { collectModelsWithDefaultModel } from "../utils/model";
 import { useAccessStore } from "./access";
 import { isDalle3 } from "../utils";
+import { clear } from "idb-keyval";
 
 export type ChatMessage = RequestMessage & {
   date: string;
@@ -665,7 +666,8 @@ export const useChatStore = createPersistStore(
         set(() => ({ sessions }));
       },
 
-      clearAllData() {
+      async clearAllData() {
+        await clear();
         localStorage.clear();
         location.reload();
       },