From 3d31123467d02ebdb458bb3687174f79126b00a8 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 10 Oct 2026 22:11:51 +0400 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index d1c79718cf..84eff48897 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1810,7 +1810,13 @@ syncChatRoom($socket, $chatId, $temporaryChatEnabled); const id = $chatId; const tasks = await getTaskIdsByChatId(localStorage.token, id).catch(() => null); - if ($chatId === id && tasks) taskIds = tasks.task_ids?.length ? tasks.task_ids : null; + if ($chatId !== id || !tasks) return; + taskIds = tasks.task_ids?.length ? tasks.task_ids : null; + if (!taskIds && hasPendingAssistantLeaf()) { + // A server restart can leave unfinished messages without a completion event. + const loaded = await loadChat(); + if (loaded && $chatId === id) await processNextInQueue(id); + } }; onMount(() => {