Clear stale chat stream indicators
This commit is contained in:
parent
c0a68acfc8
commit
4143bfaa2a
2 changed files with 23 additions and 3 deletions
|
|
@ -4141,7 +4141,10 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
|||
if (!sessionId) return;
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/research/status/${sessionId}`);
|
||||
if (!res.ok) return; // 404 = no research for this session
|
||||
if (!res.ok) {
|
||||
if (sessionModule && sessionModule.clearResearching) sessionModule.clearResearching(sessionId);
|
||||
return; // 404 = no research for this session
|
||||
}
|
||||
const data = await res.json();
|
||||
|
||||
if (data.status === 'done') {
|
||||
|
|
|
|||
|
|
@ -2433,6 +2433,17 @@ export function clearStreaming(sessionId) {
|
|||
_updateRailNotifs();
|
||||
}
|
||||
|
||||
function _clearRunningState(sessionId) {
|
||||
if (!sessionId) return;
|
||||
var changed = false;
|
||||
if (_researchingSessions.delete(sessionId)) changed = true;
|
||||
if (_streamingSessions.delete(sessionId)) changed = true;
|
||||
if (changed) {
|
||||
_updateResearchDots();
|
||||
_updateRailNotifs();
|
||||
}
|
||||
}
|
||||
|
||||
export function markStreamComplete(sessionId) {
|
||||
_researchingSessions.delete(sessionId);
|
||||
_streamingSessions.delete(sessionId);
|
||||
|
|
@ -2503,9 +2514,15 @@ async function _checkServerStream(sessionId) {
|
|||
if (window.chatModule && window.chatModule.hasActiveStream && window.chatModule.hasActiveStream(sessionId)) return;
|
||||
|
||||
const res = await fetch(`${API_BASE}/api/chat/stream_status/${sessionId}`);
|
||||
if (!res.ok) return; // 404 = no active stream
|
||||
if (!res.ok) {
|
||||
_clearRunningState(sessionId);
|
||||
return; // 404 = no active stream
|
||||
}
|
||||
const info = await res.json();
|
||||
if (info.status !== 'streaming') return;
|
||||
if (info.status !== 'streaming') {
|
||||
_clearRunningState(sessionId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if this is a research stream — research has its own progress UI
|
||||
if (info.mode === 'research' || info.is_research) return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue