PupauChatController class

Inheritance
  • Object
  • GetLifeCycle
  • DisposableInterface
  • GetxController
  • PupauChatController
Implemented types

Constructors

PupauChatController({PupauConfig? config})

Properties

activeToolLoadings → RxMap<String, ToolUseType>
Active tool loadings keyed by tool name. This allows multiple tools (pending or running) to be shown simultaneously. Reactive so that isLoadingMessageActive and any Obx that reads it rebuilds automatically whenever a tool is added or removed.
final
assistant ↔ Rxn<Assistant>
getter/setter pair
assistantId String
no setter
assistants List<Assistant>
getter/setter pair
assistantsReplying ↔ RxInt
getter/setter pair
attachmentTrimmingOpenedMessageIds ↔ RxSet<String>
Message IDs for which the attachment trimming modal was opened at least once (persisted in prefs).
getter/setter pair
autoScrollEnabled bool
getter/setter pair
cachedToolUseImages Map<String, Uint8List>
getter/setter pair
chatScrollController ScrollController
getter/setter pair
conversation ↔ Rxn<PupauConversation>
getter/setter pair
conversationItemsLoaded int
getter/setter pair
conversationPage int
getter/setter pair
conversationSseSubscription StreamSubscription<SSEModel>?
getter/setter pair
conversationStarters ↔ RxList<String>
getter/setter pair
currentWebSearchType ↔ Rxn<WebSearchType>
getter/setter pair
effectiveWelcomeMessage String
Welcome message to show: from assistant once loaded, otherwise from pupauConfig.initialWelcomeMessage if provided (e.g. by host from list).
no setter
expandedLoadingTools → RxSet<String>
final
expandedToolUseMessages ↔ RxSet<String>
getter/setter pair
externalSearchVisible ↔ RxBool
getter/setter pair
filteredAssistants ↔ RxList<Assistant>
getter/setter pair
forkConversationTitle ↔ RxString
getter/setter pair
forkConversationTitleController TextEditingController
getter/setter pair
forkMessageId ↔ RxString
getter/setter pair
hasApiError ↔ RxBool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
no setterinherited
hiddenUiToolMessages ↔ RxSet<String>
getter/setter pair
hideAudioRecordingButton bool
no setter
hideInputBox ↔ RxBool
getter/setter pair
incomingMessages List<PupauMessage>
getter/setter pair
initialized bool
Checks whether the controller has already been initialized.
no setterinherited
inputMessage ↔ RxString
getter/setter pair
inputMessageController MyMentionTagTextEditingController
getter/setter pair
isActionBarAlwaysVisible ↔ RxBool
getter/setter pair
isAnonymous bool
no setter
isAtBottom ↔ RxBool
getter/setter pair
isAttachmentAvailable ↔ RxBool
getter/setter pair
isAtTop ↔ RxBool
getter/setter pair
isClosed bool
Checks whether the controller has already been closed.
no setterinherited
isConversationHistoryLoaded bool
getter/setter pair
isConversationLastPage bool
getter/setter pair
isForking ↔ RxBool
getter/setter pair
isLoadingAssistant ↔ RxBool
getter/setter pair
isLoadingConversation ↔ RxBool
getter/setter pair
isLoadingConversationPage bool
getter/setter pair
isLoadingTitle ↔ RxBool
getter/setter pair
isMarketplace bool
no setter
isMentionAvailable ↔ RxBool
getter/setter pair
isMessageInputFieldFocused ↔ RxBool
getter/setter pair
isRecording ↔ RxBool
getter/setter pair
isStreaming ↔ RxBool
getter/setter pair
isWebSearchActive ↔ RxBool
getter/setter pair
isWebSearchAvailable ↔ RxBool
getter/setter pair
kbReferencesBackup List<KbReference>
getter/setter pair
keyboardFocusNode FocusNode
final
listeners int
no setterinherited
listHeight double
getter/setter pair
loadingMessage ↔ Rx<LoadingMessage>
Global loading state (dots, text, web search, or tool-use). For tools, this can represent multiple concurrent tool loadings.
getter/setter pair
loadingToolsTick → RxInt
final
mentionValue ↔ RxString
getter/setter pair
messageInputFieldHeight ↔ RxDouble
getter/setter pair
messageNotifier MessageNotifier
getter/setter pair
messages ↔ RxList<PupauMessage>
getter/setter pair
messageSendStream StreamSubscription?
getter/setter pair
onDelete → InternalFinalCallback<void>
Internal callback that starts the cycle of this controller.
finalinherited
onStart → InternalFinalCallback<void>
Called at the exact moment the widget is allocated in memory. It uses an internal "callable" type, to avoid any @overrides in subclases. This method should be internal and is required to define the lifetime cycle of the subclass.
finalinherited
pupauConfig PupauConfig?
getter/setter pair
recordingDuration ↔ Rx<Duration>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeContext BuildContext?
no setter
scaffoldContext BuildContext?
no setter
selectedImage ↔ Rxn<ChatImage>
getter/setter pair
showConversationStarters bool
no setter
showNerdStats ↔ RxBool
getter/setter pair
taggedAssistants ↔ RxList<Assistant>
getter/setter pair
toolArgsPreviewContentsById → RxMap<String, String>
final
toolArgsPreviewTitlesById → RxMap<String, String>
final
toolArgsPreviewToolIdByName → RxMap<String, String>
final
toolPartialStatuses → RxMap<String, String>
Optional per-tool status label for tools that emit TOOL_PARTIAL_RESULT, e.g. document_create/document_update phases. Reactive so that the loading animation label updates live.
final
toolsFabExpanded ↔ RxBool
getter/setter pair
ttsService TtsService
getter/setter pair
userToggledLoadingTools → RxSet<String>
final
userToggledToolUseMessages ↔ RxList<String>
getter/setter pair
widgetMode WidgetMode
no setter

