botframework - 无法为 Bot Framework 网络聊天合成语音
问题描述
我正在为 BOT 演讲。我一直在浏览此处找到的 Microsoft 教程。我已经从那里找到了示例 Echo BOT 示例,在此处找到,作为基础,因此我可以将其用作前进的基础。这已成功部署到我的 Azure 环境。同样在本教程中,您通过 Direct Line Speech Client v1 运行您的 Bot,执行此操作时一切正常。
我查看了Bot Framework 网络聊天语音笔记,让 Bot 使用它作为我的频道工作。这是我的代码:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Web Chat: Browser-supported speech</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<style>
html, body { height: 100% }
body { margin: 0 }
#webchat {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
(async function () {
window.WebChat.renderWebChat({
directLine: createDirectLine({
secret: '<My Direct Line secret>'
}),
language: 'en-US',
webSpeechPonyfillFactory: await createCognitiveServicesSpeechServicesPonyfillFactory({
region: '<Speech cognitive service region>',
subscriptionKey: '<Speech cognitive service key>'
})
}, document.getElementById('webchat'));
document.querySelector('#webchat > *').focus();
})().catch(err => console.error(err));
</script>
</body>
</html>
我能够让这个工作,我可以对文本和文本输入进行语音,并且内容被写回,但是当它尝试将文本返回到语音时,我在浏览器控制台中收到以下错误:
POST https://<region>.tts.speech.microsoft.com/cognitiveservices/v1 net::ERR_ABORTED 400 (Speak node can only be the root.)
webchat.js:1 Error: Failed to syntheis speech, server returned 400
at webchat.js:1
at c (webchat.js:1)
at Generator._invoke (webchat.js:1)
at Generator.e.<computed> [as next] (webchat.js:1)
at n (webchat.js:1)
at s (webchat.js:1)
我不太确定它是在脚本代码中还是在 Bot 中,如果您需要更多详细信息,请告诉我。提前致谢!
解决方案
这很奇怪......我在 Azure 上托管了一个 echo bot,只是复制并粘贴了你的 html 代码并做了一些配置,我在 edge firefox 和 chrome 上进行了测试,但一切正常,包括 tts 调用:
您可以在这里尝试并检查配置。希望能帮助到你 。
推荐阅读
- sql - SQL 中按 1-7 系统日期分组
- resty-gwt - 无法配置 RestyGWT 示例应用程序
- sql - 填充 SQL Server 中两个日期之间的缺失日期
- sdk - 寻找CRM 2015 sdk zip下载
- java - 如何使用多种类型的 customViewHolder 在 recyclerView 中实现 recyclerView.smoothScrollToPosition(position)?
- opencart-3 - 如何在 OpenCart 3.0.3.1 中设计 LinkedIn 插件?我可以得到设计这个插件的流程吗?
- scala - 是否可以将 HMap 从 A 类型转换为多种其他类型?
- javascript - 联系表格不向电子邮件发送数据
- google-analytics - 为什么当我选择不同的日期时,来自 Google 分析查询资源管理器的数据会发生变化?
- sql-server - Microsoft Flow:SQL 目标的字符串到 GUID 转换