[英]Microsoft Bot Framework bot not working in Microsoft Teams when using ngrok
[英]How to have dynamic flow for teams bot built using microsoft bot framework?
我创建了一个由选项卡和机器人组成的 Microsoft 团队应用程序。 我将此作为创建团队插件的参考。 在这里,我使用的是 bot 框架建议的瀑布流 model。 在使用它时,我必须给出固定数量的动作,但我想要动态动作。 这是示例
class MainDialog extends ComponentDialog {
constructor(luisRecognizer, bookingDialog) {
super('MainDialog');
if (!luisRecognizer) throw new Error('[MainDialog]: Missing parameter \'luisRecognizer\' is required');
this.luisRecognizer = luisRecognizer;
if (!bookingDialog) throw new Error('[MainDialog]: Missing parameter \'bookingDialog\' is required');
// Define the main dialog and its related components.
// This is a sample "book a flight" dialog.
this.addDialog(new TextPrompt(TEXT_PROMPT))
.addDialog(bookingDialog)
.addDialog(nominationDialogue)
.addDialog(new ChoicePrompt(CHOICE_PROMPT))
.addDialog(new WaterfallDialog(MAIN_WATERFALL_DIALOG, [
this.introStep.bind(this),
this.decidestep.bind(this),
this.originStep.bind(this),
this.actStep.bind(this),
this.Actualstep.bind(this)
]));
this.initialDialogId = MAIN_WATERFALL_DIALOG;
}
/**
* The run method handles the incoming activity (in the form of a TurnContext) and passes it through the dialog system.
* If no dialog is active, it will start the default dialog.
* @param {*} turnContext
* @param {*} accessor
*/
async run(turnContext, accessor) {
const dialogSet = new DialogSet(accessor);
dialogSet.add(this);
const dialogContext = await dialogSet.createContext(turnContext);
const results = await dialogContext.continueDialog();
if (results && results.status === DialogTurnStatus.empty) {
await dialogContext.beginDialog(this.id);
}
}
我怎样才能将 go 转换为以前的 function 即,actStep 以再次确定Step 而没有任何问题。 我尝试从actStep调用decisionStep然后我遇到异常并且机器人失败了。 当有一些重复的工作要做时,由于动作数量固定,我无法完成。
提前致谢。
我遇到了同样的问题,我使用以下代码(C#)解决了它。 它不干净(有点黑客),但它有效
private static async Task<DialogTurnResult> actStep (WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
.
.
.
stepContext.ActiveDialog.State["stepIndex"] = (int)stepContext.ActiveDialog.State["stepIndex"] - 2;
return await stepContext.NextAsync(null, cancellationToken);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.