通过 API 上传 Alexa 插槽类型

Upload Alexa Slot Types via API

是否可以通过 API 上传 Custom Slot Types 值,这样您就不需要使用新的 [=] 手动输入它们19=]Alexa Skill Builder 界面(如果你有很多):

我什么都没找到。

好像没有(搜索之后)。此处记录了亚马逊的功能请求:

https://forums.developer.amazon.com/questions/9640/api-to-upload-intent-schema-and-sample-utterances.html#answer-77902

正如其他答案所建议的那样,您可以使用 SMAPI。

或者,您可以select左侧的“代码编辑器”选项卡和drag/drop或copy/paste您的架构json代码。

https://github.com/williamwdu/Alexa-Custom-Slot-Generator

我写这篇文章是为了将 csv/excel 格式转换为 JSON 格式,以便您可以将其粘贴到代码编辑器中。

如果您有任何问题,请告诉我。

代码没有README因为我这几天没时间

是的,您可以通过 SMAPI API/CLI 执行此操作。查看 https://developer.amazon.com/docs/smapi/ask-cli-intro.html 以获得完整的详细信息 - 它允许通过 JSON 进行完整的模型编辑。

我的建议是先通过 SMAPI 获取模型,使用新值编辑 json 文件,然后再次通过 SMAPI 更新它。

ask api get-model -s "enter your skill id here" --stage development -l en-US > model.json

在 model.json 文件中您可以看到插槽定义。更改它(使用脚本或手动)并再次更新模型

对两个命令的引用:

在"Intents"和"Slot"下方的左侧栏中是选项"JSON Editor"。您可以在此处为要添加的新意图编写 JSON。

无广告位类型的示例

    {
      "name":"YesIntent",
      "samples":[
          "Yes",
          "Yeah",
          "I do",
          "I am"
      ]
    }

广告位类型示例

    {
      "name":"NumberIntent",
      "slots":[
          {
            "name":"number",
            "type":"AMAZON.NUMBER"
          }
      ],
      "samples":[
          "{number} is my number",
          "{number}",
          "my number is {number}"
      ]
    }