AWSとAlexaのスキルは比較的新しいです。私は天気に応じてドレッシングアドバイスを与えるシンプルなカスタムスキルを構築しています。Alexa関数はAWS lamdaで動作しますが、Service Simulatorでは動作しません
私は2つのカスタムインテントを持っています:dressingTodayIntent & dressingTomorrowIntent。私の2つの意図が動作しない開発者ポータルのサービスシミュレータで、私はしかしラムダ反応を得るのですが、未定義のoutputSpeechで、次のように:
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak> undefined </speak>"
},
"card": null,
"reprompt": null,
"speechletResponse": {
"outputSpeech": {
"id": null,
"ssml": "<speak> undefined </speak>"
},
"card": null,
"directives": null,
"reprompt": null,
"shouldEndSession": true
}
},
"sessionAttributes": {}
}
それは私の意図でスコープの問題である可能性がありコード? AWSラムダで
'DressingTodayIntent': function() {
var dressingAdvice;
var speechOutput = getJSON('https://api.darksky.net/forecast/9e0495a835ed823a705a9a567eee982a/48.861317,2.348764?units=si&exclude=currently,minutely,hourly,alerts,flags',
function(err, forecast) {
if (err) {
console.log('Error occurred while trying to retrieve weather data', err);
} else {
dressingAdvice = getDressingAdvice(forecast, true);
console.log("one " + dressingAdvice);
}
console.log("two " + dressingAdvice);
return dressingAdvice;
});
console.log("three " + speechOutput);
this.response.cardRenderer("Your dressing advice for today:", speechOutput);
this.response.speak(speechOutput);
this.emit(':responseReady');
},
、Iは、第2ログの正しい出力、及び第3のいずれかのエラー参照:
- 最初のログ: "1" + dressingAdvice、
- 予想通りに2番目のログ:期待
- 第三のログとして "2" + dressingAdvice、: "3" +未定義
あなたが助けてくれてありがとう!
あなたの呼び出しキーワードを通報しますか?それはあなたのカスタムスロットと一致しますか? –
スロットと一致します。これは問題ではありません。 –