stopActiveStreams method

void stopActiveStreams()

Stops any active SSE streams so the UI no longer receives updates.

This is important for "exit" flows that collapse/hide the widget without destroying the controller (GetX controllers can outlive the view).

Implementation

void stopActiveStreams() {
  _cancelSseIdleTimer();
  _loadingToolsTimer?.cancel();
  _loadingToolsTimer = null;
  _loadingToolStartedAt.clear();
  expandedLoadingTools.clear();
  expandedLoadingTools.refresh();
  userToggledLoadingTools.clear();
  userToggledLoadingTools.refresh();
  messageSendStream?.cancel();
  messageSendStream = null;

  conversationSseSubscription?.cancel();
  conversationSseSubscription = null;

  // Stop any local "streaming" UI state immediately.
  isStreaming.value = false;
  assistantsReplying.value = 0;
  resetLoadingMessage();
  _currentMessageStartTime = null;
  _hasReceivedFirstToken = false;
  autoScrollEnabled = true;
  update();
}