File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
apps/desktop/src/store/tinybase Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as _UI from "tinybase/ui-react/with-schemas" ;
2+
3+ import { type Schemas } from "@hypr/store" ;
4+
5+ import type { Store } from "../../store/main" ;
6+ import { createChatShortcutPersister } from "./persister" ;
7+
8+ const { useCreatePersister } = _UI as _UI . WithSchemas < Schemas > ;
9+
10+ export function useChatShortcutPersister ( store : Store ) {
11+ return useCreatePersister (
12+ store ,
13+ async ( store ) => {
14+ const persister = createChatShortcutPersister < Schemas > ( store as Store ) ;
15+ await persister . startAutoSave ( ) ;
16+ return persister ;
17+ } ,
18+ [ ] ,
19+ ) ;
20+ }
21+
Original file line number Diff line number Diff line change 1+ import type { MergeableStore , OptionalSchemas } from "tinybase/with-schemas" ;
2+
3+ import { createSingleTablePersister } from "../utils" ;
4+
5+ export function createChatShortcutPersister < Schemas extends OptionalSchemas > (
6+ store : MergeableStore < Schemas > ,
7+ ) {
8+ return createSingleTablePersister ( store , {
9+ tableName : "chat_shortcuts" ,
10+ filename : "chat_shortcuts.json" ,
11+ label : "ChatShortcutPersister" ,
12+ } ) ;
13+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { getCurrentWebviewWindowLabel } from "@hypr/plugin-windows";
55
66import { useCalendarPersister } from "../persister/calendar" ;
77import { useChatPersister } from "../persister/chat" ;
8+ import { useChatShortcutPersister } from "../persister/chat-shortcuts" ;
89import { useEventsPersister } from "../persister/events" ;
910import { useFolderPersister } from "../persister/folder" ;
1011import { useHumanPersister } from "../persister/human" ;
@@ -57,6 +58,8 @@ export function useMainPersisters(store: Store) {
5758
5859 const chatPersister = useChatPersister ( store ) ;
5960
61+ const chatShortcutPersister = useChatShortcutPersister ( store ) ;
62+
6063 const promptPersister = usePromptPersister ( store ) ;
6164
6265 const templatePersister = useTemplatePersister ( store ) ;
@@ -76,6 +79,7 @@ export function useMainPersisters(store: Store) {
7679 humanPersister,
7780 eventPersister,
7881 chatPersister,
82+ chatShortcutPersister,
7983 promptPersister,
8084 templatePersister,
8185 sessionPersister,
You can’t perform that action at this time.
0 commit comments