我在BotFramework的WebChat control中遇到语音识别问题。我正在使用令牌身份验证(Option 4 in link),但语音识别非常差。 (它没有使用我的LUIS启动等。即使说'嗨'我也在挣扎)。 dev.botframweork.com测试面板中的语音识别功能非常好,我想实现类似的功能。
编辑:
我的代码(或多或少,没有附加条件等)
var botSettings = {
user: {
id: 'You'
},
resize: 'detect',
webSocket: 'true'
};
if (result.chatToken) { // From URI, working fine, included just for the sake of it
const botConnection = new BotChat.DirectLine({
token: result.chatToken.token
});
botSettings.botConnection = botConnection;
}
function get(url) { // URL is pointing to my API
return fetch(url, {
method: 'GET'
}).then(res => res.text());
}
speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({
fetchCallback: () => get(voiceUrl),
fetchOnExpiryCallback: () => get(voiceUrl)
}),
speechSynthesizer: new BotChat.Speech.BrowserSpeechSynthesizer({
fetchCallback: () => get(voiceUrl),
fetchOnExpiryCallback: () => get(voiceUrl),
gender: CognitiveServices.SynthesisGender.Male,
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, BenjaminRUS)'
})
};
botSettings.speechOptions = speechOptions;
BotChat.App(botSettings, document.getElementById("bot"));