2017-02-11 7 views
1

hereには、特定の要求でスキルを呼び出すことができます。特定のリクエストを持つスキルの呼び出しは、newSessionハンドラでどのように機能しますか?

しかし、私のスキルには新しいセッション用のハンドラがあり、特定のリクエストで自分のスキルを起動しようとすると、まだこの新しいセッション機能で終了します。

const handlers = { 
    'NewSession': function() { 
     this.attributes.speechOutput = this.t('WELCOME_MESSAGE', this.t('SKILL_NAME')); 
     this.attributes.repromptSpeech = this.t('WELCOME_REPROMT'); 
     this.emit(':ask', this.attributes.speechOutput, this.attributes.repromptSpeech); 
     }, 
    'RankIntent': function() { 
     const rank1raw = this.event.request.intent.slots.RankOne; 
     const rank2raw = this.event.request.intent.slots.RankTwo; 
     ... 
    } 
} 

正しい意図を取得する方法はありますか私はnewSession機能の句がで来ているかを確認するために、いくつかの場合には行う必要がありますし、どの機能が対応すべき?

答えて

1

あなたはhere on line 17を読むことができたよう:

代わりNewSessionの

使用LaunchRequest、あなたは ワンショットモデルアレクサを使用したい場合は、( 何かをする[私のスキル-呼び出し名]を頼みます)...

は、だから私のアプローチでは、それは次のようになります。

const handlers = { 
    'LaunchRequest': function() { 
     this.attributes.speechOutput = this.t('WELCOME_MESSAGE', this.t('SKILL_NAME')); 
     this.attributes.repromptSpeech = this.t('WELCOME_REPROMT'); 
     this.emit(':ask', this.attributes.speechOutput, this.attributes.repromptSpeech); 
     }, 
    'RankIntent': function() { 
     const rank1raw = this.event.request.intent.slots.RankOne; 
     const rank2raw = this.event.request.intent.slots.RankTwo; 
     ... 
    } 
}