c# - 如何让机器人明白我在网络聊天中说印地语
问题描述
我正在尝试构建一个印地语(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: {
...
您可能还想传递chatLocale
您的网络聊天/加入事件。
推荐阅读
- sql - 在 Power BI 后面的 SQL 中创建表
- css - navlistpanel/tabpanel的背景色
- sql - Postgers:使用主键和唯一列时没有唯一或排除约束匹配 ON CONFLICT 规范
- c++ - 在二维数组c ++中打印一个字符串
- java - 做一个装饰器Java程序。为什么会显示不匹配?
- pygame - Pygame 未在 Ubuntu 18.04 中与 vscode 一起运行
- flutter - 如何在 Flutter 中制作固定的模糊叠加层?
- angularjs - 引导文本框(输入)全宽在表单内不起作用
- salesforce - Salesforce测试代码中下面的getDml代码有什么意义
- c# - 行动的不可靠反应