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 () => {
|
||||
if (currentRequestId !== null) {
|
||||
await cancelChatCompletion(localStorage.token, currentRequestId);
|
||||
currentRequestId = null;
|
||||
}
|
||||
|
||||
window.history.replaceState(history.state, '', `/`);
|
||||
|
||||
console.log('initNewChat');
|
||||
|
|
|
@ -705,7 +705,12 @@
|
|||
<Navbar
|
||||
{title}
|
||||
shareEnabled={messages.length > 0}
|
||||
initNewChat={() => {
|
||||
initNewChat={async () => {
|
||||
if (currentRequestId !== null) {
|
||||
await cancelChatCompletion(localStorage.token, currentRequestId);
|
||||
currentRequestId = null;
|
||||
}
|
||||
|
||||
goto('/');
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue