mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	fix: enable enableInjectSystemPrompts attribute for old sessions
				
					
				
			This commit is contained in:
		@@ -590,7 +590,7 @@ export const useChatStore = create<ChatStore>()(
 | 
				
			|||||||
    }),
 | 
					    }),
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name: StoreKey.Chat,
 | 
					      name: StoreKey.Chat,
 | 
				
			||||||
      version: 3,
 | 
					      version: 3.1,
 | 
				
			||||||
      migrate(persistedState, version) {
 | 
					      migrate(persistedState, version) {
 | 
				
			||||||
        const state = persistedState as any;
 | 
					        const state = persistedState as any;
 | 
				
			||||||
        const newState = JSON.parse(JSON.stringify(state)) as ChatStore;
 | 
					        const newState = JSON.parse(JSON.stringify(state)) as ChatStore;
 | 
				
			||||||
@@ -618,6 +618,18 @@ export const useChatStore = create<ChatStore>()(
 | 
				
			|||||||
          });
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Enable `enableInjectSystemPrompts` attribute for old sessions.
 | 
				
			||||||
 | 
					        // Resolve issue of old sessions not automatically enabling.
 | 
				
			||||||
 | 
					        if (version < 3.1) {
 | 
				
			||||||
 | 
					          newState.sessions.forEach((s) => {
 | 
				
			||||||
 | 
					            if (
 | 
				
			||||||
 | 
					              !s.mask.modelConfig.hasOwnProperty("enableInjectSystemPrompts")
 | 
				
			||||||
 | 
					            ) {
 | 
				
			||||||
 | 
					              s.mask.modelConfig.enableInjectSystemPrompts = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return newState;
 | 
					        return newState;
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user