【问题标题】:Failed to parse SDKResponse from http_response无法解析来自 http_response 的 SDKResponse
【发布时间】:2016-12-12 01:33:19
【问题描述】:

我实现了一个 webhook 以符合 Actions on 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!\"}}}'

【问题讨论】:

    标签: actions-on-google


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2019-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多