mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 22:13:47 +08:00
feat: The cloud synchronization feature is enhanced to support the synchronization of deleted conversations and deleted messages
This commit is contained in:
@@ -62,6 +62,7 @@ import {
|
||||
getMessageImages,
|
||||
isVisionModel,
|
||||
isDalle3,
|
||||
removeOutdatedEntries,
|
||||
} from "../utils";
|
||||
|
||||
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
||||
@@ -959,10 +960,20 @@ function _Chat() {
|
||||
};
|
||||
|
||||
const deleteMessage = (msgId?: string) => {
|
||||
chatStore.updateCurrentSession(
|
||||
(session) =>
|
||||
(session.messages = session.messages.filter((m) => m.id !== msgId)),
|
||||
);
|
||||
chatStore.updateCurrentSession((session) => {
|
||||
session.deletedMessageIds &&
|
||||
removeOutdatedEntries(session.deletedMessageIds);
|
||||
session.messages = session.messages.filter((m) => {
|
||||
if (m.id !== msgId) {
|
||||
return true;
|
||||
}
|
||||
if (!session.deletedMessageIds) {
|
||||
session.deletedMessageIds = {} as Record<string, number>;
|
||||
}
|
||||
session.deletedMessageIds[m.id] = Date.now();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const onDelete = (msgId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user