You may have experienced, you can stop Google home or Amazon Alexa during the ongoing task. The same feature is available for SUSI too. Now, SUSI can respond to ‘stop’ action and stop ongoing tasks (e.g. SUSI is narrating a story and if the user says STOP, it stops narrating the story). ‘stop’ action is introduced to enable the user to make SUSI stop anything it’s doing.
When you ask SUSI to stop, you get following actions object from server side:
Full JSON response can be found here.
When SUSI respond with ‘stop’ action, we create a new action type ‘stop’ and assign `Message` object `actionType` to ‘stop’.
Adding ‘stop’ to action type:
Assigning to the message object:
A new collectionView cell is created to respond user with “stoped” text.
Registering the stopCell:
Add cell to the chat screen:
AVFoundation’s AVSpeechSynthesizer API is used to stop the action:
This method immediately stops the speak action.
- About SUSI: https://chat.susi.ai/overview
- JSON response for ‘stop’ action: https://api.susi.ai/susi/chat.json?timezoneOffset=-330&q=susi+stop
- AVSpeechSynthesisVoice: https://developer.apple.com/documentation/avfoundation/avspeechsynthesisvoice
- AVFoundation: https://developer.apple.com/av-foundation/
- SUSI iOS Link: https://github.com/fossasia/susi_iOS
- SUSI Android Link: https://github.com/fossasia/susi_android
- SUSI Web Chat Link: https://chat.susi.ai/