forked from open-webui/open-webui
		
	only cancel chat completion if the deleted message is the most recently sent
This commit is contained in:
		
							parent
							
								
									95b8edf6b3
								
							
						
					
					
						commit
						a655ccdd06
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -227,9 +227,13 @@
 | 
			
		|||
		history.messages[messageId].deleted = true;
 | 
			
		||||
		history.messages[history.messages[messageId].childrenIds[0]].deleted = true;
 | 
			
		||||
 | 
			
		||||
		const responseId = history.messages[messageId].childrenIds[0];
 | 
			
		||||
		if (history.messages[responseId].childrenIds.length === 0) {
 | 
			
		||||
			await cancelChatCompletion(localStorage.token, chatId);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		await updateChatById(localStorage.token, chatId, { history });
 | 
			
		||||
		await chats.set(await getChatList(localStorage.token));
 | 
			
		||||
		await cancelChatCompletion(localStorage.token, chatId);
 | 
			
		||||
	};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue