fix: prevent message sync between forked sessions by generating unique IDs

This commit is contained in:
lvguanjun 2025-01-05 11:22:53 +08:00
parent 0af04e0f2f
commit 840c151ab9

View File

@ -214,7 +214,11 @@ export const useChatStore = createPersistStore(
const newSession = createEmptySession();
newSession.topic = currentSession.topic;
newSession.messages = [...currentSession.messages];
// 深拷贝消息
newSession.messages = currentSession.messages.map(msg => ({
...msg,
id: nanoid(), // 生成新的消息 ID
}));
newSession.mask = {
...currentSession.mask,
modelConfig: {