无法从http_response解析SDKResponse

时间:2016-12-12 01:33:20

标签: actions-on-google

我实施了一个webhook以符合Google Conversation Protocol上的操作。但是,当我通过Web Simulator模拟交互时,我收到以下错误:

{
    "response": “action name isn’t responding right now. Try again soon.\n",
    "audioResponse": "...",
    "debugInfo": {
        "sharedDebugInfo": [
            {
                "name": "ExecutionResponse",
                "debugInfo": "Failed to parse SDKResponse from http_response: 'HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nDate: Sun, 11 Dec 2016 22:54:50 GMT\r\nServer: Server-Software/1.0\r\nGoogle-Assistant-API-Version: v1\r\nVary: Accept-Encoding\r\nContent-Encoding: gzip\r\nX-Cache: Miss from CDN\r\nVia: 1.1 cdn.example.net (CDN)\r\n\r\n{\"conversation_token\":null,\"expect_user_response\":false,\"expected_inputs\":[],\"final_response\":{\"speech_response\":{\"ssml\":null,\"text_to_speech\":\"Hello!\"}}}'"
            }
        ]
    }
}

debugInfo字段内的块是:

Failed to parse SDKResponse from http_response: 'HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Date: Sun, 11 Dec 2016 22:54:50 GMT
Server: Server-Software/1.0
Google-Assistant-API-Version: v1
Vary: Accept-Encoding
Content-Encoding: gzip
X-Cache: Miss from CDN
Via: 1.1 cdn.example.net (CDN)

{\"conversation_token\":null,\"expect_user_response\":false,\"expected_inputs\":[],\"final_response\":{\"speech_response\":{\"ssml\":null,\"text_to_speech\":\"Hello!\"}}}'

1 个答案:

答案 0 :(得分:0)

应排除具有null值或空数组的字段。例如,由于expect_user_response为false,因此输出中不应出现expected_inputs字段。请改用以下内容:

{
  "expect_user_response": false,
  "final_response": {
    "speech_response": {
      "text_to_speech": "Hello!"
    }
  }
}