mirror of
https://git.mirrors.martin98.com/https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-08-06 08:26:03 +08:00
fix: prevent message sync between forked sessions by generating unique IDs
This commit is contained in:
parent
0af04e0f2f
commit
840c151ab9
@ -214,7 +214,11 @@ export const useChatStore = createPersistStore(
|
|||||||
const newSession = createEmptySession();
|
const newSession = createEmptySession();
|
||||||
|
|
||||||
newSession.topic = currentSession.topic;
|
newSession.topic = currentSession.topic;
|
||||||
newSession.messages = [...currentSession.messages];
|
// 深拷贝消息
|
||||||
|
newSession.messages = currentSession.messages.map(msg => ({
|
||||||
|
...msg,
|
||||||
|
id: nanoid(), // 生成新的消息 ID
|
||||||
|
}));
|
||||||
newSession.mask = {
|
newSession.mask = {
|
||||||
...currentSession.mask,
|
...currentSession.mask,
|
||||||
modelConfig: {
|
modelConfig: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user