Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json Google Assistant SDK中的多个命令_Json_Google Assistant Sdk - Fatal编程技术网

Json Google Assistant SDK中的多个命令

Json Google Assistant SDK中的多个命令,json,google-assistant-sdk,Json,Google Assistant Sdk,我计划使用Google Assistant SDK实现2个自定义命令,并对actions.json文件(见下文)进行了相应更改。然而,不知何故,一次只触发一个命令,即随机启动或选择命令。如何使其触发这两个命令 { "manifest": { "displayName": "Start Test", "invocationName": "Start Test", "category": "PRODUCTIVITY" }, "actions": [ {

我计划使用Google Assistant SDK实现2个自定义命令,并对actions.json文件(见下文)进行了相应更改。然而,不知何故,一次只触发一个命令,即随机启动或选择命令。如何使其触发这两个命令

{
 "manifest": {
    "displayName": "Start Test",
    "invocationName": "Start Test",
    "category": "PRODUCTIVITY"
},
"actions": [
    {
        "name": "com.example.actions.StartTest",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.StartTest",
            "parameters": [
                {
                    "name": "testname",
                    "type" : "SchemaOrg_Number"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "prepare test ($SchemaOrg_Number:testname)"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Preparing to start test $testname"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.StartTest",
                                "params": {
                                    "testname": "$testname"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
    {
        "name": "$testname",
        "entities": [
            {
                "key": "5",
                "synonyms": [
                    "Test5"
                ]
            }
        ]
    }
],

"manifest": {
    "displayName": "Select Lane",
    "invocationName": "Select Lane",
    "category": "PRODUCTIVITY"
},
"actions": [
    {
        "name": "com.example.actions.SelectLane",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.SelectLane",
            "parameters": [
                {
                    "name": "lanename",
                    "type" : "SchemaOrg_Number"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "select lane ($SchemaOrg_Number:lanename)"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Selected lane $lanename"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.SelectLane",
                                "params": {
                                    "lanename": "$lanename"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
    {
        "name": "$lanename",
        "entities": [
            {
                "key": "5",
                "synonyms": [
                    "Lane5"
                ]
            }
        ]
    }
]

}

您应该合并两个
操作
阵列。该文件是一组键值,因此重复的键值意味着该值将替换上一个键值:

"actions": [
  {
     "name": "com.example.action",
     // ...
  },
  {
     "name": "com.example.bction",
     // ...
  }
]
您应该对类型执行相同的操作:

"types": [
  {
    "name": "$type",
    // ...
  },
  {
    "name": "$bype"
  }
]

在助理服务器端更改和更新actions.json文件需要一段时间吗?一旦运行
gactions test…
它应该立即更新