模拟器错误UnparseableJsonResponse(“找不到字段”。) [英] Simulator error UnparseableJsonResponse ("Cannot find field.")

查看:102
本文介绍了模拟器错误UnparseableJsonResponse(“找不到字段”。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


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


NB !!!
首先要注意的是,它引用的是 API版本2。



没有请求到达我的Webhook,因此似乎所有内容都在其中Google。



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



从模拟器中请求网址:

解决方案

问题是两个问题的组合:


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


  2. 触发Intent时,不会将其发送到Webhook。


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



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


  1. 设置一个或多个文本回复。


  2. 选中实现下的使用网络挂钩框,将这些信息发送回去。 。触发Intent时,这将称为您的Webhook。 (然后确保您的webhook返回有效的响应。)


正如您在评论中推测的那样,您可以还将欢迎意图更改为已测试可以响应的其他其他意图。这种特殊的欢迎意图没有什么特别的-它只是默认情况下为您创建的。


I have successfully tested the first few intents of my app with my webhook in the DialogFlow console, but testing in the Simulator gives the following error:

UnparseableJsonResponse API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find field.".

NB!!! The first thing to notice is that it refers to "API Version 2".

No requests are reaching my webhook - so it appears that this is all within Google.

Using Chrome Developer Tools, I see the Network entry that gets this error response - some details below:

Request url from Simulator: https://assistant.clients6.google.com/v1/assistant:converse?alt=json&key=A.....

NB!!! (Note it says 'v1')

Request Payload:

{"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:

{
    "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": {}
}

I have been informed by Google Support that I am indeed using version V2 - I initiated this in December 2017 - long after the May 2017 "cutoff date" where V2 is supposed to be the default.

Is this a Google bug? Have I missed something setting up my intents? Or is there another setting that may be causing this?

I see that other posts in the DialogFlow forum show the same problem.

Any help is appreciated.

Added on 1/9/2018: Contents of the Debug Tab:

{
  "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"
        }
      ]
    }
  ]
}

Contents of the Validation Errors Tab: UnparseableJsonResponse API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find field.".

Screenshot of welcome intent added 1/10/2018:

解决方案

The problem is a combination of two things:

  1. There are no text replies set in the Response section.

  2. When the Intent is triggered, it does not get sent to a webhook.

As a result, Dialogflow replies to the Assistant with no text response, which is an error.

You can correct this by making sure your welcome intent does one of the following (you don't have to do both):

  1. Set one or more text replies. These would be sent back when the Intent is called.

  2. Check the Use webhook box under Fulfillment. This would call your webhook when the Intent is triggered. (And then make sure that your webhook returns a valid response.)

As you speculated in your comments, you could also change the Welcome Intent to one of your other Intents that you've already tested to respond. There is nothing special about this particular Welcome Intent - it was just the one created by default for you.

这篇关于模拟器错误UnparseableJsonResponse(“找不到字段”。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