【问题标题】:Simulator error UnparseableJsonResponse ("Cannot find field.")模拟器错误 UnparseableJsonResponse(“找不到字段。”)
【发布时间】:2018-01-08 21:37:50
【问题描述】:

我已在 DialogFlow 控制台中使用我的 webhook 成功测试了我的应用程序的前几个意图,但在模拟器中进行测试会出现以下错误:

UnparseableJsonResponse API 版本 2:无法解析 JSON 响应 带有“INVALID_ARGUMENT”错误的字符串:“:找不到字段。”。

注意!!! 首先要注意的是它指的是“API Version 2”。

没有请求到达我的 webhook - 所以这一切似乎都在 Google 内部。

使用 Chrome 开发人员工具,我看到了收到此错误响应的网络条目 - 以下是一些详细信息:

来自模拟器的请求网址:https://assistant.clients6.google.com/v1/assistant:converse?alt=json&key=A.....

注意!!! (注意它说的是“v1”)

请求负载:

{"conversationToken":"","debugLevel":1,"inputType":"KEYBOARD","locale":"en-US","mockLocation":{"city":"Mountain View","coordinates":{"latitude":37.421980615353675,"longitude":-122.08419799804688},"formattedAddress":"Googleplex, Mountain View, CA 94043, United States","zipCode":"94043"},"query":"Talk to ","surface":"PHONE"}

回复:

{
    "response": "Connect the docs isn't responding right now. Try again soon.",
    "conversationToken": "GidzaW11bGF0b3JfZGV2aWNlXzM3MTQxRERFM0I0Nzk1Q0ZfMDAwMDA=",
    "audioResponse": "//NExAAR... encoded audio ...",
    "debugInfo": {
        "assistantToAgentDebug": {
            "curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=...token...' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: ...authorization key...' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"...user id...\",\"locale\":\"en-US\",\"lastSeen\":\"2017-12-15T17:22:55Z\"},\"conversation\":{\"conversationId\":\"1513778713541\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Connect The Docs\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'",
            "assistantToAgentJson": "{\"user\":{\"userId\":\"...user id...\",\"locale\":\"en-US\",\"lastSeen\":\"2017-12-15T17:22:55Z\"},\"conversation\":{\"conversationId\":\"1513778713541\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Connect The Docs\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}"
        },
        "agentToAssistantDebug": {
            "agentToAssistantJson": "{\"message\":\"Unexpected apiai response format: Empty speech response\",\"apiResponse\":{\"id\":\"24ddbf1c-3930-40c6-ba50-03c0935cd1d0\",\"timestamp\":\"2017-12-20T14:05:13.766Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1513778713541\"}}"
        },
        "sharedDebugInfo": [{
            "name": "ResponseValidation",
            "subDebugEntry": [{
                "name": "UnparseableJsonResponse",
                "debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\"."
            }]
        }]
    },
    "visualResponse": {}
}

Google 支持部门通知我,我确实在使用 V2 版本 - 我是在 2017 年 12 月开始的 - 早在 2017 年 5 月“截止日期”之后,V2 应该是默认版本。

这是 Google 的错误吗?我是否错过了一些设置我的意图的东西?或者是否有其他设置可能导致此问题?

我看到 DialogFlow 论坛中的其他帖子显示了同样的问题。

感谢任何帮助。

于 2018 年 1 月 9 日添加: 调试选项卡的内容:

