2017-08-03 8 views
0

builder.Prompt.choice(...)への応答を取得しようとしています。選択肢のリストがロードされ、選択を行うと何も起こりません。ボットフレームワークダイアログでプロンプトの結果を取得する方法

しかし、function(session, results)が実行されたとは思われません。 session.send("Choice Made)他のコードは実行されません。どのように私は私の応答を得ることができます。私は何がここで間違っているのか分からない。それは、ドキュメントのコードのように見えます。

bot.dialog('LifecycleDialog', function (session, args) { 

     var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software'); 
     var choices = Object.keys(SoftwareDict[softwareEntity.entity]); 

     builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version."); 
     }, 
     function (session, results) { 
      session.send("Choice Made"); //DOES NOT WORK 
       session.endDialogWithResult(results); //DOES NOT WORK 

}).triggerAction({ 
    matches: 'LifecycleStatus' 
}); 
+0

はそれが可能ですtriggerActionでこれを行うには?すべての例はちょっと異なる構文のダイアログです。 –

答えて

0

私はそれを理解しました。唯一の違いは、ダイアログに中括弧{}の代わりにかっこ[]を付ける必要があることです。

bot.dialog('LifecycleDialog', function (session, args) [ 

     var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software'); 
     var choices = Object.keys(SoftwareDict[softwareEntity.entity]); 

     builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version."); 
     }, 
     function (session, results) { 
      session.send("Choice Made"); //DOES NOT WORK 
       session.endDialogWithResult(results); //DOES NOT WORK 

]).triggerAction({ 
    matches: 'LifecycleStatus' 
}); 
+0

ダイアログボックスハンドラ内の 'results.response'オブジェクトで、選択した選択肢をプロンプトの後に見つけることができます。 – nilsw

+0

中括弧 '{}'はうまくいきました。ダイアログの関数は四角い '[]'中かっこで囲む必要があります。 – chandan

1

あなたはコンマの後の機能の一部、すなわちの先頭に角括弧を置くべき のように「『LifecycleDialog』、[機能(セッション、引数)」

bot.dialog('LifecycleDialog', [ 
    function (session, args) { 

    var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software'); 
    var choices = Object.keys(SoftwareDict[softwareEntity.entity]); 

    builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version."); 
    }, 
    function (session, results) { 
     session.send("Choice Made"); //DOES NOT WORK 
      session.endDialogWithResult(results); //DOES NOT WORK 
    } 

]).triggerAction({ 
matches: 'LifecycleStatus' 
}); 
関連する問題