简体   繁体   English

DialogFlow Google智能助理Webhook回复:“空话语回应”

[英]DialogFlow Google Assistant Webhook Response: “Empty speech response”

I am having some trouble using the Fulfillment/Webhook of Dialogflow. 我在使用Dialogflow的Fulfillment / Webhook时遇到了一些麻烦。 I have created an Intent which accepts a parameter as input (pin number). 我创建了一个Intent,它接受一个参数作为输入(引脚号)。 The pin is "validated" at the server end using the Webhook call. 使用Webhook调用在服务器端“验证”该引脚。 That is, "Enable webhook call for this intent" is checked. 也就是说,选中“为此意图启用webhook调用”。 The method returns a positive message on successful validation. 该方法在成功验证时返回正消息。

The whole scenario works perfectly as long as I use the Dialogflow console's "Try it Now" window. 只要我使用Dialogflow控制台的“立即尝试”窗口,整个场景就能完美运行。 But when I try to test it in the Google Assistant Simulator, it responds with: 但是当我尝试在Google智能助理模拟器中测试时,它会响应:

Screen from Actions on Google page > Response 屏幕来自Google上的操作页面>响应

Also, 也,

Screen from Actions on Google page > Validation Errors 来自Google页面上的操作的屏幕>验证错误

Here is the intent: 这是意图:

Intent screen from DialogFlow Agent page 来自DialogFlow Agent页面的Intent屏幕

The response I have set to return from the Webhook call: 我已设置从Webhook调用返回的响应:

"messages": [
  {
    "speech": "Thanks. Your pin has been confirmed.",
    "type": 0
  }

Sample response found here: https://dialogflow.com/docs/fulfillment 此处的示例响应: https//dialogflow.com/docs/fulfillment

Please note, I have already checked Error "Empty speech response" . 请注意,我已经检查了错误“空语音响应” It didn't help. 它没有帮助。

That's a good question, and the documentation looks a bit unclear about valid responses. 这是一个很好的问题,文档对于有效的回复看起来有点不清楚。

When replying with a message for the Google Assistant, you should be using the speech and displayText parameters for the response. 在回复Google智能助理的消息时,您应该使用speechdisplayText参数进行响应。 So the equivalent response would be something like 所以等效的反应会是这样的

{
  "speech": "Thanks. Your pin has been confirmed.",
  "displayText": "Thank you. We have confirmed your PIN and you can proceed."
}

However, if you're going to be doing additional work with Actions on Google features (cards, feature requests, etc) or even just keep the conversation open while talking to the user, then you will need to use the data.google object as well and possibly include a simpleResponse as part of the reply . 但是,如果您要在Google功能(卡片,功能请求等)上执行其他操作,或者甚至只是在与用户交谈时保持对话打开,那么您需要将data.google对象用作以及可能包含simpleResponse作为回复的一部分。 That might look something like this: 这可能看起来像这样:

{
  "speech": "Thanks. Your pin has been confirmed.",
  "displayText": "Thank you. We have confirmed your PIN and you can proceed.",
  "data": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "Thanks. Your pin has been confirmed.",
              "displayText": "Thank you. We have confirmed your PIN and you can proceed."
            }
          }
        ]
      }
    }
  }
}

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

相关问题 Dialogflow:从 webhook 向用户打印 JSON 响应 - Dialogflow: Print JSON response from webhook to user 尝试使用 Webhook On Dialogflow 动态提供响应时出现 Webhook 响应错误 (206) - getting Webhook response error (206) when trying to give response Dynamically using webhook On Dialogflow 为什么我的Webhook无法将响应发送到我的dialogflow代理 - Why is my webhook not sending response to my dialogflow agent Dialogflow Webhook 响应的 Facebook Messenger 中未出现快速回复 - Quick Replies not appearing in Facebook Messenger from Dialogflow Webhook Response 在iOS中解析Google语音工具包响应 - Parse Google speech kit response in ios 用python解码Google Speech API响应 - Decoding Google Speech API response in python Google Assistant的履行响应带有转义符“ \\” - Google Assistant's fulfillment response comes with escape character “\” Dialogflow无法从我的Webhook解析JSON响应似乎改变了字符编码 - Dialogflow fails to parse the JSON response from my webhook seems to change character encoding 在Dialogflow上没有错误时,Google智能助理出错 - Error on Google Assistant while no error on Dialogflow 浏览轮播卡不适用于 Dialogflow 中的谷歌助手 - Browse Carousel Card not working for google assistant in Dialogflow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM