fix: title update and followups

This commit is contained in:
cogwheel0
2025-09-25 18:39:59 +05:30
parent bfa5ff6363
commit 69e7238d54

View File

@@ -434,9 +434,6 @@ StreamSubscription<String> attachUnifiedChunkedStreaming({
}
}
if (payload['done'] == true) {
try {
socketService?.offChatEvents();
} catch (_) {}
try {
// ignore: unawaited_futures
api?.sendChatCompleted(
@@ -894,13 +891,7 @@ StreamSubscription<String> attachUnifiedChunkedStreaming({
// Unregister from persistent service
persistentService.unregisterStream(streamId);
// Stop socket events now that streaming finished only for SSE-driven streams
if (socketService != null && suppressSocketContent == true) {
try {
socketService.offChatEvents();
} catch (_) {}
}
// Allow socket content again for future sessions
// Allow socket-delivered follow-ups/title updates after SSE completes
suppressSocketContent = false;
// If SSE-driven (no dynamic channel/background flow), finish now
@@ -913,12 +904,8 @@ StreamSubscription<String> attachUnifiedChunkedStreaming({
try {
persistentService.unregisterStream(streamId);
} catch (_) {}
suppressSocketContent = false;
finishStreaming();
if (socketService != null && suppressSocketContent == true) {
try {
socketService.offChatEvents();
} catch (_) {}
}
socketWatchdog?.stop();
},
);