我通过 React 开发了一个网页,其中一个 Webchat-Bot 和 React App 交互。React 应用程序包含一个计时器,它应该停止在那一刻运行的任何对话框。它通过 Direct-Line 发送事件来执行此操作。无论如何,我得到了不想要的行为,如果机器人逻辑位于瀑布中,其中步骤是(选择-)提示,则问题会被重新提示。(因为它没有从用户那里收到所需的答案)。我的问题是:
如何阻止 ChoicePrompt 重新提示?
当 Bot 接收到“超时”事件时,它会停止当前对话await endDialog()
并开始一个发送新消息的新对话。在下一个用户输入之后,弹出之前的提示。所以我假设,后台的提示仍在等待答案之一,并且因为它没有收到它,所以它会重新开始或重新提示。
我试图将 maxRetries 设置为 0:
var options = {maxRetries: '0'};
await step.prompt(CONFIRM_PROMPT, `text abc..`, ['sure', 'not sure'], options);
弹出事件的代码片段..
async onTurn(turnContext) {
const dc = await this.dialogs.createContext(turnContext);
..
if (turnContext.activity.name === 'time-feedback') {
..
await dc.endDialog(); // when a choice-prompt is active, it keeps reprompting, before the next line gets activated. I wish to end the reprompt and current (waterfall dialog) immediately
await dc.beginDialog(PromptForStartingNew); // start a new waterfall dialog
}