CognitiveServices.SpeechSynthesizer在聊天机器人中说用户和机器人

时间:2018-07-09 08:17:13

标签: javascript node.js botframework bots

大家好,我正在使用MicrosoftBot Framework构建聊天机器人,我想启用语音合成器,但仅针对机器人的答案。

要启用语音,我有这个选项

// use browser built in capabilities for TTS/STT
const speechOptions = {
  speechRecognizer: new this.CognitiveServices.SpeechRecognizer({ subscriptionKey: speechRecognizerKey }),
  speechSynthesizer: new this.CognitiveServices.SpeechSynthesizer({
    gender: this.CognitiveServices.SynthesisGender.Female,
    subscriptionKey: speechSynthesizerKey,
    voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
  })
};

然后将语音选项传递给机器人启动配置

// BotChat is exposed by the botchat.js
// When we run this line, the botchat.js has to be loaded in the page.
this.BotChat.App({
  bot: bot,
  locale: params['locale'],
  resize: 'detect',
  botConnection: botConnection,
  speechOptions: speechOptions,
  user: user
}, document.getElementById('BotChatGoesHere'));

所以我的问题是,我可以给bot框架任何选择,只说出答案而不是我在做的问题吗?

0 个答案:

没有答案