{
  "agentToAssistantDebug": {
    "agentToAssistantJson": {
      "message": "Unexpected apiai response format: Empty speech response",
      "apiResponse": {
        "id": "64a900d2-23e8-4833-b9de-0b207f63bffc",
        "timestamp": "2018-01-08T21:08:36.821Z",
        "lang": "en-us",
        "result": {},
        "status": {
          "code": 200,
          "errorType": "success"
        },
        "sessionId": "1515445716570"
      }
    }
  },
  "assistantToAgentDebug": {
    "assistantToAgentJson": {
      "user": {
        "userId": "ABwppHFGoTJm5fKpau6WWwufKQE5UwkebooowZF7YhvD7PPY-hUfxU2_KRpB0LLNcLPyXasbXnRxXT6fniKk",
        "locale": "en-US",
        "lastSeen": "2018-01-05T15:53:11Z"
      },
      "conversation": {
        "conversationId": "1515445716570",
        "type": "NEW"
      },
      "inputs": [
        {
          "intent": "actions.intent.MAIN",
          "rawInputs": [
            {
              "inputType": "VOICE",
              "query": "talk to connect the docs"
            }
          ]
        }
      ],
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          }
        ]
      },
      "isInSandbox": true,
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            }
          ]
        }
      ]
    },
    "curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=0ffc8bcf72704850a4b4139d49a8d72e' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjBhYTQ1NDFlNGM4ZWVhODQ0NjhmZTYxYTkzZmIxYzA2MzJkYjVhMGYifQ.eyJhdWQiOiJhY3RpdmUtZG9jdW1lbnQiLCJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJqdGkiOiIwY2U2OTdlNmE3NGFiZmVmZTdiYzhmMGU2ZGJlMzEyMDFjOWU3MzA5IiwiaWF0IjoxNTE1NDQ1NzE2LCJleHAiOjE1MTU0NDU4MzYsIm5iZiI6MTUxNTQ0NTQxNn0.hZNpVrH4o8ObGIvZ7BQV44nymekTWR_K4_jsDKCzgj74z57IDyUXNGEZs6KUFxBM_2FXiSoOxJUQZ1OhDRpkpQ6L4LELYN_JDhly7kgy-SLgKgLG6FZ4YV-8qOgr9Uxmr9SsG6NSXdiG7HvTrHLXIwA8K2siBNGGDWAIB691gAC8qsjsq4d3VnHMTeqlJ6mDoOtZ2xdLnJbK5B-OK-rLHEhX6K1-Z7rXQL3OgSwUtRVvYfHI3jqY83Xn3-uf06izkQhwVqH-W6X1REltrlxFTPW2h72D-st-QQ9euIpK3fn0x-z3ouQ17g-rGrPjKcOop9FejtKMT1tibxSkQ7qywQ'  -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"ABwppHFGoTJm5fKpau6WWwufKQE5UwkebooowZF7YhvD7PPY-hUfxU2_KRpB0LLNcLPyXasbXnRxXT6fniKk\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-05T15:53:11Z\"},\"conversation\":{\"conversationId\":\"1515445716570\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"talk to connect the docs\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
  },
  "sharedDebugInfo": [
    {
      "name": "ResponseValidation",
      "subDebugEntry": [
        {
          "debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
          "name": "UnparseableJsonResponse"
        }
      ]
    }
  ]
}

验证错误选项卡的内容: UnparseableJsonResponse API 版本 2:无法解析 JSON 响应字符串 “INVALID_ARGUMENT”错误:“:找不到字段。”。

2018 年 1 月 10 日添加的欢迎意图屏幕截图:

【问题讨论】:

  • 能否也包括调试选项卡的内容? (如果有 Validation 选项卡,还有那些内容?)
  • 我按要求添加了调试和验证错误的内容。
  • 非常有用!您能否还包括您认为应该处理此问题的 Dialogflow Intent 的完整屏幕截图?
  • 我想这是 input_welcome 意图 - 正如我在初始化 DialogFlow 时由 Google 提供的,但我没有触及。我的履行 webhook 日志显示没有访问尝试。
  • 默认的欢迎意图不会尝试使用 webhook,这也是我要求查看整个内容的部分原因。

标签: simulator actions-on-google dialogflow-es


【解决方案1】:

问题是两件事的结合:

  1. 响应部分中没有设置文本回复。

  2. 当 Intent 被触发时,它不会被发送到 webhook。

因此,Dialogflow 回复助手时没有文本响应,这是一个错误。

您可以通过确保您的欢迎意图执行以下操作之一来纠正此问题(您不必同时执行这两项操作):

  1. 设置一个或多个文本回复。这些将在 Intent 被调用时被发回。

  2. 选中 Fulfillment 下的 Use webhook 框。当 Intent 被触发时,这将调用您的 webhook。 (然后确保您的 webhook 返回有效响应。)

正如您在 cmets 中推测的那样,您还可以将 Welcome Intent 更改为您已经测试响应的其他 Intent 之一。这个特定的 Welcome Intent 没有什么特别之处 - 它只是默认为您创建的。

【讨论】:

  • 太棒了!感谢您的回答,也感谢您致力于解决我的问题的时间。模拟器不再给我那个错误 - 我非常感激。现在,如果只有谷歌会强调这可能是错误的来源 - 并让这个警告突出并且容易找到,事情会进展得更快。谢谢!
  • 很高兴我们知道了!感谢您在我们努力的时候坚持我。我知道我的一些要求当时看起来很奇怪,但老实说,这可能是很多事情,我们需要努力解决这些选项。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-04-06
  • 2018-10-22
  • 2021-05-24
  • 2021-09-19
  • 1970-01-01
  • 1970-01-01
  • 2012-12-09
相关资源
最近更新 更多