无法在 google assistant sdk 上触发自定义操作
Can't trigger custom actions on google assistant sdk
按照 - https://developers.google.com/assistant/sdk/guides/service/python/ 中给出的所有步骤后,我能够设置 Google 助手 SDK 并且可以 运行 示例闪烁 LED 代码。但是,当我尝试添加自己的自定义操作时,Assistant 无法检测到我希望它识别的查询。下面是我使用的代码。我错过了什么?
{
"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"
]
}
]
}
]
}
问题是您声明 actname 是文本架构类型,触发中不支持它。您需要改为使用单独的类型,您确实在底部声明了该类型。您应该更改参数的类型,例如 documented example.
按照 - https://developers.google.com/assistant/sdk/guides/service/python/ 中给出的所有步骤后,我能够设置 Google 助手 SDK 并且可以 运行 示例闪烁 LED 代码。但是,当我尝试添加自己的自定义操作时,Assistant 无法检测到我希望它识别的查询。下面是我使用的代码。我错过了什么?
{
"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"
]
}
]
}
]
}
问题是您声明 actname 是文本架构类型,触发中不支持它。您需要改为使用单独的类型,您确实在底部声明了该类型。您应该更改参数的类型,例如 documented example.