isLoadingMessageActive method
bool
isLoadingMessageActive(
)
Implementation
bool isLoadingMessageActive() =>
// Normal streaming / tool-use / thinking loading states
(isStreaming.value &&
(messages.firstOrNull?.status == MessageStatus.sent ||
messages.firstOrNull?.answer.trim() == "" ||
// With a tool use bubble as the newest message while streaming:
// - If tools are still pending, show the tool loading UI (from
// [loadingMessage]).
// - When [activeToolLoadings] is empty, [syncLoadingMessageFromActiveTools]
// resets to dots; keep the placeholder visible so default dots
// show while waiting for the assistant's next tokens — but do
// not show when [loadingType] is still toolUse with an empty map
// (that was the one-frame overlap with the bubble).
// Reading both [activeToolLoadings] and [loadingMessage] here keeps
// the Obx wired to both reactives.
(messages.firstOrNull?.toolUseMessage != null &&
(activeToolLoadings.isNotEmpty ||
loadingMessage.value.loadingType !=
LoadingType.toolUse)) ||
(messages.firstOrNull?.uiToolMessage != null &&
hiddenUiToolMessages.contains(
messages.firstOrNull?.uiToolMessage?.id,
)) ||
lastMessageHasOnlyThinkingContent())) ||
// Loading a conversation history
(isLoadingConversation.value && messages.isEmpty) ||
// Waiting for assistant welcome message when there is no conversation yet.
_isWaitingForWelcomeMessage();