如何让机器人明白我在网络聊天演讲中说的是印地语
How to make bot understand that I'm talking hindi in webchat speech
我正在尝试构建印地语 (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>
```
我不太确定我是否正确理解了你的问题,但你是否尝试过像这样简单的方法:
...
const chatLocale = window.navigator.language;
...
window.WebChat.renderWebChat({
directLine: directline,
locale: chatLocale,
store,
styleOptions: {
...
您可能还想在 webchat/join 活动中传递 chatLocale
。
我正在尝试构建印地语 (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>
```
我不太确定我是否正确理解了你的问题,但你是否尝试过像这样简单的方法:
...
const chatLocale = window.navigator.language;
...
window.WebChat.renderWebChat({
directLine: directline,
locale: chatLocale,
store,
styleOptions: {
...
您可能还想在 webchat/join 活动中传递 chatLocale
。