Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Bot框架continueDialog未从堆栈中弹出_Node.js_Botframework - Fatal编程技术网

Node.js Bot框架continueDialog未从堆栈中弹出

Node.js Bot框架continueDialog未从堆栈中弹出,node.js,botframework,Node.js,Botframework,我通过Bot框架创建聊天机器人,并使用node.js上的LineAPI开发人员 我工作中的问题是continueDialognotcontinuewaterwall对话框下一步 当使用continueDialog时,堆栈没有改变 在continueDialog stack1[{id:'xxxDialog', 状态:{选项:{},值:[Object],步骤索引:0}}] 在continueDialog stack2[{id:'xxxDialog', 状态:{选项:{},值:[Object],步骤索

我通过Bot框架创建聊天机器人,并使用node.js上的LineAPI开发人员

我工作中的问题是
continueDialog
notcontinuewaterwall对话框下一步
当使用continueDialog时,堆栈没有改变

continueDialog

stack1[{id:'xxxDialog',
状态:{选项:{},值:[Object],步骤索引:0}}]

continueDialog

stack2[{id:'xxxDialog',
状态:{选项:{},值:[Object],步骤索引:0}}]



关于index.js

server.post('/api/line',jsonParser, async (req, res)=> {
  const conversationReference = { 
          type: "message", 
          text: "Hello world" ,
          channelData: { clientActivityID: "id-xxxx" },
          channelId: 'api/line/id-xxxx',
          recipient:
            { id: lineID`,
              name: 'line',
              role: 'botLine' },
              serviceUrl: 'https://localhost:3978' ,
          from:
            { id: lineId`,
              name: 'User',
              role: 'user' },
          conversation: { id: lineId },
       };
  const context = await adapter.createContext(conversationReference);

  await bot.onTurn(context);
});


关于bot.js

class Bot extends ActivityHandler {
     /**
     *
     * @param {ConversationState} conversationState
     * @param {UserState} userState
     * @param {Dialog} dialog
     */
    constructor(conversationState, userState) {    
        super();
        this.conversationState = conversationState;
        this.userState = userState;

        this.dialogStateAccessor = conversationState.createProperty('dialogStateAccessor');
        this.dialogAccessor= conversationState.createProperty('testAccessor');

        this.dialog = new DialogSet(this.dialogStateAccessor);

        this.dialog.add(new WaterfallDialog('testDialog', [
            this.step1.bind(this), 
            this.step2.bind(this)


    ]));
}

 async step1(stepContext){
    linesent("step 1") ;
    return {status : DialogTurnStatus.waiting} ;
}
async step2(stepContext){
    linesent("step 2") ;
        return await stepContext.endDialog(); 
}

 async onTurn(turnContext) {
 const reservation = await this.dialogAccessor.get(turnContext, null);   
        // Generate a dialog context for our dialog set.
        const dc = await this.dialog.createContext(turnContext);
  if (!dc.activeDialog){
      // If there is no active dialog, check whether we have a reservation yet.
      if (!reservation) {
          // If not, start the dialog.
          await dc.beginDialog(`testDialog`);
      }
}
 else {
  //Continue the dialog.
  const dialogTurnResult = await dc.continueDialog();
 }
return await this.conversationState.saveChanges(turnContext, false);
}

但它没有显示任何错误。

任何帮助都将不胜感激。

发现continueDialog方法是

 async continueDialog(dc) {
        // Don't do anything for non-message activities
        if (dc.context.activity.type !== botbuilder_core_1.ActivityTypes.Message) {
            return dialog_1.Dialog.EndOfTurn;
        }
        // Run next step with the message text as the result.
        return await this.resumeDialog(dc, dialog_1.DialogReason.continueCalled, dc.context.activity.text);
    }
如果出现条件,则bot始终执行


将activeDialog id上的
continueDialog
更改为
resumeDialog
,瀑布将在下一步工作。

获取它!!刚刚将activeDialog上的continueDialog更改为resumeDialog,瀑布将在下一步工作。很高兴您能够解决此问题。为了清楚起见,如果有活动的多回合对话框,continueDialog将继续执行。ResumeDialog支持对话框嵌套(其中对话框有子对话框)。当子对话框完成时,将调用父对话框上的ResumeDialog。请参阅以获得更多澄清。此外,您可以在答案中张贴您的决议,以便帮助他人。@ranusharao thas真的很有帮助,谢谢。