简体   繁体   中英

Can't trigger custom actions on google assistant sdk

After following all the steps given in - https://developers.google.com/assistant/sdk/guides/service/python/ , I was able to set up the Google assistant SDK and could run the sample Blinking LED code. However, when I tried to add my own custom action, Assistant could not detect the query I wanted it to recognize. Below is the code I used. What am I missing?

{
"manifest": {
    "displayName": "Start Something",
    "invocationName": "Start Something",
    "category": "PRODUCTIVITY"
},
"actions": [
    {
        "name": "com.example.actions.StartSomething",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.StartSomething",
            "parameters": [
                {
                    "name": "actname",
                    "type" : "SchemaOrg_Text"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "start ($SchemaOrg_Text:actname)?",
                    "start this ($SchemaOrg_Text:actname)? online"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Starting $actname online"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.StartSomething",
                                "params": {
                                    "testname": "$actname"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
    {
        "name": "$actname",
        "entities": [
            {
                "key": "games",
                "synonyms": [
                    "fun",
                    "time killer"
                ]
            }
        ]
    }
]

}

The issue is that you're stating that actname is a text schema type, which isn't supported in the triggering. You'd need to instead use a separate type, which you do declare at the bottom. You should change the type of your parameters, like in the documented example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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