IConversationManager
ug-js-sdk / IConversationManager
Interface: IConversationManager
Defined in: conversation-manager/types.ts:167
Interface for the ConversationManager class.
Methods are categorized by their connection requirements:
Methods that DO NOT require an active WebSocket connection:
generateImage()- Uses REST API directly (generic, supports both providers)generateImageWithBria()- Uses REST API directly (Bria-specific)generateImageWithReplicate()- Uses REST API directly (Replicate-specific)getAvailableModels()- Uses REST API directlyisConnected()- Check connection statusdispose()- Cleanup resources
Methods that REQUIRE an active WebSocket connection (call initialize() first):
initialize()- Establishes the connectionstartListening()- Start voice inputstopListening()- Stop voice inputinteract()- Send interactionssendText()- Send text messagesinterrupt()- Interrupt AI responsepause()- Pause playbackresume()- Resume playbackforceInputComplete()- Force end of user inputstop()- Stop and disconnecttoggleTextOnlyInput()- Toggle input mode
Methods
prepareConversation()
prepareConversation():
Promise<boolean>
Defined in: conversation-manager/types.ts:174
Prepares the conversation by establishing the WebSocket connection and sending configuration in advance. Reduces latency when initialize() is called. Does NOT require a user gesture - can be called on page load.
Returns
Promise<boolean>
True if connection was established successfully, false otherwise
initialize()
initialize():
Promise<void>
Defined in: conversation-manager/types.ts:181
Initializes the conversation manager and establishes WebSocket connection. Must be called before using conversation features.
Returns
Promise<void>
Remarks
Requires network connection to be established
startListening()
startListening():
Promise<void>
Defined in: conversation-manager/types.ts:187
Starts listening for voice input from the microphone.
Returns
Promise<void>
Remarks
Requires active WebSocket connection
stopListening()
stopListening():
Promise<void>
Defined in: conversation-manager/types.ts:193
Stops listening for voice input.
Returns
Promise<void>
Remarks
Requires active WebSocket connection
interact()
interact(
request):Promise<void>
Defined in: conversation-manager/types.ts:199
Sends an interaction request to the conversation.
Parameters
request
Returns
Promise<void>
Remarks
Requires active WebSocket connection
sendText()
sendText(
text):Promise<void>
Defined in: conversation-manager/types.ts:205
Sends a text message to the conversation.
Parameters
text
string
Returns
Promise<void>
Remarks
Requires active WebSocket connection
generateImage()
generateImage(
params):Promise<any>
Defined in: conversation-manager/types.ts:211
Generates an image using REST API (generic method supporting both providers). Does NOT require an active WebSocket connection.
Parameters
params
Returns
Promise<any>
generateImageWithBria()
generateImageWithBria(
params):Promise<any>
Defined in: conversation-manager/types.ts:217
Generates an image using Bria via REST API. Does NOT require an active WebSocket connection.
Parameters
params
Returns
Promise<any>
generateImageWithReplicate()
generateImageWithReplicate(
params):Promise<any>
Defined in: conversation-manager/types.ts:223
Generates an image using Replicate via REST API. Does NOT require an active WebSocket connection.
Parameters
params
Returns
Promise<any>
getAvailableModels()
getAvailableModels():
Promise<any>
Defined in: conversation-manager/types.ts:229
Retrieves available image generation models via REST API. Does NOT require an active WebSocket connection.
Returns
Promise<any>
interrupt()
interrupt():
Promise<void>
Defined in: conversation-manager/types.ts:235
Interrupts the current AI response playback.
Returns
Promise<void>
Remarks
Requires active WebSocket connection
pause()
pause():
Promise<void>
Defined in: conversation-manager/types.ts:241
Pauses the current AI response playback.
Returns
Promise<void>
Remarks
Requires active WebSocket connection and 'playing' state
resume()
resume():
Promise<void>
Defined in: conversation-manager/types.ts:247
Resumes paused AI response playback.
Returns
Promise<void>
Remarks
Requires active WebSocket connection and 'paused' state
forceInputComplete()
forceInputComplete():
Promise<void>
Defined in: conversation-manager/types.ts:253
Forces completion of user input, bypassing VAD silence detection.
Returns
Promise<void>
Remarks
Requires active WebSocket connection
stop()
stop():
Promise<void>
Defined in: conversation-manager/types.ts:259
Stops the conversation and disconnects from the server.
Returns
Promise<void>
Remarks
Requires active WebSocket connection
dispose()
dispose():
Promise<void>
Defined in: conversation-manager/types.ts:265
Disposes of all resources and performs complete cleanup. Does NOT require an active connection - safe to call anytime.
Returns
Promise<void>
toggleTextOnlyInput()
toggleTextOnlyInput(
isTextOnly):Promise<void>
Defined in: conversation-manager/types.ts:271
Toggles between text-only and audio input modes.
Parameters
isTextOnly
boolean
Returns
Promise<void>
Remarks
Requires active WebSocket connection for full functionality
isConnected()
isConnected():
boolean
Defined in: conversation-manager/types.ts:277
Checks if the WebSocket connection is currently active and ready. Does NOT require initialization - can be called anytime.
Returns
boolean
on()
on(
event,listener):void
Defined in: conversation-manager/types.ts:282
Subscribes to an event emitted by the conversation manager.
Parameters
event
string
listener
(...args) => void
Returns
void