dialogflow-es - 当 followupEventInput 有参数时,Dialogflow Google Assisant 中断
问题描述
我使用 Google Dialogflow 和 webhook 成功创建了一个简单的聊天机器人。该机器人要求用户输入他们的年龄。
- 如果他们的年龄在 18 到 60 岁之间,则 webhook 会发回“followupEventInput”响应并调用“ask_gender”事件。响应还设置了“年龄”参数。
- 如果年龄不在该范围内,它将调用位于另一个意图上的事件“reenter_age”并要求用户重新输入他们的年龄。这里没有设置参数。
这一切都 100% 在 Facebook 和 Dialogflow 测试窗口上运行,完全没有问题。
然后,我使用相同的意图、相同的响应等在完全相同的项目上启用了 Google Assistant。
- 要求用户输入他们的年龄。然后我输入一个超出预期范围的年龄,并触发“reenter_age”事件。然后,Google 助理会要求用户重新输入他们的年龄。都很好,完全没有问题。工作方式与上面相同,使用相同的代码等。
- 然后我输入正确的年龄,我的 webhook 发送一个“followupEventInput”响应并调用“ask_gender”事件。响应还设置了“年龄”参数。与上述第一点完全相同。但是,不幸的是,我不断收到带有代码 14 的“Webhook 错误 (206)”响应。在这里,Google 助理应该询问此人的性别(这个问题来自与被调用事件相关联的意图,而不是来自我的 webhook),但这不会发生(在 Facebook 和右侧的 Dialogflow 测试窗口中完美运行)。
当我从我的响应中删除参数值时,谷歌助手将继续询问参数提示,因为参数值永远不会被设置,这是正确的,这是应该发生的。
我确实相信这可能是一个错误,但如果您也偶然发现这一点,我将非常感谢您的意见。
这会显示在 Google 助理模拟器窗口中:“抱歉,COMPANY_NAME 封面现在没有响应。请稍后再试。” 就在“xxx已经离开对话”的下方。
有趣的是,在“音频”选项卡中显示了助手应该问的文本:“谢谢。你是男性还是女性?”
以下是来自 Google Assistant 模拟器测试页面的调试日志:
"response": "Sorry, COMPANY_NAME Cover isn't responding right now. Please try again soon.",
"expectUserResponse": false,
"conversationToken": "xxx...",
"audioResponse": "//xxx...",
"ssmlMarkList": [],
"debugInfo": {
"assistantToAgentDebug": {
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=xxxxx' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjI4Yjc0MWU4ZGU5ODRhNDcxNTlmMTllNmQ3NzgzZTlkNGZhODEwZGIiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJhZ2VudC1jb3Zlci10ZXN0LW5xbXB3aCIsIm5iZiI6MTU4ODA3MTg5MSwiaWF0IjoxNTg4MDcyMTkxLCJleHAiOjE1ODgwNzIzMTEsImp0aSI6ImE0MWUyMzgzMWMzYTQ3MDY0MTViYTM1ODQxNGJlZmRlNTM4NzYzYzEifQ.aHxw-af5z3jFgIR0biT-MLGSfHsxtKn2-b966pmqMiAGlhD5xe4OUnAiyXedgR4I65AMAEdiYDHODI-H_WgnPyHh9j23Dfqfn3RJD-Z_vvCl_woEFQB4DXp1uFOZEOsJVf-n3tBWTmkCJvERGuDBdbisvwIIHvcjg3NTDeUPNDvuDvGbU915TA7qWp0vtTNr923zu5qoZC3x9lVYNqK5eXXZgDBd0DUjLkfnmEmX_6cRhvTvFptLjFD54TOw920kjlfCGslu2cy4GzMSsbOYiLwDc6Nmt7SW7ekTRPY4FwMXP7YE0-fj5ELDDGV-7zh3jydJusqx_Yi1UvkDr1EWwg' -A Google-ActionsOnGoogle/1.0 -X POST -d '{\"user\":{\"locale\":\"en-US\",\"lastSeen\":\"2020-04-28T11:09:46Z\",\"userVerificationStatus\":\"VERIFIED\"},\"conversation\":{\"conversationId\":\"ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"expecting_age\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.TEXT\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"40\"}],\"arguments\":[{\"name\":\"text\",\"rawText\":\"40\",\"textValue\":\"40\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.ACCOUNT_LINKING\"}]},\"isInSandbox\":true,\"requestType\":\"SIMULATOR\"}'",
"assistantToAgentJson": "{\"user\":{\"locale\":\"en-US\",\"lastSeen\":\"2020-04-28T11:09:46Z\",\"userVerificationStatus\":\"VERIFIED\"},\"conversation\":{\"conversationId\":\"ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"expecting_age\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.TEXT\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"40\"}],\"arguments\":[{\"name\":\"text\",\"rawText\":\"40\",\"textValue\":\"40\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.ACCOUNT_LINKING\"}]},\"isInSandbox\":true,\"requestType\":\"SIMULATOR\"}",
"delegatedRequest": {
"delegatedRequest": ""
}
},
"agentToAssistantDebug": {
"agentToAssistantJson": "{\n \"conversationToken\": \"[\\\"expecting_gender\\\",\\\"expecting_age\\\"]\",\n \"expectUserResponse\": true,\n \"expectedInputs\": [{\n \"inputPrompt\": {\n \"richInitialPrompt\": {\n \"items\": [{\n \"simpleResponse\": {\n \"textToSpeech\": \"Thank you.\"\n }\n }, {\n \"simpleResponse\": {\n \"textToSpeech\": \"Are you male or female?\"\n }\n }]\n }\n },\n \"possibleIntents\": [{\n \"intent\": \"assistant.intent.action.TEXT\"\n }, {\n \"intent\": \"956e9d14-6369-4b69-a1dd-443f37ebff64\"\n }, {\n \"intent\": \"e4abebaf-e693-4989-bfa9-5fc3e329a5ce\"\n }],\n \"speechBiasingHints\": [\"$entity-gender\", \"$sys.number-integer\"]\n }],\n \"responseMetadata\": {\n \"status\": {\n \"code\": 14,\n \"message\": \"Webhook error (206)\"\n },\n \"queryMatchInfo\": {\n \"queryMatched\": true,\n \"intent\": \"956e9d14-6369-4b69-a1dd-443f37ebff64\",\n \"parameterNames\": [\"age\"]\n },\n \"delegatedRequest\": {\n \"delegatedRequest\": \"{\\n \\\"responseId\\\": \\\"77a4105c-11c4-41fc-b8b4-f85753f056c9-8e1f57f1\\\",\\n \\\"queryResult\\\": {\\n \\\"queryText\\\": \\\"ask_gender\\\",\\n \\\"parameters\\\": {\\n \\\"age\\\": {\\n \\\"amount\\\": 40.0,\\n \\\"unit\\\": \\\"year\\\"\\n }\\n },\\n \\\"allRequiredParamsPresent\\\": true,\\n \\\"fulfillmentText\\\": \\\"Are you male or female?\\\",\\n \\\"fulfillmentMessages\\\": [{\\n \\\"platform\\\": \\\"ACTIONS_ON_GOOGLE\\\",\\n \\\"simpleResponses\\\": {\\n \\\"simpleResponses\\\": [{\\n \\\"textToSpeech\\\": \\\"Thank you.\\\"\\n }]\\n }\\n }, {\\n \\\"platform\\\": \\\"ACTIONS_ON_GOOGLE\\\",\\n \\\"simpleResponses\\\": {\\n \\\"simpleResponses\\\": [{\\n \\\"textToSpeech\\\": \\\"Are you male or female?\\\"\\n }]\\n }\\n }, {\\n \\\"text\\\": {\\n \\\"text\\\": [\\\"Thank you.\\\"]\\n }\\n }, {\\n \\\"text\\\": {\\n \\\"text\\\": [\\\"Are you male or female?\\\"]\\n }\\n }],\\n \\\"outputContexts\\\": [{\\n \\\"name\\\": \\\"projects/agent-cover-test-nqmpwh/agent/sessions/ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc/contexts/expecting_gender\\\",\\n \\\"lifespanCount\\\": 20,\\n \\\"parameters\\\": {\\n \\\"age\\\": {\\n \\\"amount\\\": 40.0,\\n \\\"unit\\\": \\\"year\\\"\\n },\\n \\\"age.original\\\": \\\"40\\\"\\n }\\n }, {\\n \\\"name\\\": \\\"projects/agent-cover-test-nqmpwh/agent/sessions/ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc/contexts/ask_gender\\\",\\n \\\"parameters\\\": {\\n \\\"age\\\": {\\n \\\"amount\\\": 40.0,\\n \\\"unit\\\": \\\"year\\\"\\n },\\n \\\"age.original\\\": \\\"40\\\"\\n }\\n }, {\\n \\\"name\\\": \\\"projects/agent-cover-test-nqmpwh/agent/sessions/ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc/contexts/expecting_age\\\",\\n \\\"lifespanCount\\\": 17,\\n \\\"parameters\\\": {\\n \\\"age\\\": {\\n \\\"amount\\\": 40.0,\\n \\\"unit\\\": \\\"year\\\"\\n },\\n \\\"age.original\\\": \\\"40\\\"\\n }\\n }, {\\n \\\"name\\\": \\\"projects/agent-cover-test-nqmpwh/agent/sessions/ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc/contexts/__system_counters__\\\",\\n \\\"parameters\\\": {\\n \\\"no-input\\\": 0.0,\\n \\\"no-match\\\": 0.0,\\n \\\"age\\\": {\\n \\\"amount\\\": 40.0,\\n \\\"unit\\\": \\\"year\\\"\\n },\\n \\\"age.original\\\": \\\"40\\\"\\n }\\n }],\\n \\\"intent\\\": {\\n \\\"name\\\": \\\"projects/agent-cover-test-nqmpwh/agent/intents/956e9d14-6369-4b69-a1dd-443f37ebff64\\\",\\n \\\"displayName\\\": \\\"cover.funeral.get.quote.age\\\"\\n },\\n \\\"intentDetectionConfidence\\\": 1.0,\\n \\\"languageCode\\\": \\\"en\\\"\\n },\\n \\\"originalDetectIntentRequest\\\": {\\n \\\"source\\\": \\\"google\\\",\\n \\\"version\\\": \\\"2\\\",\\n \\\"payload\\\": {\\n \\\"user\\\": {\\n \\\"locale\\\": \\\"en-US\\\",\\n \\\"lastSeen\\\": \\\"2020-04-28T11:09:46Z\\\",\\n \\\"userVerificationStatus\\\": \\\"VERIFIED\\\"\\n },\\n \\\"conversation\\\": {\\n \\\"conversationId\\\": \\\"ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc\\\",\\n \\\"type\\\": \\\"ACTIVE\\\",\\n \\\"conversationToken\\\": \\\"[\\\\\\\"expecting_age\\\\\\\"]\\\"\\n },\\n \\\"inputs\\\": [{\\n \\\"intent\\\": \\\"actions.intent.TEXT\\\",\\n \\\"rawInputs\\\": [{\\n \\\"inputType\\\": \\\"KEYBOARD\\\",\\n \\\"query\\\": \\\"40\\\"\\n }],\\n \\\"arguments\\\": [{\\n \\\"name\\\": \\\"text\\\",\\n \\\"rawText\\\": \\\"40\\\",\\n \\\"textValue\\\": \\\"40\\\"\\n }]\\n }],\\n \\\"surface\\\": {\\n \\\"capabilities\\\": [{\\n \\\"name\\\": \\\"actions.capability.SCREEN_OUTPUT\\\"\\n }, {\\n \\\"name\\\": \\\"actions.capability.WEB_BROWSER\\\"\\n }, {\\n \\\"name\\\": \\\"actions.capability.AUDIO_OUTPUT\\\"\\n }, {\\n \\\"name\\\": \\\"actions.capability.MEDIA_RESPONSE_AUDIO\\\"\\n }, {\\n \\\"name\\\": \\\"actions.capability.ACCOUNT_LINKING\\\"\\n }]\\n },\\n \\\"isInSandbox\\\": true,\\n \\\"requestType\\\": \\\"SIMULATOR\\\"\\n }\\n },\\n \\\"session\\\": \\\"projects/agent-cover-test-nqmpwh/agent/sessions/ABwppHGl1ac0akIrzrAht8MzMsi-Um7CE4a_6YBczuuJQrgypBqq3BHGkoRcnYXeuZm33-MKMAiPXgOQs_LacUF5yBgtpLc\\\"\\n}\"\n },\n \"delegatedResponse\": {\n \"delegatedResponse\": \"{\\\"followupEventInput\\\": {\\\"name\\\": \\\"ask_gender\\\", \\\"languageCode\\\": \\\"en-US\\\", \\\"parameters\\\": {\\\"age\\\": {\\\"amount\\\": 40.0, \\\"unit\\\": \\\"year\\\"}, \\\"age.original\\\": \\\"40\\\"}}}\"\n }\n }\n}",
"delegatedResponse": {
"delegatedResponse": ""
}
},
"sharedDebugInfoList": [
{
"name": "ResponseValidation",
"debugInfo": "",
"subDebugEntryList": [
{
"name": "MalformedResponse",
"debugInfo": "Webhook error (206).",
"subDebugEntryList": []
}
]
}
],
"conversationBuilderExecutionEventsList": []
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Sorry, COMPANY_NAME Cover isn't responding right now. Please try again soon."
}
}
],
"suggestionsList": [],
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": true,
"clientOperationList": [
{
"operationType": 7,
"exitIndicatorPayLoad": {
"status": 1
}
}
],
"projectName": "",
"renderedHtml": ""
}```
解决方案
我找到了解决方法。如果您发回“fulfillmentMessages”响应(而不是 followUpIntent 响应),Google Assistant 将继续执行下一个意图,并保持所有上下文和参数完好无损。这绝对不是理想的,但它是一种解决方法。您可以在其中放置任何您想要的文本,然后继续。
推荐阅读
- python - -0.0 和 +0.0 之间有区别吗?
- cordova - 键盘推动了我的 webview framework7 cordova
- php - 使用php从docx文件中提取文本时忽略文本引用/参考
- java - 带有 PDFBox 和 JPEG 2000 示例的图像类型未知
- php - 从 Android 将 Firebase 令牌插入我的 sql 表
- c++ - C++ 调用 Struct 及其继承成员的默认构造函数
- python - python os.walk 显示混合的 windows 和 unix 路径
- python - Pandas 中的问题:在加载到 df 时正确合并和迭代平均?
- angular - Angular 构建到 NPM 包将 RXJS 运算符作为完整路径导入
- reactjs - 反应,动态生成选项卡时出错