Builder

data class Builder(orientation: TrayConfig.Orientation, haptic: Boolean, sayGreeting: Boolean, greeting: String, ttsMode: SynthesisRequest.Mode, voice: String, clientId: String?, clientSecret: String?, properties: HashMap<String, Any>, logLevel: Int, wakewordModelURL: String?, nluURL: String?, rasaOssURL: String?, refreshModels: Boolean, editTranscript: (String) -> String?, listener: SpokestackTrayListener?, transcriptEditor: TranscriptEditor?)

A fluent builder interface for creating a tray configuration.

Constructors

Builder
Link copied to clipboard
fun Builder(orientation: TrayConfig.Orientation = Orientation.LEFT, haptic: Boolean = true, sayGreeting: Boolean = true, greeting: String = "", ttsMode: SynthesisRequest.Mode = Mode.TEXT, voice: String = "demo-male", clientId: String? = null, clientSecret: String? = null, properties: HashMap<String, Any> = HashMap(), logLevel: Int = EventTracer.Level.NONE.value(), wakewordModelURL: String? = null, nluURL: String? = null, rasaOssURL: String? = null, refreshModels: Boolean = false, editTranscript: (String) -> String? = null, listener: SpokestackTrayListener? = null, transcriptEditor: TranscriptEditor? = null)

Functions

build
Link copied to clipboard
fun build(): TrayConfig
Create a finalized Spokestack Tray configuration from the current state of this builder.
credentials
Link copied to clipboard
fun credentials(clientId: String, clientSecret: String): TrayConfig.Builder
Set the Spokestack credentials to be used by the tray.
greeting
Link copied to clipboard
fun greeting(value: String): TrayConfig.Builder
Set the message displayed and/or read to the user when the tray opens for the first time.
haptic
Link copied to clipboard
fun haptic(value: Boolean): TrayConfig.Builder
Set whether haptic feedback should be sent when the tray opens.
logLevel
Link copied to clipboard
fun logLevel(value: Int): TrayConfig.Builder
Set the level at which a registered SpokestackTrayListener will receive log events.
nluURL
Link copied to clipboard
fun nluURL(value: String?): TrayConfig.Builder
Set the URL to the directory containing NLU files.
orientation
Link copied to clipboard
fun orientation(value: TrayConfig.Orientation): TrayConfig.Builder
Set the tray's orientation, which determines the mic button's initial position and the opening direction of the tray.
rasaOssURL
Link copied to clipboard
fun rasaOssURL(value: String?): TrayConfig.Builder
Set the URL to a Rasa Open Source server.
refreshModels
Link copied to clipboard
fun refreshModels(value: Boolean): TrayConfig.Builder
Set whether wakeword and NLU models should be unconditionally redownloaded on launch.
sayGreeting
Link copied to clipboard
fun sayGreeting(value: Boolean): TrayConfig.Builder
Set whether the greeting message, if one exists, should be synthesized and read to the user as well as displayed.
ttsMode
Link copied to clipboard
fun ttsMode(value: SynthesisRequest.Mode): TrayConfig.Builder
Set the synthesis mode to use for TTS requests.
ttsVoice
Link copied to clipboard
fun ttsVoice(value: String): TrayConfig.Builder
Set the voice to use for TTS synthesis.
wakewordModelURL
Link copied to clipboard
fun wakewordModelURL(value: String?): TrayConfig.Builder
Set the URL to the directory containing wakeword model files.
withListener
Link copied to clipboard
fun withListener(listener: SpokestackTrayListener): TrayConfig.Builder
Register a listener to receive events from both Spokestack and the tray.
withProperty
Link copied to clipboard
fun withProperty(key: String, value: Any): TrayConfig.Builder
Add a property to the underlying Spokestack configuration.
withSpokestackBuilder
Link copied to clipboard
fun withSpokestackBuilder(value: Spokestack.Builder): TrayConfig.Builder
Use a custom Spokestack builder for this configuration.
withTranscriptEditor
Link copied to clipboard
fun withTranscriptEditor(editor: TranscriptEditor): TrayConfig.Builder
Register a transcript editor to be applied to ASR results before they are sent to the NLU for classification.

Properties

spokestackBuilder
Link copied to clipboard
var spokestackBuilder: Spokestack.Builder