在Google Assistant SDK中,如何将默认的内置意图更改为我们自己的自定义意图

时间:2018-12-26 12:22:04

标签: voice-recognition google-assistant-sdk

如何将此默认内置意图“意图”:“ action.devices.EXECUTE”更改为我们自己的自定义意图,例如“意图”:“ com.devices.xyzz”? 为了获得特质的自定义意图,需要进行哪些更改。 下面是actions.json数据

  "actions": [
  {
    "name": "com.webos.actions.contentIntextManager",
    "availability": {
      "deviceClasses": [
        {
          "assistantSdkDevice": {}
        }
      ]
    },

    "intent": {
      "name": "com.webos.intents.contentIntextManager", 
      "parameters": [
        {
          "name": "number",
          "type": "SchemaOrg_Number"
        },
        {
          "name": "speed",
          "type": "Speed"
        }
      ],

      "trigger": { 
        "queryPatterns": [
          "run ($Speed:speed)? $SchemaOrg_Number:number times",
          "run $SchemaOrg_Number:number times ($Speed:speed)?"
        ]
      }
    },

    "fulfillment": {
      "staticFulfillment": {
        "templatedResponse": {
          "items": [
            {            
              "simpleResponse": {
                "textToSpeech": "Google Chrome run $number 
    times $speed than Mozilla Firefox"
              }
            },
            {   
              "deviceExecution": {
                "command": "com.webos.commands.contentIntextManager",
                "params": {
                  "speed": "$speed",
                  "number": "$number"
                }
              }
            }
          ]
        }
      }
    }

**Here is the response:OUTPUT**
    {
"provider": "googleassistant",
"response": {
    "deviceAction": {
        "requestId": "5c31721f-0000-2413-8295-f403043942f4",
        "inputs": [
            {
                "intent": "action.devices.EXECUTE",
                "payload": {
                    "commands": [
                        {
                            "execution": [
                                {
                                    "command": "com.webos.commands.Launch",
                                    "params": {
                                        "appName": "YOUTUBE",
                                        "launchParam": "",
                                        "appAction": ""
                                    }
                                }
                            ],
                            "devices": [
                                {
                                    "id": "my_webos"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

}     {     “ provider”:“ googleassistant”,     “响应”:{         “ displayText”:“好”      }     }

0 个答案:

没有答案