如何在Bot Framework直线中始终打开麦克风 [英] How to turn on always the microphone in bot framework direct line

查看:78
本文介绍了如何在Bot Framework直线中始终打开麦克风的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个机器人,该机器人可以接受文本和语音输入,并且还可以在两种模式下进行应答. 该机器人的工作原理非常好,但我必须始终单击麦克风按钮才能与该机器人对话.您是否知道不单击麦克风按钮就可以使麦克风始终打开并识别语音吗?

I'm creating a bot which accept text and voice input and also can answer in both mode. The bot works really good but i have to click always the button of microphone to speak with the bot. Do you know it is possible to make microphone always on and to recognize the voice without clicking the button of microphone ?

<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.botframework.com/botframework- 
webchat/latest/botchat.css" rel="stylesheet" />
  </head>
   <body>
   <div id="bot" />
   <script src="https://cdn.botframework.com/botframework- 
    webchat/latest/botchat.js"></script>
  <script src="https://cdn.botframework.com/botframework- 
 webchat/latest/CognitiveServices.js"></script>
        <script> var speechOptions = {
          speechRecognizer: new CognitiveServices.SpeechRecognizer(
        { subscriptionKey: 'xxxxxx' }),

            speechSynthesizer: new CognitiveServices.SpeechSynthesizer(
        {
            subscriptionKey: 'xxxxxxxxxxx',
            gender: CognitiveServices.SynthesisGender.Female,
            voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, 
    JessaRUS)'
        })
  }

    var botConnection = new BotChat.DirectLine({
     secret: "zzzzzzzzzz",
    webSocket: true,
   });


BotChat.App({
        speechOptions: speechOptions,
        botConnection: botConnection,
        user: {
            id: 'userid',
            name: 'User',
        },
        bot: { id: 'botid' },
        resize: 'detect',
        locale: 'en-US'

    },

function postHelp() {
    botConnection
        .postActivity({
            from: { id: 'userid', name: 'User' },
            name: 'postHelp',
            type: 'message',
            text: 'help'
        })
        .subscribe(function(id) {
            console.log('"postHelp" sent');
        });
};

function welcome() {
    botConnection
        .postActivity({
            from: { id: 'userid', name: 'User' },
            name: 'welcome',
            type: 'event',
            value: 'help'
        })
        .subscribe(function (id) {
            console.log('"welcome" sent');
        });
}
</script>

推荐答案

您不能只是打开这种行为.要具有这样的功能,您必须自己实现整个过程,编辑网络聊天控件的代码.网络聊天控件正在使用 DirectLineJS 库.

You cannot just turn on such a behavior. To have something like this, you have to implement the whole thing yourself, editing the code of the web chat control. The web chat control is using the Direct Line API under the hood through the DirectLineJS library.

这篇关于如何在Bot Framework直线中始终打开麦克风的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