Botframework window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory(…)。则不是函数

Botframework window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory(…)。则不是函数,botframework,web-chat,Botframework,Web Chat,我正在使用及其抛出错误,如window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory(…)。then不是一个函数。还需要使用es5.js的IE支持 window.fetch('https://webchat-mockbot.azurewebsites.net/directline/token“,{method:'POST'}) .然后(功能(res){ 返回res.json(); }) .then(函数(json){ c

我正在使用及其抛出错误,如window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory(…)。then不是一个函数。还需要使用es5.js的IE支持

window.fetch('https://webchat-mockbot.azurewebsites.net/directline/token“,{method:'POST'})
.然后(功能(res){
返回res.json();
})
.then(函数(json){
const token=json.token;
window.fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token“,{method:'POST'})
.然后(功能(res){
返回res.json();
})
.then(函数(json){
const region=json.region;
const authorizationToken=json.token;
createCognitiveServicesPeechServicesPonyFillFactory({authorizationToken:authorizationToken,region:region})
.then(函数(webSpeechPonyfillFactory){
window.WebChat.renderWebChat({
directLine:window.WebChat.createDirectLine({token:token}),
webSpeechPonyfillFactory:webSpeechPonyfillFactory
},document.getElementById('webchat');
document.querySelector(“#webchat>*”).focus();
});
});
});

提前感谢。

这是对我有效的设置。我在本地运行服务器来获取实际的令牌。这样我就不需要在客户机中包含任何秘密

window.fetch('http://localhost:3500/directline/token“,{method:'POST'})
.然后(功能(res){
返回res.json();
} )
.然后(功能(res){
let token=res.token;
window.fetch('http://localhost:3500/speechservices/token“,{method:'POST'})
.然后(功能(res){
返回res.json();
} )
.然后(功能(res){
让authorizationToken=res.authorizationToken;
window.WebChat.renderWebChat({
directLine:window.WebChat.createDirectLine({
令牌:令牌,
webSocket:对
} ),
webSpeechPonyfillFactory:window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory({
地区:“westus2”,
authorizationToken:authorizationToken
} )
},document.getElementById('webchat');
});
} );

希望有帮助

接受/向上投票答案服务于更大的堆栈溢出社区和任何有类似问题的人。如果你觉得我的回答足够,请“接受”并投票表决。如果没有,让我知道我还能提供什么帮助@史蒂文肯伯格对我有用谢谢你已经投票了