【发布时间】:2020-06-02 08:41:17
【问题描述】:
我创建了一个由选项卡和机器人组成的 Microsoft 团队应用。我将此作为reference 用于创建团队插件。在这里,我使用的是 bot 框架建议的瀑布流模型。在使用它时,我必须给出固定数量的动作,但我想要动态动作。这是示例
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);
}
}
我怎样才能转到以前的功能,即 actStep 以再次做出决定而没有任何问题。我尝试从actStep调用decisionStep然后我遇到异常并且机器人失败了。当有一些重复的工作要做时,由于动作数量固定,我无法完成。
提前致谢。
【问题讨论】:
标签: botframework microsoft-graph-api microsoft-teams