I have created a Web Chat bot using Microsoft QnA Maker service and Azure Web App bot hosted on Azure. I have enabled Web Chat and Direct Line channels on Azure for my bot. It works fine. Now I am trying to integrate Bing Speech API for speech recognition. Below is the code-
Libraries:
<script src="https://cdn.botframework.com/botframework-webchat/latest/botchat.js"></script>
<script src="https://cdn.botframework.com/botframework-webchat/latest/CognitiveServices.js"></script>
Web app bot creation in JavaScript:
const speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({ subscriptionKey: <key> }),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: <key>,
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
})
};
BotChat.App({
bot: bot,
locale: params['locale'],
resize: 'detect',
// sendTyping: true, // defaults to false. set to true to send 'typing' activities to bot (and other users) when user is typing
speechOptions: speechOptions,
user: user,
directLine: {
domain: params['domain'],
secret: params['s'],
token: params['t'],
webSocket: params['webSocket'] && params['webSocket'] === 'true' // defaults to true
}
}, document.getElementById('chatBot'));
When I run this on Chrome or Edge, I can click on the microphone and speak something and I get a response (based on the Key-Answer mapping in QnA maker) back as text and voice both. Problem is, if the answer is too long (like 600 characters) I only get the text as response but no voice.
Any help on this? Please let me know if I can provide more details.