Microsoft Botframework网络聊天语音识别动态设置语言代码

时间:2020-08-11 11:27:19

标签: botframework speech-recognition azure-cognitive-services direct-line-botframework web-chat

我正在寻找如何根据用户说的语言在网络聊天中动态设置语言代码。

我尝试过

window.WebChat.renderWebChat({
        directLine: window.WebChat.createDirectLine({
            secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }),
        styleOptions: {
            hideUploadButton: true,
            botAvatarInitials: 'Bot'
        },
        selectVoice: (voices, activity) => voices.find(({
            name
        }) => /Kalpana/iu.test(name)),
        //Console.log(activity.locale);
        webSpeechPonyfillFactory: window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory({
            region: 'xxxx',
            subscriptionKey: 'xxxxx'
        }),
        userID: "ravi@gmail.com",
        locale: 'hi-IN'
    },
    document.getElementById('webchat')
);

document.querySelector('#webchat > *').focus();

我要寻找的是,我需要根据用户说的语言动态设置 locale 参数。

0 个答案:

没有答案