【发布时间】:2019-09-13 10:40:57
【问题描述】:
我正在为 BOT 演讲。我一直在运行找到 here 的 Microsoft 教程。我从那里获取了示例 Echo BOT 示例,找到了 here,作为基础,因此我可以将其用作前进的基础。这已成功部署到我的 Azure 环境。同样在本教程中,您通过 Direct Line Speech Client v1 运行您的 Bot,执行此操作时一切正常。
我查看了Bot Framework Web Chat speech notes 以让 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)
我不太确定是脚本代码还是机器人中的某些内容,如果您需要更多详细信息,请告诉我。提前致谢!
【问题讨论】:
标签: botframework microsoft-cognitive speech direct-line-botframework web-chat