无论我问什么,我的 Alexa 意图都没有定义槽
My Alexa intent has no slot defined, no matter what I ask
我正在使用自定义 Lambda 函数来处理我的自定义 Alexa 技能。我有一个插槽,我想捕获它。不幸的是,意图槽从未填充任何值,而且似乎被忽略了,尽管在请求中。
这是我的代码(注意:JSON.stringify
可以帮助我调试):
'use strict';
var Alexa = require("alexa-sdk");
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'LaunchRequest': function () {
this.emit('Snow');
},
'Snow': function () {
var place = this.event.request.intent.slots.Place;
var text = 'Over the next 9 days you can expect 12 centimeters of snowfall in '+ JSON.stringify(place) +'. The upper piste has a depth of 75 centimeters and the lower piste has a depth of 35 centimeters. All 19 lifts are currently open.';
this.emit(':tell', text);
}
};
我有一个名为 "Snow" 的 Intent 和一个名为 "Place" 的插槽。这是我的交互模型:
{
"interactionModel": {
"languageModel": {
"invocationName": "ski club",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "Snow",
"slots": [
{
"name": "Place",
"type": "AMAZON.City"
}
],
"samples": [
"how the powder is",
"what the powder is like",
"how the snow is",
"what the snow is like",
"snow conditions",
"snow condition",
"snow fall",
"snowfall",
"powder levels",
"powder level",
"snow level",
"powder depth",
"snow levels",
"snow depth",
"powder",
"snow",
"the snow"
]
}
],
"types": []
},
"dialog": {
"intents": [
{
"name": "Snow",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "Place",
"type": "AMAZON.City",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.115004419453.153941565683"
}
}
]
}
]
},
"prompts": [
{
"id": "Elicit.Slot.115004419453.153941565683",
"variations": [
{
"type": "PlainText",
"value": "Where would you like to know about the snow?"
}
]
}
]
}
}
我希望能够问:
Alexa ask my app how the snow is in Morzine
而且我希望得到来自我的 Lambda 函数的静态文本的回复,包括插入的名称。但是,我得到以下信息:
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak> Over the next 9 days you can expect 12 centimeters of snowfall in {\"name\":\"Place\",\"confirmationStatus\":\"NONE\"}. The upper piste has a depth of 75 centimeters and the lower piste has a depth of 35 centimeters. All 19 lists are currently open. </speak>"
},
"shouldEndSession": true
},
"sessionAttributes": {},
"userAgent": "ask-nodejs/1.0.25 Node/v8.10.0"
}
}
似乎Place
从来没有value
。
如果我完全省略 Place 插槽,我会得到完全相同的响应:
Alexa ask my app how the snow is
在这里我希望被要求提供一个位置。
这是来自 Alexa 的 JSON 输入(我编辑了一些键):
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.***",
"application": {
"applicationId": "amzn1.ask.skill.***"
},
"user": {
"userId": "amzn1.ask.account.***"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.***"
},
"user": {
"userId": "amzn1.ask.account.***"
},
"device": {
"deviceId": "amzn1.ask.device.***",
"supportedInterfaces": {}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "***.***.***
},
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 246,
"arcMinuteHeight": 144,
"canRotate": false,
"canResize": false
}
],
"shape": "RECTANGLE",
"pixelWidth": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
]
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.92fc43d8-0dc2-4a08-a31a-70a031e2fef7",
"timestamp": "2018-11-16T16:51:17Z",
"locale": "en-GB",
"intent": {
"name": "Snow",
"confirmationStatus": "NONE",
"slots": {
"Place": {
"name": "Place",
"confirmationStatus": "NONE"
}
}
},
"dialogState": "STARTED"
}
}
我的意图需要包括广告位本身,它并不像我想的那样假设在那里。这是通过附加 {Place}
.
来完成的
我正在使用自定义 Lambda 函数来处理我的自定义 Alexa 技能。我有一个插槽,我想捕获它。不幸的是,意图槽从未填充任何值,而且似乎被忽略了,尽管在请求中。
这是我的代码(注意:JSON.stringify
可以帮助我调试):
'use strict';
var Alexa = require("alexa-sdk");
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'LaunchRequest': function () {
this.emit('Snow');
},
'Snow': function () {
var place = this.event.request.intent.slots.Place;
var text = 'Over the next 9 days you can expect 12 centimeters of snowfall in '+ JSON.stringify(place) +'. The upper piste has a depth of 75 centimeters and the lower piste has a depth of 35 centimeters. All 19 lifts are currently open.';
this.emit(':tell', text);
}
};
我有一个名为 "Snow" 的 Intent 和一个名为 "Place" 的插槽。这是我的交互模型:
{
"interactionModel": {
"languageModel": {
"invocationName": "ski club",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "Snow",
"slots": [
{
"name": "Place",
"type": "AMAZON.City"
}
],
"samples": [
"how the powder is",
"what the powder is like",
"how the snow is",
"what the snow is like",
"snow conditions",
"snow condition",
"snow fall",
"snowfall",
"powder levels",
"powder level",
"snow level",
"powder depth",
"snow levels",
"snow depth",
"powder",
"snow",
"the snow"
]
}
],
"types": []
},
"dialog": {
"intents": [
{
"name": "Snow",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "Place",
"type": "AMAZON.City",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.115004419453.153941565683"
}
}
]
}
]
},
"prompts": [
{
"id": "Elicit.Slot.115004419453.153941565683",
"variations": [
{
"type": "PlainText",
"value": "Where would you like to know about the snow?"
}
]
}
]
}
}
我希望能够问:
Alexa ask my app how the snow is in Morzine
而且我希望得到来自我的 Lambda 函数的静态文本的回复,包括插入的名称。但是,我得到以下信息:
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak> Over the next 9 days you can expect 12 centimeters of snowfall in {\"name\":\"Place\",\"confirmationStatus\":\"NONE\"}. The upper piste has a depth of 75 centimeters and the lower piste has a depth of 35 centimeters. All 19 lists are currently open. </speak>"
},
"shouldEndSession": true
},
"sessionAttributes": {},
"userAgent": "ask-nodejs/1.0.25 Node/v8.10.0"
}
}
似乎Place
从来没有value
。
如果我完全省略 Place 插槽,我会得到完全相同的响应:
Alexa ask my app how the snow is
在这里我希望被要求提供一个位置。
这是来自 Alexa 的 JSON 输入(我编辑了一些键):
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.***",
"application": {
"applicationId": "amzn1.ask.skill.***"
},
"user": {
"userId": "amzn1.ask.account.***"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.***"
},
"user": {
"userId": "amzn1.ask.account.***"
},
"device": {
"deviceId": "amzn1.ask.device.***",
"supportedInterfaces": {}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "***.***.***
},
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 246,
"arcMinuteHeight": 144,
"canRotate": false,
"canResize": false
}
],
"shape": "RECTANGLE",
"pixelWidth": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
]
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.92fc43d8-0dc2-4a08-a31a-70a031e2fef7",
"timestamp": "2018-11-16T16:51:17Z",
"locale": "en-GB",
"intent": {
"name": "Snow",
"confirmationStatus": "NONE",
"slots": {
"Place": {
"name": "Place",
"confirmationStatus": "NONE"
}
}
},
"dialogState": "STARTED"
}
}
我的意图需要包括广告位本身,它并不像我想的那样假设在那里。这是通过附加 {Place}
.