【问题标题】:How to use Azure Speech Service in Bot Framework Web Chat如何在 Bot Framework 网络聊天中使用 Azure 语音服务
【发布时间】:2018-11-09 05:14:43
【问题描述】:

我正在使用 Bot Framework 网络聊天,并且我正确设置了一个前端供用户与我的机器人聊天。我正在尝试为其启用语音,我尝试按照此处的教程进行操作:https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-webchat-speech?view=azure-bot-service-3.0

我遇到的问题是我尝试使用 Azure 语音服务,我正确设置了我的服务,并设置了密钥。但我不确定从哪里获得 CognitiveServices?本教程没有指定从哪里获得它。

这是我的代码:

<div  id="bot"/>
<script src="https://cdn.botframework.com/botframework-webchat/latest/botchat.js"></script>
<script>

    const speechOptionsRemote = {
        speechRecognizer: new CognitiveServices.SpeechRecognizer({ subscriptionKey: '...' }),
        speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
            gender: CognitiveServices.SynthesisGender.Female,
            subscriptionKey: '...',
            voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
        })
    };

    BotChat.App({
        directLine: { secret: '...' },
        user: { id: 'WebChat' },
        bot: { id: '...' },
        resize: 'detect',
        speechOptions: speechOptionsRemote,
        showUploadButton: false
    }, document.getElementById("bot"));
    var header = document.getElementsByClassName("wc-header");
    header[0].innerHTML = "<span ><p align='center' >My Bot</p></span>"
</script>

当我导航到该页面时,它抱怨没有找到 CogntiveService。我在哪里得到它?

【问题讨论】:

标签: botframework


【解决方案1】:

您的代码示例使用的是 v3 的 Webchat,现已弃用,请参阅 here。 GitHub仓库上有一个BotFramework-WebChat v4,前几天更新了。

因此,当您在代码中下载 cdn.botframework.com/botframework-webchat/latest/botchat.js 时,v4: 解释了为什么找不到 CognitiveServices: 它已被重构。

要在 v4 中使用认知服务语音,请查看专用示例:https://github.com/Microsoft/BotFramework-WebChat/tree/master/samples/speech-cognitive-services-bing-speech

【讨论】:

  • 问题是 Bing 语音已被弃用,目前还没有办法将认知服务语音密钥与 WebChat 一起使用。这将很快修复,但现在它已损坏。
  • 我以为 Bing Speech 只会在 2019 年停止 (docs.microsoft.com/en-us/azure/cognitive-services/speech/home)。但是这里@EricDahlvang,指向v4 的latest\botchat.js 版本没有问题吗?
  • 必应语音服务将继续运行,但用户无法创建新的必应语音密钥。
  • 我假设 OP 如他所说 and I set the key 准时创建了一个,但我可能错了。他还补充说错误是It complain that CogntiveServices is not found,所以查看我从v3 自述文件中读取new CognitiveServices.SpeechRecognizer 的代码并查看行为发生变化的v4 源代码
  • 很高兴知道!谢谢埃里克
猜你喜欢
  • 2019-06-29
  • 1970-01-01
  • 1970-01-01
  • 2019-03-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-30
  • 1970-01-01
相关资源
最近更新 更多