mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	Feat [Terminal] [Chats] enhance local storage
- [+] feat(chat.tsx): enhance local storage handling for chat input
This commit is contained in:
		@@ -1052,8 +1052,12 @@ function _Chat() {
 | 
			
		||||
      // Save the current input to local storage only if it is not a command.
 | 
			
		||||
      // Use the captured value from the input reference.
 | 
			
		||||
      const currentInputValue = currentInputRef?.value ?? "";
 | 
			
		||||
      if (!currentInputValue.startsWith(ChatCommandPrefix)) {
 | 
			
		||||
      // Save the input to local storage only if it's not empty and not a command.
 | 
			
		||||
      if (currentInputValue && !currentInputValue.startsWith(ChatCommandPrefix)) {
 | 
			
		||||
        localStorage.setItem(key, currentInputValue);
 | 
			
		||||
      } else {
 | 
			
		||||
        // If there's no value, ensure we don't create an empty key in local storage.
 | 
			
		||||
        localStorage.removeItem(key);
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
    // The effect should depend on the session ID to ensure it runs when the session changes.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user