简体   繁体   中英

Alexa Built-In Slot Type: No value being passed

I've been having a heck of a time figuring out how to get the Alexa built-in slots to work properly, and I feel like I must be missing something super fundamental. To set things up for you, I'll start on the Testing page of the Developer Portal. I'm using node.js 6.10.

Under the text utterance service simulator, if I type "I need 5 sleep cycles" it generates a request as such:

  "intent": { "name": "SleepCyclesIntent", "slots": { "number": { "name": "number" } } } 

The result is: "text": "I now know that you want NaN sleep cycles." Note the lack of a "value" field being generated from the utterance.

However, when I manually insert a "value" field in a JSON request, I get the desired output!

 "intent": { "name": "SleepCyclesIntent", "slots": { "number": { "name": "number", "value": "5" } } } 

The result is: "text": "I now know that you want 5 sleep cycles."

I had everything set up the the default intents editor before when I was having this issue, and I've since switched over to the beta intents editor, hoping that it would fix whatever I might be doing wrong. Over there, under "SleepCyclesIntent" which is sent over to sleep_cycles, I have an utterance "I need {number} sleep cycles", with [number} being a slot type of AMAZON.NUMBER.

For additional reference, in case it's helpful, here's the related chunk of my code over in Lambda:

 function sleep_cycles(intent, session, callback) { const cardTitle = "Sleep Cycles"; let repromptText = ''; let sessionAttributes = {}; const shouldEndSession = true; let speechOutput = ''; let targetCycles = intent.slots.number.value; speechOutput = "I now know that you want " + targetCycles + " sleep cycles."; 

I apologize if this is a really stupid question, but I've been digging through forums and Amazon's Alexa help and google every day for the past week and I just have no idea where else to turn. Any help would be super appreciated!

Ah geeze, I'm a huge friggin' doofus. A friend saw this and asked me to try inputting natural language into the test prompt and it works like a charm now. For reference if anyone happens to make this mistake, here's the built-in slot type reference URL: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#number

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