我正在使用动作SDK来构建实现。我正在使用Google Functions。 action.json
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "App"
},
"intent": {
"name": "actions.intent.MAIN",
"trigger": {
"queryPatterns": [
. . .
]
}
}
}
],
"conversations": {
"App": {
"name": " ... ",
"url": " ...",
"fulfillmentApiVersion": 2
}
},
"locale": "en"
}
在功能代码中,我注意到当用户说出/键入actions.intent.CANCEL
或exit
时,Goodbye
的自定义意图代码没有被调用。在仿真器中,仅显示<earcon>
。 JS代码如下:
app.intent('actions.intent.MAIN', (conv) => {
conv.ask('Welcome to ...');
});
app.intent('actions.intent.TEXT', (conv, input) => {
// the main logic of the application is here
});
app.intent('actions.intent.CANCEL', (conv) => {
conv.close(`Okay, let's try this again later.`);
// this code does not get called
});
在action.json中需要设置一些内容以使取消意图起作用
答案 0 :(得分:0)
是的,您需要add something到action.json才能将CANCEL Intent发送给您。在现有的conversations
对象中,添加一个inDialogIntents
属性,该属性带有一组对象,这些对象的名称为CANCEL Intent。像这样:
"conversations": {
"App": {
"name": "...",
"url": "...",
"fulfillmentApiVersion": 2
"inDialogIntents": [
{
"name": "actions.intent.CANCEL"
}
]
}
}