首页 > 解决方案 > CognitiveServices.SpeechSynthesizer 在聊天机器人中同时说用户和机器人

问题描述

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

启用语音我有这个选项

// 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'));

所以我的问题是,我是否可以给机器人框架提供任何选项来只说出答案而不是我正在做的问题?

标签: javascriptnode.jsbotframeworkbots

解决方案


推荐阅读