⚡️ terminate request when user cancels

This commit is contained in:
Nate Sesti 2024-02-02 19:29:30 -08:00
parent ab27186bf8
commit 37f604f2db

View file

@ -536,6 +536,7 @@ export function getSidebarContent(
while (!next.done) {
if (abortedMessageIds.has(data.messageId)) {
abortedMessageIds.delete(data.messageId);
next = await gen.return({ completion: "", prompt: "" });
break;
}
respond({ content: next.value });
@ -555,6 +556,7 @@ export function getSidebarContent(
while (!next.done) {
if (abortedMessageIds.has(data.messageId)) {
abortedMessageIds.delete(data.messageId);
next = await gen.return({ completion: "", prompt: "" });
break;
}
respond({ content: next.value.content });