首页 > 解决方案 > 如何让机器人明白我在网络聊天中说印地语

问题描述

我正在尝试构建一个印地语(hi-IN)语音聊天机器人..该机器人在网络聊天中以英语工作,但任何人都可以帮助我如何让机器人了解我在说印地语,然后将其转换为印地语文本使用认知语音服务

 <script>
        (async function () {
            const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
                method: 'POST',
                headers: new Headers({
                    'Authorization': 'Bearer 5********'
                })
            });
            const { token } = await res.json();

            const store = window.WebChat.createStore(
                {},
                ({ dispatch }) => next => action => {
                    if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
                        dispatch({
                            type: 'WEB_CHAT/SEND_EVENT',
                            payload: {
                                name: 'webchat/join',
                                value: { username: "UserName" }
                            }
                        });
                    }
                    return next(action);
                }
            );

            window.WebChat.renderWebChat({
                directLine: window.WebChat.createDirectLine({ token }),
                webSpeechPonyfillFactory: window.WebChat.createBrowserWebSpeechPonyfillFactory(),
                styleOptions: {
                    hideUploadButton: true,
                    bubbleBackground: '#cccccc',
                    bubbleBorder: 'solid 1px #E6E6E6'
                },
                store
            }, document.getElementById('webchat'));

            document.querySelector('#webchat > *').focus();
        })().catch(err => console.error(err));</script>
    ```

标签: c#botframeworkspeech-recognitiondirect-line-botframeworkweb-chat

解决方案


我不太确定我是否正确理解了您的问题,但是您是否尝试过像这样简单的事情:

...
const chatLocale = window.navigator.language;
...
window.WebChat.renderWebChat({
    directLine: directline,
    locale: chatLocale,
    store,
    styleOptions: {
...

您可能还想传递chatLocale您的网络聊天/加入事件。


推荐阅读