[英]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智能助理的消息时,您应该使用speech
和displayText
参数进行响应。 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.