Dialogflow es 列出AoG中的卡片,将项目标题传递给下一个查询,而不是键
在一个应用程序中,我返回类型为Dialogflow es 列出AoG中的卡片,将项目标题传递给下一个查询,而不是键,dialogflow-es,actions-on-google,Dialogflow Es,Actions On Google,在一个应用程序中,我返回类型为list\u card的消息,其中包含一个意图的选项键。 下面是一个示例查询的json: { "id": "275212ef-cf97-4576-afa7-facfbc044ada", "timestamp": "2017-07-17T17:36:03.655Z", "lang": "en", "result": { "source": "agent", "resolvedQuery": "who is Sneha", "ac
list\u card
的消息,其中包含一个意图的选项键。下面是一个示例查询的json:
{
"id": "275212ef-cf97-4576-afa7-facfbc044ada",
"timestamp": "2017-07-17T17:36:03.655Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "who is Sneha",
"action": "cp.name_search",
"actionIncomplete": false,
"parameters": {
"keyword": "Sneha"
},
"contexts": [
{
"name": "cpname_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 2
},
{
"name": "cpuid_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 1
}
],
"metadata": {
"intentId": "86bd1a17-8e9a-4956-b270-5fb4ac952f5f",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 135,
"intentName": "cp.name_search"
},
"fulfillment": {
"speech": "Searching...",
"source": "agent",
"messages": [
{
"type": "simple_response",
"platform": "google",
"textToSpeech": "Here are the search results. \nWant anything else?"
},
{
"type": "list_card",
"platform": "google",
"title": "Search results",
"items": [
{
"optionInfo": {
"key": "uid 72",
"synonyms": []
},
"title": "Sneha Vasista",
"description": "Srinivas Institute of Technology",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2053",
"synonyms": []
},
"title": "Sneha Bhat",
"description": "Canara Engineering College",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2114",
"synonyms": []
},
"title": "Sneha Sajan",
"description": "P.A College of Engineering",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2320",
"synonyms": []
},
"title": "Sneha ",
"description": "sdit",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2363",
"synonyms": []
},
"title": "Sneha ",
"description": "Srinivas School of Engineering, Mukka",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
}
]
},
{
"type": "0",
"speech": "Here are the search results."
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "e6aa9e52-a9e1-481a-adb5-476c5b386e02"
}
现在的问题是,当我在AoG模拟器中点击列表项时,它会将项的title
传递给下一个查询
但是在Api.ai模拟器中测试时,它表现良好,并将键
传递给下一个查询
这里可能有什么问题?有什么提示吗?您需要做的是直接在当前意图下设置回退意图 例如,如果显示来自默认欢迎意图的列表,则可以执行以下操作
const param=app.getContextArgument('actions\u intent\u option','option').value代码>如果您使用的是API.AI,那么它将作为操作\u意图\u选项出现在意图中
一个好的解决方案是具有发送带有OutputContext的列表的意图。然后使用操作\u意图\u选项
作为事件和所需的操作
为该上下文创建一个特定的回退意图,该上下文应处理语音和按键响应。
您将在[“原始请求”][“数据”][“输入”][0][“参数”][0][“文本值”]
找到您的选项键,而不是参数
您还可以在actions\u intent\u选项上下文中看到响应值。我为该意图添加了回退。但我的后端是php,我通过检查请求json的[“result”][“action”]
来响应查询意图。那我怎么在那里查呢?另外,我可以在培训中看到,现在点击选项会调用actions\u intent\u option
事件。我使用actionactions\u intent\u选项
添加了一个回退意图,并将list intent的输出内容作为输入上下文。我所需的操作可以处理这些选项之外的输入,这就增加了后备意图。现在点击选项不会失败,但是后端没有接收任何参数。后端接收什么?你能发布JSON吗?该JSON的日志:。顺便说一句,我可以看到originalResponse
中的option\u键对阅读和理解JSON总是有帮助的。{:我还为答案添加了另一个位置。是的,知道了。谢谢