3

LaunchRequest を介してスキルを開いたときに、ユーザーを 1 つのインテントにリダイレクトしたい Alexa スキルに取り組んでいます。

  • ユーザーが言うOpen xyz skill
  • LaunchRequest はこれを受け取り、リクエストを別のインテントに転送します。this.emit('AnotherIntent')
  • AnotherIntentその機能に必要なスロットがあります。
  • 必要に応じて SLOT をセットアップしAnotherIntentましたが、単独で起動すると問題なく動作します。

しかし、AnotherIntent上記の手順 2 で説明したように、スキルを起動してその中から呼び出そうとすると、Alexa スキルの起動に失敗します。

もう 1 つ注目すべき点は、このシナリオのスキル ビルダー内から同じ Alexa スキルをテストすると、出力された json が、SLOT が誘発されていることを正しく示していることです。Echo デバイスから実行しようとしているときに何が起こっているのかわかりません。

NodeJS と Lambda を使用して、Alexa ハンドラーをデプロイしています。

どんな助けでも大歓迎です。

コメントに基づくさらなる参照-

ハンドラー -

var handlers = {
'LaunchRequest': function () {
    console.log("LaunchRequest::" + JSON.stringify(this.event.request));
    this.emit('fooIntent');
},
'SessionEndedRequest': function () {
    console.log('session ended!');
},
'fooIntent': function () {
    const intentObj = this.event.request.intent;
     if (!intentObj || (intentObj && !intentObj.slots.WHEN.value)) {
        console.log('fooIntent::UserId' + this.event.session.user.userId);
        const slotToElicit = 'WHEN';
        const speechOutput = 'Ask a question here ?';
        const repromptSpeech = speechOutput;
        console.log("emitting elict now");
        this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);   
    } else {
        // SLOT is filled, let's query the database to get the value for the slot.
        console.log("fooIntent intent:something is requested for " + this.event.request.intent.slots.WHEN.value);
        // All the slots are filled (And confirmed if you choose to confirm slot/intent)
       fooIntentFunction(this,this.event.request.intent.slots.WHEN.value);
    }
 },
'AMAZON.HelpIntent': function () {
    var speechOutput = "Need to come up with one.";
    var reprompt = "What can I help you with?";
    this.emit(':ask', speechOutput, reprompt);
},
'AMAZON.CancelIntent': function () {
    this.emit(':tell', 'Goodbye!');
},
'AMAZON.StopIntent': function () {
    this.emit(':tell', 'Goodbye!');
}

};

LaunchRequest でキャプチャされた JSON リクエスト

{
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.972bb705-d181-495e-bf60-991f2bd8fbb1",
"timestamp": "2017-12-30T21:35:21Z",
"locale": "en-US"
}

LaunchRequest から呼び出されたときに Intent でキャプチャされた JSON リクエスト。設定されていないことを示しますintent。上記のように fooIntent の実装で elicit を発行しようとすると、失敗し続けるのはそのためだと思います。

{
    "type": "LaunchRequest",
    "requestId": "amzn1.echo-api.request.972bb705-d181-495e-bf60-991f2bd8fbb1",
    "timestamp": "2017-12-30T21:35:21Z",
    "locale": "en-US"
}
  • アミット
4

3 に答える 3

0

これを試して、

this.emitWithState("IntentName");

お役に立てれば。ではごきげんよう :)

于 2018-07-23T12:52:20.023 に答える