Skip to main content

smwebsdk.conversation

Home > @soulmachines/smwebsdk > Conversation

Conversation class

Stores content cards and conversation state

Signature:

export declare class Conversation 

Constructors

ConstructorModifiersDescription
(constructor)(logger, conversationState, contentCardFormatter)Constructs a new instance of the Conversation class

Properties

PropertyModifiersTypeDescription
activeCardIdsSet<string>
activeCardsreadonlyContentCardRawData[]
autoClearCardsbooleanAutomatically clear active content cards each conversation turn
cardDataMap<string, ContentCardRawData>
onCardChangedreadonlySmEventA callback function which fires when active cards are changed
onConversationStateUpdatedreadonlySmEventA callback function which fires when conversation state changes

Methods

MethodModifiersDescription
clearActiveCards()Clears active card ids. Emits a card changed event
onConversationResult(messageBody)Stores content card data contained in conversation result messages
onSpeechMarker(messageBody)Handles speech marker messages and updates the active card state
processRecognizeResultsMessage(message)
processStateMessage(message)
reset()Clears active card ids and data. Emits a card changed event