无法在google assistant sdk上触发自定义操作

时间:2018-05-14 08:31:19

标签: python json sdk google-assistant-sdk

按照 - https://developers.google.com/assistant/sdk/guides/service/python/中给出的所有步骤操作后,我可以设置Google助手SDK并运行示例闪烁LED代码。但是,当我尝试添加自己的自定义操作时,助手无法检测到我希望它识别的查询。以下是我使用的代码。我错过了什么?

{
"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"
                ]
            }
        ]
    }
]

}

1 个答案:

答案 0 :(得分:0)

问题在于您声明actname是文本架构类型,在触发时不支持。您需要使用单独的类型,您可以在底部声明。您应该更改参数的类型,例如documented example