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