mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2026-02-12 01:14:25 +08:00
大幅优化同步
This commit is contained in:
@@ -1167,6 +1167,7 @@ function _Chat() {
|
||||
|
||||
const onDelete = (msgId: string) => {
|
||||
deleteMessage(msgId);
|
||||
syncStore.upload();
|
||||
};
|
||||
|
||||
const onResend = (message: ChatMessage) => {
|
||||
|
||||
@@ -28,6 +28,7 @@ import { AuthPage } from "./auth";
|
||||
import { getClientConfig } from "../config/client";
|
||||
import { type ClientApi, getClientApi } from "../client/api";
|
||||
import { useAccessStore } from "../store";
|
||||
import { useSyncStore } from "../store/sync";
|
||||
import clsx from "clsx";
|
||||
|
||||
export function Loading(props: { noLogo?: boolean }) {
|
||||
@@ -239,6 +240,8 @@ export function Home() {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
useSyncStore.getState().download();
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<Router>
|
||||
|
||||
@@ -534,7 +534,22 @@ function SyncItems() {
|
||||
text={Locale.UI.Overwrite}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await syncStore.overwrite();
|
||||
await syncStore.upload();
|
||||
showToast(Locale.Settings.Sync.Success);
|
||||
} catch (e) {
|
||||
showToast(Locale.Settings.Sync.Fail);
|
||||
console.error("[Sync]", e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{couldSync && (
|
||||
<IconButton
|
||||
icon={<DownloadIcon />}
|
||||
text={Locale.UI.Overwrite}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await syncStore.download();
|
||||
showToast(Locale.Settings.Sync.Success);
|
||||
} catch (e) {
|
||||
showToast(Locale.Settings.Sync.Fail);
|
||||
@@ -1408,7 +1423,10 @@ export function Settings() {
|
||||
<IconButton
|
||||
aria={Locale.UI.Close}
|
||||
icon={<CloseIcon />}
|
||||
onClick={() => navigate(Path.Home)}
|
||||
onClick={() => {
|
||||
navigate(Path.Home);
|
||||
useSyncStore.getState().sync();
|
||||
}}
|
||||
bordered
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user