【问题标题】:There was a issue with the requested skill's response when using Alexa Simulator but works with Manual JSON使用 Alexa 模拟器但使用手动 JSON 时,请求的技能响应存在问题
【发布时间】:2018-11-08 22:53:00
【问题描述】:

我在使用新创建的 alexa 技能时遇到了一些问题。

在 Alexa 模拟器的文本框中键入请求总是返回“请求的技能响应有问题”。使用下面的输出 JSON。

{
  "body":{
    "version":"1.0",
    "response":{
      "outputSpeech":{
        "type":"PlainText",
        "text":"Hello i am here"
      },
      "card":{
        "type":"Simple",
        "title":"Welcome",
        "content":"Hello i am here"
      },
      "directives":[
        {
          "type":"Display.RenderTemplate",
          "template":{
            "type":"BodyTemplate2",
            "token":"",
            "backgroundImage":{
              "contentDescription":"Description for the background image",
              "sources":[
                {
                  "url":"URL for the background image - must be secure (https)",
                  "size":"x-small",
                  "widthPixels":0,
                  "heightPixels":0
                }
              ]
            },
            "image":{
              "contentDescription":"Description for the main image",
              "sources":[
                {
                  "url":"URL for the main image - must be secure (https)",
                  "size":"x-small",
                  "widthPixels":0,
                  "heightPixels":0
                }
              ]
            },
            "title":"Welcome",
            "textContent":{
              "primaryText":{
                "type":"RichText",
                "text":"Welcome"
              },
              "secondaryText":{
                "type":"RichText",
                "text":"Hello i am here"
              }
            },
            "backButton":"HIDDEN"
          }
        }
      ],
      "shouldEndSession":false
    },
    "sessionAttributes":{

    }
  }
}

但是,当我从请求中复制 JSON 输入并使用用户手册 JSON 进行测试时,它运行良好,但返回的 JSON 格式略有不同

{
  "status":"SUCCESSFUL",
  "result":{
    "skillExecutionInfo":{
      "invocationRequest":{
        "endpoint":"url here",
        "body":{
          "version":"1.0",
          "session":{
            "new":true,
            "sessionId":"amzn1.echo-api.session.b62b79ba-1dde-4b22-9bf5-492943a008bc",
            "application":{
              "applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
            },
            "user":{
              "userId":"amzn1.ask.account."
            }
          },
          "context":{
            "AudioPlayer":{
              "playerActivity":"IDLE"
            },
            "Display":{

            },
            "System":{
              "application":{
                "applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
              },
              "user":{
                "userId":"amzn1.ask.account."
              },
              "device":{
                "deviceId":"amzn1.ask.device.",
                "supportedInterfaces":{
                  "AudioPlayer":{

                  },
                  "Display":{
                    "templateVersion":"1.0",
                    "markupVersion":"1.0"
                  }
                }
              },
              "apiEndpoint":"https://api.amazonalexa.com",
              "apiAccessToken":"eyJ0eXAiOiJKV1"
            }
          },
          "request":{
            "type":"LaunchRequest",
            "requestId":"amzn1.echo-api.request.",
            "timestamp":"2018-02-05T11:35:53Z",
            "locale":"en-GB"
          }
        }
      },
      "invocationResponse":{
        "body":{
          "response":{
            "card":{
              "type":"Simple",
              "title":"Welcome",
              "content":"Hello i am here"
            },
            "directives":[
              {
                "template":{
                  "type":"BodyTemplate2",
                  "token":"",
                  "title":"Welcome",
                  "textContent":{
                    "primaryText":{
                      "type":"RichText",
                      "text":"Welcome"
                    },
                    "secondaryText":{
                      "type":"RichText",
                      "text":"Hello i am here"
                    }
                  },
                  "backButton":"HIDDEN",
                  "backgroundImage":{
                    "contentDescription":"Description for the background image",
                    "sources":[
                      {
                        "url":"URL for the background image - must be secure (https)",
                        "size":"X_SMALL",
                        "widthPixels":0,
                        "heightPixels":0
                      }
                    ]
                  },
                  "image":{
                    "contentDescription":"Description for the main image",
                    "sources":[
                      {
                        "url":"URL for the main image - must be secure (https)",
                        "size":"X_SMALL",
                        "widthPixels":0,
                        "heightPixels":0
                      }
                    ]
                  }
                },
                "type":"Display.RenderTemplate"
              }
            ],
            "outputSpeech":{
              "type":"PlainText",
              "text":"Hello i am here"
            },
            "shouldEndSession":false
          },
          "sessionAttributes":{

          },
          "version":"1.0"
        }
      },
      "metrics":{
        "skillExecutionTimeInMilliseconds":254
      }
    },
    "error":null
  }
}

知道问题出在哪里,谢谢。

【问题讨论】:

  • 从 cloudwatch 捕获日志并在您的问题中更新...我在您的第二个 json 中看到 null 但详细日志会告诉根本原因

标签: alexa alexa-skills-kit alexa-skill alexa-voice-service


【解决方案1】:

对于遇到此问题并遇到相同问题的任何人。如果响应包含 Display.RenderTemplate 指令,请确保在 Alexa 开发者控制台上启用了显示界面。

在您的技能上,从 Alexa 开发者控制台导航到 Interfaces 并确保 Display Interface 已启用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 1970-01-01
    • 2019-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    相关资源
    最近更新 更多