AIAssistantManager
public class AIAssistantManager
Manager class for handling AI Assistant functionality This class manages AI assistant connections, message handling, and state management
-
Delegate to receive AI assistant events
Declaration
Swift
public weak var delegate: AIAssistantManagerDelegate?
-
Custom publisher for real-time transcript updates (iOS 12.0 compatible)
Declaration
Swift
public private(set) var transcriptUpdatePublisher: TranscriptPublisher<[TranscriptionItem]> { get } -
Custom publisher for individual transcript item updates
Declaration
Swift
public private(set) var transcriptItemPublisher: TranscriptPublisher<TranscriptionItem> { get }
-
Initialize the AI Assistant Manager
Declaration
Swift
public init()
-
Update the AI assistant connection state
Declaration
Swift
public func updateConnectionState( connected: Bool, targetId: String?, targetType: String? = nil, targetVersionId: String? = nil )Parameters
connectedWhether the AI assistant is connected
targetIdThe target ID of the AI assistant
targetTypeThe target type (optional)
targetVersionIdThe target version ID (optional)
-
Process incoming message to detect AI conversation content
Declaration
Swift
public func processIncomingMessage(_ message: [String : Any]) -> BoolParameters
messageThe incoming message to process
Return Value
True if the message was an AI conversation message, false otherwise
-
Get current AI assistant connection information
Declaration
Swift
public func getConnectionInfo() -> [String : Any]Return Value
Dictionary containing connection information
-
Reset the AI assistant manager state
Declaration
Swift
public func reset() -
Get current transcriptions
Declaration
Swift
public func getTranscriptions() -> [TranscriptionItem]Return Value
Array of transcription items
-
Get current transcriptions (Android compatibility method)
Declaration
Swift
public var transcript: [TranscriptionItem] { get }Return Value
Array of transcription items
-
Get current widget settings
Declaration
Swift
public func getWidgetSettings() -> WidgetSettings?Return Value
Current widget settings or nil if not set
-
Add a transcription item
Declaration
Swift
public func addTranscription(_ transcription: TranscriptionItem)Parameters
transcriptionThe transcription item to add
-
Update widget settings
Declaration
Swift
public func updateWidgetSettings(_ settings: WidgetSettings)Parameters
settingsThe new widget settings
-
Clear all transcriptions and widget settings
Declaration
Swift
public func clearAllData() -
Clear only transcriptions (called when call ends)
Declaration
Swift
public func clearTranscriptions()
-
Send a text message to AI Assistant during active call (mixed-mode communication)
Declaration
Swift
@discardableResult public func sendAIAssistantMessage(_ message: String) -> BoolParameters
messageThe text message to send
Return Value
True if message was sent successfully, false otherwise
-
Send a text message with multiple Base64 encoded images to AI Assistant during active call
Declaration
Swift
@discardableResult public func sendAIAssistantMessage(_ message: String, base64Images: [String]?, imageFormat: String = "jpeg") -> BoolParameters
messageThe text message to send
base64ImagesOptional array of Base64 encoded image data (without data URL prefix)
imageFormatImage format (jpeg, png, etc.). Defaults to “jpeg”
Return Value
True if message was sent successfully, false otherwise
-
Send a voice message transcription to AI Assistant
Declaration
Swift
@discardableResult public func sendVoiceTranscription(_ transcription: TranscriptionItem) -> BoolParameters
transcriptionThe voice transcription to send
Return Value
True if message was sent successfully, false otherwise
-
Subscribe to real-time transcript updates (Android compatibility)
Declaration
Swift
public func subscribeToTranscriptUpdates(_ handler: @escaping ([TranscriptionItem]) -> Void) -> TranscriptCancellableParameters
handlerClosure to handle transcript updates
Return Value
Cancellable token for the subscription
-
Subscribe to individual transcript item updates (Android compatibility)
Declaration
Swift
public func subscribeToTranscriptItemUpdates(_ handler: @escaping (TranscriptionItem) -> Void) -> TranscriptCancellableParameters
handlerClosure to handle individual transcript item updates
Return Value
Cancellable token for the subscription
-
Get transcriptions by role
Declaration
Swift
public func getTranscriptionsByRole(_ role: String) -> [TranscriptionItem]Parameters
roleThe role to filter by (“user” or “assistant”)
Return Value
Array of transcription items for the specified role
-
Get user transcriptions only
Declaration
Swift
public func getUserTranscriptions() -> [TranscriptionItem]Return Value
Array of user transcription items
-
Get assistant transcriptions only
Declaration
Swift
public func getAssistantTranscriptions() -> [TranscriptionItem]Return Value
Array of assistant transcription items
-
Get partial transcriptions (in-progress recordings)
Declaration
Swift
public func getPartialTranscriptions() -> [TranscriptionItem]Return Value
Array of partial transcription items
-
Get final transcriptions (completed recordings)
Declaration
Swift
public func getFinalTranscriptions() -> [TranscriptionItem]Return Value
Array of final transcription items
-
Clear transcriptions by role
Declaration
Swift
public func clearTranscriptionsByRole(_ role: String)Parameters
roleThe role to clear transcriptions for
-
Convenience method to check if currently connected to an AI assistant
Declaration
Swift
public var isAIAssistantConnected: Bool { get } -
Get the current AI assistant target ID
Declaration
Swift
public var connectedTargetId: String? { get }