Methods

$configureLifeCycle() → void
inherited
addKbBackupToMessage(PupauMessage message) → void
addListener(GetStateUpdate listener) → Disposer
Register a closure to be called when the object notifies its listeners.
inherited
addListenerId(Object? key, GetStateUpdate listener) → Disposer
inherited
addMessage(PupauMessage message, {bool bypassCheck = false}) → void
addTaggedAssistants() → void
applyCachedAssistantIfAvailable() → void
Applies the assistant from PupauAssistantsController cache if present for the current pupauConfig assistantId. Synchronous, no network. Use so the UI shows the correct agent immediately when opening or switching chat, before getAssistant returns.
cancelRecording() Future<void>
canRetryAudioMessage(PupauMessage message) bool
clearEmptyMessages() → void
clearTaggedAssistants() → void
clearToolArgsPreviewCache() → void
closeDrawer() → void
Safely closes the drawer using scaffoldKey or context
closeEndDrawer() → void
Safely closes the end drawer using scaffoldKey or context
createNewConversation() Future<void>
dispose() → void
inherited
disposeId(Object id) → void
To dispose an id from future updates(), this ids are registered by GetBuilder() or similar, so is a way to unlink the state change with the Widget from the Controller.
inherited
forkConversation() Future<void>
getAssistant() Future<void>
getMessageInputFieldHeight(BuildContext? context) → void
getToolArgsPreviewContentByToolId(String toolId) String
getToolArgsPreviewTitleByToolId(String toolId) String
getToolLoadingSeconds(String toolName) int
handleAttachmentTrimmingEvent(Map<String, dynamic> data) → void
handleAudioInputTranscription(PupauMessage newSseMessage) → void
handleKbMessage(PupauMessage message) → void
handleLayerMessage(PupauMessage message) → void
handleToolArgsDeltaEvent(Map<String, dynamic> data) → void
handleToolEvaluationMessage() → void
TOOL_EVALUATION means all tools of the current stream have been resolved. Clear any remaining tool loadings.
handleToolHeartbeatEvent(Map<String, dynamic> data) → void
handleToolPartialResultEvent(Map<String, dynamic> data) → void
Handle TOOL_PARTIAL_RESULT events for tools that emit intermediate phases (currently document_create/document_update).
handleToolUseCompletionByMessage(PupauMessage message) → void
Remove a single tool from the active loading map based on message.toolName.
handleToolUseMessage(Map<String, dynamic> data) → void
handleToolUseStartPendingMessage(PupauMessage message, Map<String, dynamic> data) → void
handleUiToolMessage(Map<String, dynamic> data) → void
handleWebSearchQueryMessage(PupauMessage message) → void
hasToolArgsPreview(String toolName) bool
hasToolArgsPreviewByToolId(String toolId) bool
hideUiToolBubble(String messageId) → void
initChatController() Future<void>
initLanguage() → void
initScrollControllers() → void
isAdvanced() bool
isFirstMessageInGroup(String groupId) bool
isLoadingMessageActive() bool
isLoadingToolExpanded(String toolName, {ToolUseType? toolUseType}) bool
isToolUseExpanded(String messageId) bool
isUiToolBubbleHidden(String messageId) bool
lastMessageHasOnlyThinkingContent() bool
True when the last message contains thinking tags and either the tag is not yet closed or the visible text outside thinking is empty (so we keep showing the loading indicator).
loadConversation(String conversationId) Future<void>
loadConversationMessages({bool reset = false}) Future<void>
manageCancelAndErrorMessage() → void
manageChatAutoScroll({bool bypassHeightCheck = false}) → void
manageForceBack() → void
manageMessageContextMenu(int selectedOption, PupauMessage message) → void
manageNoVisionCapability() → void
manageSendSuccess(bool isExternalSearch) → void
manageSSEData(Map<String, dynamic> data, bool isExternalSearch) → void
markToolLoadingEnded(String toolName) → void
markToolLoadingStarted(String toolName) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyChildrens() → void
inherited
onClose() → void
Called before onDelete method. onClose might be used to dispose resources used by the controller. Like closing events, or streams before the controller is destroyed. Or dispose objects that can potentially create some memory leaks, like TextEditingControllers, AnimationControllers. Might be useful as well to persist some data on disk.
override
onInit() → void
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
override
onMention(String? value) → void
onMentionTap() → void
onReady() → void
Called 1 frame after onInit(). It is the perfect place to enter navigation events, like snackbar, dialogs, or a new route, or async request.
override
openChatWithConfig(PupauConfig? newConfig) Future<void>
Called when chat is opened (via PupauChatUtils or tapping avatar) Resets conversation state and updates config if assistant changed Re-initializes the chat every time it's called (even with same config)
openCustomActionsModal() → void
openDrawer() → void
Safely opens the drawer using scaffoldKey or context
openEndDrawer() → void
Safely opens the end drawer using scaffoldKey or context
openForkConversationModal(String messageId) → void
reactMessage(PupauMessage message, Reaction reaction) → void
refresh() → void
inherited
refreshGroup(Object id) → void
inherited
reloadCurrentAssistant() Future<void>
Reloads the current assistant from the API using pupauConfig. Use this when config (e.g. assistantId or API settings) has changed and the UI should reflect the latest assistant data without reopening the chat.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
removeListenerId(Object id, VoidCallback listener) → void
inherited
removeTaggedAssistant(Assistant assistant) → void
reportMessage(PupauMessage message) → void
resetChatState() → void
Resets all chat state when the chat is opened This ensures a fresh state each time the chat is opened
resetConversation() → void
resetConversationPagination() → void
resetLoadingMessage() → void
retryLastFailedAudioMessage() Future<void>
scrollToBottomChat({bool withAnimation = false}) → void
scrollToTopChat({bool withAnimation = false}) → void
selectImage(String value, ImageType type) → void
sendAudioMessage(File audioFile) Future<void>
sendCancel() → void
sendIsActive() bool
sendMessage(String query, bool isExternalSearch) Future<void>
sendToolAnswer(String messageId, List<AskUserChoice> selectedOptions, String? answer) Future<void>
sendUiToolApproval(String messageId) Future<void>
sendUiToolAuth(String messageId, String toolId) Future<void>
setAssistantSettings() Future<void>
setCollapseCallback(VoidCallback? callback) → void
setDefautMessageInputFieldHeight() → void
setExternalSearchButton(bool isVisible) → void
setForkConversationTitle(String title) → void
setLastEventId(SSEModel event) → void
setMessageInputFieldFocused(bool isFocused) → void
setModalContext(BuildContext context) → void
setNerdStats(bool value) → void
setOnFirstInitCompleteCallback(VoidCallback? callback) → void
setScaffoldContext(BuildContext context) → void
showAttachmentTrimmingModalForMessage(PupauMessage message) → void
Shows the attachment/emergency trimming modal for an assistant message and marks it as opened.
startRecording() Future<void>
stopActiveStreams() → void
Stops any active SSE streams so the UI no longer receives updates.
stopAndSendRecording() Future<void>
stopAutoScroll() → void
stopExecution() Future<bool>
Stops the server-side async run for the current conversation (if any).
stopIsActive() bool
syncLoadingMessageFromActiveTools() → void
Update loadingMessage from activeToolLoadings, supporting multiple concurrent tool loadings.
toggleLoadingToolExpanded(String toolName) → void
toggleToolsFab({bool? value}) → void
toggleToolUseExpanded(String messageId) → void
toggleWebSearch() → void
toString() String
A string representation of this object.
inherited
update([List<Object>? ids, bool condition = true]) → void
Rebuilds GetBuilder each time you call update(); Can take a List of ids, that will only update the matching GetBuilder( id: ), ids can be reused among GetBuilders like group tags. The update will only notify the Widgets, if condition is true.
inherited
updateConversationTitle(String title) Future<void>
updateSSEMessages(PupauMessage newSseMessage) PupauMessage

Operators

operator ==(Object other) bool
The equality operator.
inherited