Fix session wait state refresh
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const ASSET_VERSION = '20260622-queued-send';
|
const ASSET_VERSION = '20260622-streaming-restore';
|
||||||
const WS_URL = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws`;
|
const WS_URL = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws`;
|
||||||
const RENDER_DEBOUNCE = 100;
|
const RENDER_DEBOUNCE = 100;
|
||||||
const COMPOSER_SUGGESTION_DEBOUNCE = 120;
|
const COMPOSER_SUGGESTION_DEBOUNCE = 120;
|
||||||
@@ -3196,10 +3196,11 @@
|
|||||||
function currentSessionWaitState() {
|
function currentSessionWaitState() {
|
||||||
const meta = currentSessionId ? getSessionMeta(currentSessionId) : null;
|
const meta = currentSessionId ? getSessionMeta(currentSessionId) : null;
|
||||||
const cached = currentSessionId ? sessionCache.get(currentSessionId)?.snapshot : null;
|
const cached = currentSessionId ? sessionCache.get(currentSessionId)?.snapshot : null;
|
||||||
|
const source = meta || cached || {};
|
||||||
return {
|
return {
|
||||||
waitingOnChildren: !!(meta?.waitingOnChildren || cached?.waitingOnChildren),
|
waitingOnChildren: !!source.waitingOnChildren,
|
||||||
pendingReplyCount: Number(meta?.pendingReplyCount ?? cached?.pendingReplyCount ?? 0),
|
pendingReplyCount: Number(source.pendingReplyCount || 0),
|
||||||
readyReplyCount: Number(meta?.readyReplyCount ?? cached?.readyReplyCount ?? 0),
|
readyReplyCount: Number(source.readyReplyCount || 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3342,6 +3343,9 @@
|
|||||||
currentModel = snapshot.model || '';
|
currentModel = snapshot.model || '';
|
||||||
if (!preserveStreaming) {
|
if (!preserveStreaming) {
|
||||||
renderMessages(snapshot.messages || [], { immediate: !!options.immediate });
|
renderMessages(snapshot.messages || [], { immediate: !!options.immediate });
|
||||||
|
if (snapshot.isRunning && snapshot.sessionId === currentSessionId) {
|
||||||
|
startGenerating(snapshot.sessionId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
generatingSessionId = snapshot.sessionId;
|
generatingSessionId = snapshot.sessionId;
|
||||||
}
|
}
|
||||||
@@ -4122,16 +4126,30 @@
|
|||||||
|
|
||||||
case 'session_message':
|
case 'session_message':
|
||||||
if (msg.sessionId && msg.message) {
|
if (msg.sessionId && msg.message) {
|
||||||
|
const isCrossConversationReply = !!msg.message.crossConversation?.replyToRequestId;
|
||||||
updateCachedSession(msg.sessionId, (snapshot) => {
|
updateCachedSession(msg.sessionId, (snapshot) => {
|
||||||
snapshot.messages = Array.isArray(snapshot.messages) ? snapshot.messages : [];
|
snapshot.messages = Array.isArray(snapshot.messages) ? snapshot.messages : [];
|
||||||
snapshot.messages.push(deepClone(msg.message));
|
snapshot.messages.push(deepClone(msg.message));
|
||||||
snapshot.updated = msg.message.timestamp || new Date().toISOString();
|
snapshot.updated = msg.message.timestamp || new Date().toISOString();
|
||||||
if (msg.message.crossConversation?.replyToRequestId) {
|
if (isCrossConversationReply) {
|
||||||
snapshot.readyReplyCount = Math.max(0, Number(snapshot.readyReplyCount || 0) - 1);
|
snapshot.readyReplyCount = Math.max(0, Number(snapshot.readyReplyCount || 0) - 1);
|
||||||
snapshot.pendingReplyCount = Math.max(0, Number(snapshot.pendingReplyCount || 0) - 1);
|
snapshot.pendingReplyCount = Math.max(0, Number(snapshot.pendingReplyCount || 0) - 1);
|
||||||
snapshot.waitingOnChildren = Number(snapshot.pendingReplyCount || 0) > 0;
|
snapshot.waitingOnChildren = Number(snapshot.pendingReplyCount || 0) > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (isCrossConversationReply) {
|
||||||
|
sessions = sessions.map((session) => {
|
||||||
|
if (session.id !== msg.sessionId) return session;
|
||||||
|
const pendingReplyCount = Math.max(0, Number(session.pendingReplyCount || 0) - 1);
|
||||||
|
const readyReplyCount = Math.max(0, Number(session.readyReplyCount || 0) - 1);
|
||||||
|
return {
|
||||||
|
...session,
|
||||||
|
readyReplyCount,
|
||||||
|
pendingReplyCount,
|
||||||
|
waitingOnChildren: pendingReplyCount > 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (msg.sessionId === currentSessionId && msg.message) {
|
if (msg.sessionId === currentSessionId && msg.message) {
|
||||||
collectClosedCollabAgentIds([msg.message]).forEach((id) => closedCollabAgentIds.add(id));
|
collectClosedCollabAgentIds([msg.message]).forEach((id) => closedCollabAgentIds.add(id));
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
document.documentElement.dataset.dividerTime = dividerTime;
|
document.documentElement.dataset.dividerTime = dividerTime;
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="style.css?v=20260622-queued-send">
|
<link rel="stylesheet" href="style.css?v=20260622-streaming-restore">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -163,6 +163,6 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.1/marked.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.1/marked.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js"></script>
|
||||||
<script src="app.js?v=20260622-queued-send"></script>
|
<script src="app.js?v=20260622-streaming-restore"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user