This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-13 22:08:42 -06:00
1 parent d9014b3483
commit f7767d6be7
1 file changed
+11 -4
+11 -4
View File
@@ -3668,7 +3668,13 @@
}; };
const stopResponse = async (processQueue = true) => { const stopResponse = async (processQueue = true) => {
if (taskIds) { const responseMessage = history.currentId ? history.messages[history.currentId] : null;
const hasTaskIds = (taskIds?.length ?? 0) > 0;
const hasPendingAssistantResponse =
!!$chatId &&
(hasTaskIds || (responseMessage?.role === 'assistant' && responseMessage?.done !== true));
if (hasTaskIds || hasPendingAssistantResponse) {
if ($chatId) { if ($chatId) {
await stopTasksByChatId(localStorage.token, $chatId).catch((error) => { await stopTasksByChatId(localStorage.token, $chatId).catch((error) => {
toast.error(`${error}`); toast.error(`${error}`);
@@ -3685,15 +3691,16 @@
taskIds = null; taskIds = null;
const responseMessage = history.messages[history.currentId];
// Set all response messages to done // Set all response messages to done
if (responseMessage.parentId && history.messages[responseMessage.parentId]) { if (responseMessage?.parentId && history.messages[responseMessage.parentId]) {
for (const messageId of history.messages[responseMessage.parentId].childrenIds) { for (const messageId of history.messages[responseMessage.parentId].childrenIds) {
history.messages[messageId].done = true; history.messages[messageId].done = true;
} }
} }
history.messages[history.currentId] = responseMessage; if (responseMessage) {
history.messages[history.currentId] = responseMessage;
}
if (shouldAutoScrollResponse()) { if (shouldAutoScrollResponse()) {
scrollToBottom(); scrollToBottom();