如果用户在延迟期间输入了一些内容,对话框将再次运行。

问题描述 投票:1回答:1

当我在瀑布对话中设置了两个消息之间的延迟,而用户在延迟结束前输入了一些内容时,对话步骤--包括延迟--会再次运行,延迟也会重复。

class Delay extends ComponentDialog {

  constructor(id) {
    super(id);

    this.addDialog(new WaterfallDialog(WATER_FALL_DIALOG_ID, [
      this.startStep.bind(this),
      this.delay.bind(this),
      this.endStep.bind(this)
    ]));
  }

  async startStep(stepContext) {
    await stepContext.context.sendActivity('Start Delay dialog');
    return await stepContext.next();
  }

  async delay(stepContext) {

    await stepContext.context.sendActivities([
      { type: ActivityTypes.Message, text: 'message 1' },
      { type: 'delay', value: 5000 },
      { type: ActivityTypes.Message, text: 'message 2' }
    ]);

    return stepContext.next();
  }

  async endStep(stepContext) {
    await stepContext.context.sendActivity('End Delay dialog');
    return await stepContext.endDialog();
  }
}

enter image description here

我想知道如何让机器人忽略延迟步骤中的任何输入,或者至少不重复延迟步骤和消息。

我喜欢机器人在延迟期间忽略用户发送的消息,并且不采取任何其他行动,我只是不想让它重复延迟步骤。

node.js botframework
1个回答
0
投票

我知道你为什么想要这样的东西,但是机器人的目的是接受用户的输入,并对其进行回复,所以确实没有一个官方的方法让机器人忽略用户的输入。我建议你在你的对话流程中添加一条类似于 "得到结果,请等待 "的消息,然后再添加一条消息来表示你的机器人已经准备好再次接受输入 "这是我发现的。还有其他你要找的XYZ吗?"

也就是说,如果你使用webchat作为频道,有一种方法可以隐藏输入框。https:/github.commicrosoftBotFramework-WebChatissues2427。 这可能是一个选项,但它只适用于webchat,其他渠道不支持这个特殊功能。

© www.soinside.com 2019 - 2024. All rights reserved.