为什么从 Dialogflow 迁移时 Alexa SDK 会抛出错误

Why does Alexa SDK throw an error when migrating from Dialogflow

我正在尝试从 Dialogflow 迁移我的操作,最重要的是意图模式。但是上传.json文件后,报错Intent name must not be empty. Error code: MissingIntentName。这是意图 schema.json

 {
"intents": [
{
  "intent": "SelectedSubjectsYes"
},
{
  "intent": "UserIsOk",
  "slots": [
    {
      "name": "okslot",
      "type": "OK"
    }
  ]
},
{
  "intent": "SelectedSubjectsNo"
},
{
  "intent": "UserIsNotOk",
  "slots": [
    {
      "name": "not_okslot",
      "type": "NOT_OK"
    }
  ]
},
{
  "intent": "DefaultWelcomeIntent"
},
{
  "intent": "HowAreYou?"
},
{
  "intent": "SelectedSubjects",
  "slots": [
    {
      "name": "subjectslot",
      "type": "SUBJECT"
    }
  ]
}
]
}

我从来没有编辑过它,所以为什么会出错?提前致谢。

交互模型的 JSON 结构略有不同。这就是现在的样子。

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "Your invocation name",
            "intents": [
                {
                    "name": "SelectedSubjectsYes",
                    "slots": [],
                    "samples": [
                        "provide sample for SelectedSubjectsYes intent",
                        "sample for SelectedSubjectsYes intent"
                    ]
                },
                {
                    "name": "UserIsOk",
                    "slots": [
                        {
                            "name": "okslot",
                            "type": "OK"
                        }
                    ],
                    "samples": [
                        "provide other samples for UserIsOk",
                        "I'm {okslot}",
                        "{okslot}"
                    ]
                },
                {
                    "name": "SelectedSubjectsNo",
                    "slots": [],
                    "samples": [
                        "provide sample for SelectedSubjectsNo intent",
                        "sample for SelectedSubjectsNo intent"
                    ]
                },
                {
                    "name": "UserIsNotOk",
                    "slots": [
                        {
                            "name": "not_okslot",
                            "type": "NOT_OK"
                        }
                    ],
                    "samples": [
                        "provide other samples for UserIsNotOk",
                        "i'm {not_okslot}",
                        "{not_okslot}"
                    ]
                },
                {
                    "name": "HowAreYou?",
                    "slots": [],
                    "samples": [
                        "provide sample for HowAreYou intent",
                        "sample for HowAreYou intent"
                    ]
                },
                {
                    "name": "SelectedSubjects",
                    "slots": [
                        {
                            "name": "subjectslot",
                            "type": "SUBJECT"
                        }
                    ],
                    "samples": [
                        "provide other samples for SelectedSubjects",
                        "i choose {subjectslot}"
                    ]
                }
            ],
            "types": [
                {
                    "name": "OK",
                    "values": [
                        {
                            "name": {
                                "value": "ok"
                            }
                        },
                        {
                            "name": {
                                "value": "yes"
                            }
                        }
                    ]
                },
                {
                    "name": "NOT_OK",
                    "values": [
                        {
                            "name": {
                                "value": "not ok"
                            }
                        },
                        {
                            "name": {
                                "value": "nope"
                            }
                        }
                    ]
                },
                {
                    "name": "SUBJECT",
                    "values": [
                        {
                            "name": {
                                "value": "Physics"
                            }
                        },
                        {
                            "name": {
                                "value": "Biology"
                            }
                        }
                    ]
                }
            ]
        }
    }
}

无需从对话流转换,在 Alexa skill builder 中设计一个非常容易。此外,建议使用预定义的 AMAZON.YesIntentAMAZON.NoIntent 用于 "yes""no"话语。