无法使用两个以上的操作包来创建多个自定义操作

时间:2018-05-14 13:33:52

标签: action package.json google-assistant-sdk

我关注此链接: https://developers.google.com/assistant/sdk/guides/service/python/extend/custom-actions

我成功创建了三个动作文件。它可以单独工作。但是当我一起测试时,比如部署三个动作包:

./gactions update --action_package MqttAct.json --action_package action.json --action_package MesureTemp.json --project rpi3-0001-ga-******

我发现只有两个包可以使用。这就像我们不能拥有两个以上的行动方案?

1 个答案:

答案 0 :(得分:0)

我很惊讶您甚至可以同时部署两个软件包。这个想法是你有一个动作包,它可以包含合并在一起的各种动作。

以下是基于the documentation的合并操作包:

{
"manifest": {
    "displayName": "Blinky light",
    "invocationName": "Blinky light",
    "category": "PRODUCTIVITY"
},
"actions": [
    {
        "name": "com.example.actions.BlinkLight",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.BlinkLight",
            "parameters": [
                {
                    "name": "number",
                    "type": "SchemaOrg_Number"
                },
                {
                    "name": "speed",
                    "type": "Speed"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "blink ($Speed:speed)? $SchemaOrg_Number:number times",
                    "blink $SchemaOrg_Number:number times ($Speed:speed)?"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Blinking $number times"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.BlinkLight",
                                "params": {
                                    "speed": "$speed",
                                    "number": "$number"
                                }
                            }
                        }
                    ]
                }
            }
        }
    },
   {
        "name": "com.example.actions.BlonkLight",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.BlonkLight",
            "parameters": [
                {
                    "name": "number",
                    "type": "SchemaOrg_Number"
                },
                {
                    "name": "speed",
                    "type": "Speed"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "blonk ($Speed:speed)? $SchemaOrg_Number:number times",
                    "blonk $SchemaOrg_Number:number times ($Speed:speed)?"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Blonking $number times"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.BlonkLight",
                                "params": {
                                    "speed": "$speed",
                                    "number": "$number"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
    {
        "name": "$Speed",
        "entities": [
            {
                "key": "slowly",
                "synonyms": [
                    "slowly",
                    "slow"
                ]
            },
            {
                "key": "normally",
                "synonyms": [
                    "normally",
                    "regular"
                ]
            },
            {
                "key": "quickly",
                "synonyms": [
                    "quickly",
                    "fast",
                    "quick"
                ]
            }
        ]
    }
]
}