简体   繁体   English

带有 Android 的 DialogFlow

[英]DialogFlow with Android

I'm making an app with Android Studio (Java) and Dialogflow V2.我正在使用 Android Studio (Java) 和 Dialogflow V2 制作应用程序。 I want to speak with the app and the message I said goes to Dialogflow and it answers me.我想与应用程序交谈,我说的消息会发送到 Dialogflow,它会回答我。 The thing is that all I can find is that the user types the message and it is sent to Dialogflow.问题是我能找到的只是用户键入消息并将其发送到 Dialogflow。

Does someone know how to do it?有人知道该怎么做吗? How to convert the speak to message in the DialogFlow V2?如何在 DialogFlow V2 中将语音转换为消息?

Step 1: First of all, convert your users' text from a speech by RecognizerIntent .第 1 步:首先,通过RecognizerIntent将用户的文本从语音转换。 This tutorial will be helpful for this.教程将对此有所帮助。

Step 2: Then do your rest of the tasks for DialogFlow with the text getting from the speech.第 2 步:然后使用从语音中获取的文本执行 DialogFlow 任务的rest

Dialogflow can use Cloud Text-to-Speech to generate speech responses. Dialogflow 可以使用 Cloud Text-to-Speech 生成语音响应。 The dependencies required for that are mentioned in this Dialogflow article .此 Dialogflow文章中提到了所需的依赖项。

If you are using any third-party integration like Kommunicate with Dialogflow.如果您使用任何第三方集成,例如 Kommunicate 和 Dialogflow。 Then add the below settings in Login success callback, find more details here .然后在登录成功回调中添加以下设置,在此处查找更多详细信息。

KmPrefSettings.getInstance(contextOrActivityName.this)
        .enableSpeechToText(true)
        .enableTextToSpeech(true)
        .setSendMessageOnSpeechEnd(true);

    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM