From 388f62f8a002b789887d016892a1bf152c9d90af Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 03:03:36 -0500 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 5729ea1b53..4e1838b4bf 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -555,6 +555,10 @@ } } else if (type === 'context_compaction') { handleContextCompactionStatus(data); + } else if (type === 'chat:active') { + if (!data?.active) { + taskIds = null; + } } else if (type === 'chat:completion') { chatCompletionEventHandler(data, message, event.chat_id); } else if (type === 'chat:tasks:cancel') { @@ -1614,7 +1618,6 @@ currentChatPage.set(1); await chats.set(await getChatList(localStorage.token, $currentChatPage)); } - taskIds = null; }; const chatActionHandler = async (_chatId, actionId, modelId, responseMessageId, event = null) => { @@ -2584,10 +2587,8 @@ } else { // Backend returns task_ids (multi-model) or task_id (single model) const newTaskIds = res.task_ids ?? (res.task_id ? [res.task_id] : []); - if (taskIds) { - taskIds.push(...newTaskIds); - } else { - taskIds = newTaskIds; + if (newTaskIds.length > 0) { + taskIds = [...(taskIds ?? []), ...newTaskIds]; } // Backend returns chat_id for new chats — set store + URL.