繁体   English   中英

Google Assistant SDK中的多个参数

[英]Multiple parameters in Google Assistant SDK

这是对此的后续问题。 我想在我的助手命令中使用2个参数。 当我仅将1个参数用于命令时,代码可以完美地工作。 但是,当我向查询模式添加第二个参数时,从未检测到该模式。 我在下面粘贴了动作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" : "TestSchema"
                },
                {
                  "name": "machinename",
                  "type" : "MachineSchema"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "prepare ($TestSchema:testname) on ($MachineSchema:machinename)",
                    "start ($TestSchema:testname) on ($MachineSchema:machinename)",
                    "launch ($TestSchema:testname) on ($MachineSchema:machinename)"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Preparing to start test $testname on $machinename"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.StartTest",
                                "params": {
                                    "testname": "$testname",
                                    "machinename": "$machinename"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
{
  "name": "$TestSchema",
  "entities": [
    {
      "key": "BURN IN",
      "synonyms": [
        "burnin",
        "burn in",
        "burning",
        "button"
      ]
    },
    {
        "key": "WINTHRAX",
        "synonyms": [
          "when thanks",
          "print tracks",
          "fintrax",
          "win tracks",
          "winter sucks"
        ]
    },
    {
        "key": "REBOOTER",
        "synonyms": [
          "reporter",
          "repeat here",
          "reboot"
        ]
    },
    {
        "key": "SLEEPER",
        "synonyms": [
          "sleeper",
          "sleep here",
          "slipper"
        ]
    },
    {
        "key": "IOMONKEY",
        "synonyms": [
          "are you monkey",
          "I O monkey",
          "I am monkey"
        ]
    },
    {
        "key": "DISKERCISE",
        "synonyms": [
          "discus size",
          "discuss I",
          "Tisca size",
          "Kiska size",
          "discuss Eyes"
        ]
    },
    {
        "key": "MFCJUNI",
        "synonyms": [
          "M F C Juni",
          "MFC tunie",
          "MFC  tune",
          "MFC  Tu Ne"

        ]
    },
    {
        "key": "SD STRESS",
        "synonyms": [
          "S D Stress",
          "H D Stress",
          "SD stress",
          "HD stress",
          "is distress",
          "s distress",
          "sdstress",
          "SPSS",
          "has De stress",
          "FB status",
          "HD stores",
          "St stress"
        ]
    },
    {
        "key": "POUNDIT",
        "synonyms": [
          "pound it",
          "pundit",
          "found it",
          "foundit",
          "pound rate",
          "founded"
        ]
    }
  ]
},
{
  "name": "$MachineSchema",
  "entities":[
    {
      "key": "HP LANE",
      "synonyms": [
        "HP lane",
        "hp lane",
        "hp line",
        "h plane",
        "hplane",
        "hp name",
        "HP rain",
        "hp rain",
        "HP name"
      ]
    },
    {
      "key": "TPC-1001",
      "synonyms": [
        "tpc1001",
        "tpc one thousand one",
        "tpc 1001",
        "tpc one thousand 1"
      ]
    },
    {
      "key": "TPC-1002",
      "synonyms": [
        "tpc1002",
        "tpc one thousand two",
        "tpc 1002",
        "tpc one thousand 2"
      ]
    },
    {
      "key": "TPC-1003",
      "synonyms": [
        "tpc1003",
        "tpc one thousand three",
        "tpc 1003",
        "tpc one thousand 3"
      ]
    }
  ]
}

]}

(摘录自评论,以提高知名度)

您是否需要括号中的参数? 不带括号或添加会很好 最后将使其成为通配符。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM