This commit is contained in:
Timothy Jaeryang Baek
2026-08-30 12:22:32 -04:00
parent 58a3fadbf3
commit 22379ded1a

View File

@@ -1219,7 +1219,11 @@
} else if (type === 'chat:active') {
if (!data?.active) {
taskIds = null;
if ($chatId && !$temporaryChatEnabled && hasPendingAssistantLeaf()) {
if (
$chatId &&
!$temporaryChatEnabled &&
hasPendingAssistantLeaf(event?.message_id ?? null)
) {
await loadChat();
}
if ($chatId && !$temporaryChatEnabled) {
@@ -1499,9 +1503,9 @@
} catch {}
};
const hasPendingAssistantLeaf = () =>
Object.values(history.messages).some(
(message) =>
const hasPendingAssistantLeaf = (messageId: string | null = null) =>
(messageId ? [history.messages[messageId]] : Object.values(history.messages)).some(
(message: any) =>
message?.role === 'assistant' && !message.done && (message.childrenIds?.length ?? 0) === 0
);