首页 文章

使用Alexa Simulator时,请求的技能响应存在问题但与Manual JSON一起使用

提问于
浏览
0

我对新创建的alexa技能有一些问题 .

在Alexa Simulator的文本框中键入请求始终返回“请求的技能响应存在问题” . 随着输出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
  }
}

知道问题可能是什么感谢 .

1 回答

  • 1

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

    从您的技能的Alexa开发人员控制台,导航到 Interfaces 并确保启用 Display Interface .

相关问题