我有一个插入后端和DialogFlow / ApiAI的聊天机器人。我正在尝试在Alexa中设置一项技能,这样我就能抓住所有与我的技能相关的技能,然后将其转发到我的后端,以便我可以使用我现有的基础设施和convo设计。
我一直在努力与Alexa建立一个抓住一切并转发它的意图。根据我的理解,你应该使用AMAZON.SearchQuery,但是当我尝试设置intent时我收到以下错误:
构建失败的示例话语“CATCH_ALL {any}”在意图“CATCH_ALL”中必须包含载波短语。具有短语类型的示例意图话语不能仅包含插槽。错误代码:MissingCarrierPhraseWithPhraseSlot -
有谁知道怎么做?我也尝试使用AMAZON.Literal,但它似乎已被弃用,我使用它时无法构建技能。我有点卡住了。如果有人有解决方案会很棒......
谢谢。
我最终通过做这样的事情来做到这一点:
{
"interactionModel": {
"languageModel": {
"invocationName": "test",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "CATCHALL",
"slots": [
{
"name": "any",
"type": "AMAZON.LITERAL"
}
],
"samples": [
"{hey|any}",
"{hey hey|any}",
"{hey hey hey|any}",
"{hey hey hey hey|any}",
"{hey hey hey hey hey|any}"
]
}
],
"types": []
}
}
}
意图CATCHALL的样本表示您要捕获的单词数。所以,我会抓住一个和这五个字之间的任何句子。
不过,当我提交应用程序时,我不确定这是否会成为一个问题。
请注意,除英语(美国)之外的任何语言都不支持AMAZON.LITERAL,因此这不是我的解决方案,因为它是法语和英语聊天机器人。所以我一开始就回来了......
编辑:这是没有LITERAL的解决方案:
{
"interactionModel": {
"languageModel": {
"invocationName": "mon invocation",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": [
"que puis-je faire"
]
},
{
"name": "AMAZON.StopIntent",
"samples": [
"je veux quitter"
]
},
{
"name": "CATCH_ALL",
"slots": [
{
"name": "any",
"type": "ANYTHING"
}
],
"samples": [
"{any}"
]
}
],
"types": [
{
"name": "ANYTHING",
"values": [
{
"name": {
"value": "hey"
}
},
{
"name": {
"value": "hey hey"
}
},
{
"name": {
"value": "hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey hey hey hey hey"
}
},
{
"name": {
"value": "hey hey hey hey hey hey hey hey hey hey hey hey"
}
}
]
}
]
}
}
}
不幸的是,目前还没有解决方案。 Alexa不支持以您希望的方式获取所有文本的方法。
您可以使用一些随机单词创建自定义插槽。
{
"interactionModel": {
"languageModel": {
"invocationName": "demo",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "EveryThingIntent",
"slots": [
{
"name": "EveryThingSlot",
"type": "BAG_OF_WORDS"
}
],
"samples": [
"{EveryThingSlot} "
]
}
],
"types": [
{
"name": "BAG_OF_WORDS",
"values": [
{
"name": {
"value": "Hello World"
}
}
]
}
]
}
}
}
您可以使用AMAZON.Person替换AMAZON.SearchQuery。通常AMAZON.SearchQuery需要一个短语和slot.Using AMAZON.Person不需要短语和插槽。它将接受您传递给Intent的任何值。
{
"name": "CATCH_ALL",
"slots": [
{
"name": "any",
"type": "AMAZON.Person"
}
],
"samples": [
"{any}"
]
}