forked from open-webui/open-webui
		
	fix: cancel chat generation on route change
This commit is contained in:
		
							parent
							
								
									b8337db9d5
								
							
						
					
					
						commit
						981ec89e15
					
				
					 2 changed files with 11 additions and 1 deletions
				
			
		|  | @ -80,6 +80,11 @@ | ||||||
| 	////////////////////////// | 	////////////////////////// | ||||||
| 
 | 
 | ||||||
| 	const initNewChat = async () => { | 	const initNewChat = async () => { | ||||||
|  | 		if (currentRequestId !== null) { | ||||||
|  | 			await cancelChatCompletion(localStorage.token, currentRequestId); | ||||||
|  | 			currentRequestId = null; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		window.history.replaceState(history.state, '', `/`); | 		window.history.replaceState(history.state, '', `/`); | ||||||
| 
 | 
 | ||||||
| 		console.log('initNewChat'); | 		console.log('initNewChat'); | ||||||
|  |  | ||||||
|  | @ -705,7 +705,12 @@ | ||||||
| 	<Navbar | 	<Navbar | ||||||
| 		{title} | 		{title} | ||||||
| 		shareEnabled={messages.length > 0} | 		shareEnabled={messages.length > 0} | ||||||
| 		initNewChat={() => { | 		initNewChat={async () => { | ||||||
|  | 			if (currentRequestId !== null) { | ||||||
|  | 				await cancelChatCompletion(localStorage.token, currentRequestId); | ||||||
|  | 				currentRequestId = null; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			goto('/'); | 			goto('/'); | ||||||
| 		}} | 		}} | ||||||
| 	/> | 	/> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek