| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { createPersistStore } from "../utils/store";
- const state = {
- documents: [] as {
- id: string,
- name: string,
- url: string,
- }[],
- isChatActive: true,
- showMenu: false,
- selectedAppId: "",
- currentSession: {
- appId: '',
- dialogName: '',
- id: '',
- messages: [],
- },
- };
- export const useGlobalStore = createPersistStore(
- { ...state },
- (set, get) => ({
- setDocuments(list: {
- id: string,
- name: string,
- url: string,
- }[]) {
- set({ documents: list });
- },
- setIsChatActive(status: boolean) {
- set({ isChatActive: status });
- },
- setShowMenu(status: boolean) {
- set({ showMenu: status });
- },
- setSelectedAppId(appId: string) {
- set({ selectedAppId: appId });
- },
- setCurrentSession(session: any) {
- set({ currentSession: session });
- },
- }),
- {
- name: "Global",
- version: 1,
- },
- );
|