亚马逊alexa开发无效的意图示例短语插槽问题

问题描述 投票:0回答:2

我收到一个错误:不能同时包含一个短语槽和另一个意图槽。错误代码:构建Alexa技能时的InvalidIntentSamplePhraseSlot。

示例JSON如下,

{
"name": "HackathonListIntent",
"slots": [
    {
        "name": "resultCount",
        "type": "AMAZON.NUMBER"
    },
    {
        "name": "search1",
        "type": "AMAZON.SearchQuery"
    },
    {
        "name": "search2",
        "type": "AMAZON.SearchQuery"
    }
],
"samples": [
    "{resultCount} for {search1} from {search2}",
]}

resultCount:技能从后端获取数千个结果此参数将根据用户的方便限制结果长度。

search1和search2是用户可能会问的不同的独立搜索参数。

仅供参考:我尝试过this

amazon alexa alexa-skills-kit alexa-slot
2个回答
0
投票

对于InvalidIntentSamplePhraseSlot问题,根据亚马逊的文档,每个意图只能使用一个AMAZON.SearchQuery插槽。

“确保你的技能每个意图使用不超过一个AMAZON.SearchQuery插槽。”

https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#amazonsearchquery

此外,对于您的样本条目,请确保包含一个项目的数组不包含逗号。它将导致无效的JSON错误。

"samples": [
    "{resultCount} for {search1} from {search2}"
]}

0
投票

AMAZON.SearchQuery每个意图限制为1个插槽,并且还需要一个短语和插槽。我建议你使用AMAZON.Person,因为它可以采取任何价值和剂量不需要短语。

              {
                "name": "HackathonListIntent",
                "slots": [
                    {
                        "name": "resultCount",
                        "type": "AMAZON.NUMBER" 
                    },
                    {
                        "name": "search2",
                        "type": "AMAZON.Person"
                    },
                    {
                        "name": "search2",
                        "type": "AMAZON.Person"
                    }
                ],
                "samples": [
                    "{resultCount} for {search1} from {search2}"
                ]
            }
© www.soinside.com 2019 - 2024. All rights reserved.