This starter kit flow demonstrates how to use the Watson Speech to Text service, Watson Assistant and Text to Speech service all together. This allows you to speak and receive an audio output from the chat bot, as well as type your response.
You will need to create:
- Watson Speech to Text service
- Watson Assistant service
- Watson Text to Speech service
HTTP input
- sets the webpage URL to /assistJavaScript Template
- stores the JavaScript for the webpageHTML Template
- stores the HTML for the webpageHTTP response
- ends HTTP request
STT In
- sets the websocket listener on /assist for speaking to the serviceSet Input Type
- sets the global input type towebsocket
Speech to Text
- Watson Speech to Text service, using English and BroadbandModel in streaming modeCheck for Transcription
- This waits until the system has final transcription to send the message into Watson Assistant
HTTP input
- sets the webpage post URL to /assistant for sending typed responses to Watson AssistantSet Input Type
- sets the global input tohttp
Pre-Service Processing
- sets the typed message to msg.payload to display in the chat window.
Assistant
- Watson Assistant Service. Input your own workspace ID.Check for input type
- Checks whether the input came from the websocket or http. If it came from the websocket, continue to the first output. If it came from http, follow both outputs.
This section is for both types of input (spoken and typed) so that the response from Watson Assistant speaks back to you.
Set msg.payload
- Sets the output from Watson Assistant to msg.payload for it to successful be passed into Text to SpeechText to Speech
- Watson Text to Speech service. Set language, voice and format.
This section is for HTTP (typed responses) only. As it sets the bot response to display in the chat window.
Post Service Processing
- builds the response, incorporating the conversation context and bot responseHTTP Response
- closes the HTTP flow
STT Out
- closes websocket flow