mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-08 11:56:59 +00:00
Clear stale chat stream indicators
This commit is contained in:
+4
-1
@@ -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') {
|
||||
|
||||
+19
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user