mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-20 12:40:16 +09:00
Merge pull request #6033 from lvguanjun/fix_fork_session
Some checks are pending
Run Tests / test (push) Waiting to run
Some checks are pending
Run Tests / test (push) Waiting to run
fix: prevent message sync between forked sessions by generating unique IDs
This commit is contained in:
commit
4ac27fdd4d
@ -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…
Reference in New Issue
Block a user