AIAssistantManager

public class AIAssistantManager

Manager class for handling AI Assistant functionality This class manages AI assistant connections, message handling, and state management

Properties

Real-time Transcript Updates (Android compatibility)

Initializers

  • Initialize the AI Assistant Manager

    Declaration

    Swift

    public init()

Public Methods

  • Update the AI assistant connection state

    Declaration

    Swift

    public func updateConnectionState(
        connected: Bool,
        targetId: String?,
        targetType: String? = nil,
        targetVersionId: String? = nil
    )

    Parameters

    connected

    Whether the AI assistant is connected

    targetId

    The target ID of the AI assistant

    targetType

    The target type (optional)

    targetVersionId

    The target version ID (optional)

  • Process incoming message to detect AI conversation content

    Declaration

    Swift

    public func processIncomingMessage(_ message: [String : Any]) -> Bool

    Parameters

    message

    The 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

    transcription

    The transcription item to add

  • Update widget settings

    Declaration

    Swift

    public func updateWidgetSettings(_ settings: WidgetSettings)

    Parameters

    settings

    The 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()

Mixed-mode Communication (Android compatibility)

  • Send a text message to AI Assistant during active call (mixed-mode communication)

    Declaration

    Swift

    @discardableResult
    public func sendAIAssistantMessage(_ message: String) -> Bool

    Parameters

    message

    The 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") -> Bool

    Parameters

    message

    The text message to send

    base64Images

    Optional array of Base64 encoded image data (without data URL prefix)

    imageFormat

    Image 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) -> Bool

    Parameters

    transcription

    The 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) -> TranscriptCancellable

    Parameters

    handler

    Closure 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) -> TranscriptCancellable

    Parameters

    handler

    Closure to handle individual transcript item updates

    Return Value

    Cancellable token for the subscription

Transcript Filtering (Android compatibility)

  • Get transcriptions by role

    Declaration

    Swift

    public func getTranscriptionsByRole(_ role: String) -> [TranscriptionItem]

    Parameters

    role

    The 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

    role

    The role to clear transcriptions for

Extensions

  • 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 }