forked from XiaoMo/ChatGPT-Next-Web
Merge pull request #2797 from Yidadaa/backup
This commit is contained in:
commit
6f8f490fdd
@ -22,6 +22,7 @@ import {
|
||||
Popover,
|
||||
Select,
|
||||
showConfirm,
|
||||
showToast,
|
||||
} from "./ui-lib";
|
||||
import { ModelConfigList } from "./model-config";
|
||||
|
||||
@ -275,7 +276,7 @@ function SyncItems() {
|
||||
icon={<ResetIcon />}
|
||||
text={Locale.UI.Sync}
|
||||
onClick={() => {
|
||||
syncStore.check().then(console.log);
|
||||
showToast(Locale.WIP);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { LLMModel } from "../client/api";
|
||||
import { getClientConfig } from "../config/client";
|
||||
import { DEFAULT_INPUT_TEMPLATE, DEFAULT_MODELS, StoreKey } from "../constant";
|
||||
|
@ -43,8 +43,6 @@ export const useMaskStore = createPersistStore(
|
||||
{ ...DEFAULT_MASK_STATE },
|
||||
|
||||
(set, get) => ({
|
||||
...DEFAULT_MASK_STATE,
|
||||
|
||||
create(mask?: Partial<Mask>) {
|
||||
const masks = get().masks;
|
||||
const id = nanoid();
|
||||
|
@ -17,17 +17,6 @@ export interface WebDavConfig {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface SyncStore {
|
||||
webDavConfig: WebDavConfig;
|
||||
lastSyncTime: number;
|
||||
|
||||
update: Updater<WebDavConfig>;
|
||||
check: () => Promise<boolean>;
|
||||
|
||||
path: (path: string) => string;
|
||||
headers: () => { Authorization: string };
|
||||
}
|
||||
|
||||
export const useSyncStore = createPersistStore(
|
||||
{
|
||||
webDavConfig: {
|
||||
@ -39,18 +28,11 @@ export const useSyncStore = createPersistStore(
|
||||
lastSyncTime: 0,
|
||||
},
|
||||
(set, get) => ({
|
||||
webDavConfig: {
|
||||
server: "",
|
||||
username: "",
|
||||
password: "",
|
||||
},
|
||||
|
||||
lastSyncTime: 0,
|
||||
|
||||
export() {
|
||||
const state = getLocalAppState();
|
||||
const fileName = `Backup-${new Date().toLocaleString()}.json`;
|
||||
downloadAs(JSON.stringify(state), fileName);
|
||||
set({ lastSyncTime: Date.now() });
|
||||
},
|
||||
|
||||
async import() {
|
||||
|
Loading…
Reference in New Issue
Block a user