我正在为一个机器人做演讲。我一直在运行微软的教程找到了here。我已经从那里得到了Echo机器人的例子,找到了here,作为基础,所以我可以继续使用它作为基础。这已成功部署到我的Azure环境中。同样在本教程中,您可以通过Direct Line Speech Client v1运行您的机器人,执行此操作时,一切都会按预期进行。
我已经查看了Bot Framework Web Chat speech notes,以便使用它作为我的通道来让机器人工作。下面是我的代码:
<!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)我不太确定是在脚本代码中还是在机器人中,如果你需要更多细节,请让我知道。提前感谢!
发布于 2019-09-13 10:40:58
很奇怪..。我在Azure上托管了一个echo机器人,只是复制和粘贴你的html代码,并进行了一些配置,我在edge firefox和chrome上进行了测试,但一切都运行得很好,包括tts调用:

您可以尝试here并检查配置。希望能有所帮助。
https://stackoverflow.com/questions/57909314
复制相似问题