You need to sign in or sign up before continuing.
Commit 981ec89e authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: cancel chat generation on route change

parent b8337db9
...@@ -80,6 +80,11 @@ ...@@ -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 @@ ...@@ -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('/');
}} }}
/> />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment