botframework - 是否可以在单个机器人中使用由 Bot Framework Composer 生成的多个自适应对话框?
问题描述
用例:我在前面有一个 LUIS 调度模型 2 个 Composer 构建的 LUIS 模型 - 每个模型前面都有一个 Composer 构建的自适应对话对话。例如
- LUIS 模型 1 - 家庭自动化
- LUIS 模型 2 - 天气
一旦识别出 LUIS 意图,我想过渡到这三个过程中的任何一个。
我将 Composer 生成的自适应对话框集成到 Bot 中的策略基于此处的示例:https ://github.com/microsoft/BotBuilder-Samples/tree/master/experimental/adaptive-dialog/declarative
然后我将这两个过程添加到ResourceExplorer
我的适配器中,然后在我的 Bot 中,我正在加载对话框并创建一个父级AdaptiveDialog
并将其包装在 a 中DialogManager
,然后再委派给OnTurnAsync
. :
(注意:我已经剥离并简化了很多代码来帮助我调试问题)
var adaptiveDialogs = new DialogSet();
foreach (var resource in _resourceExplorer.GetResources(".dialog").Where(r => _composedDialogNames.Contains(Path.GetFileNameWithoutExtension(r.Id))))
{
var subDialog = DeclarativeTypeLoader.Load<AdaptiveDialog>(resource, _resourceExplorer, DebugSupport.SourceMap);
adaptiveDialogs.Add(subDialog);
}
// Note - at this point adaptiveDialogs correctly contains two Composer created dialogs
var dialog = new AdaptiveDialog()
{
AutoEndDialog = false,
Dialogs = adaptiveDialogs,
Triggers = new List<OnCondition>() {
new OnBeginDialog() {
Actions = new List<Dialog>()
{
new CodeAction(async (context, o) =>
{
await context.Context.SendActivityAsync("say something to me");
return new DialogTurnResult(DialogTurnStatus.Waiting, o);
}),
new BeginDialog(adaptiveDialogs.GetDialogs().ElementAt(0).Id),
new BeginDialog(adaptiveDialogs.GetDialogs().ElementAt(1).Id),
new RepeatDialog()
}
}
}
};
我遇到的问题是,当它运行时,new BeginDialog(adaptiveDialogs.GetDialogs().ElementAt(0).Id)
如果加载了后续的自适应对话框,则该行不会执行任何操作。(new BeginDialog(adaptiveDialogs.GetDialogs().ElementAt(1).Id)
顺便说一句,运行良好)
任何帮助将不胜感激。
解决方案
推荐阅读
- shapes - 在 Visio 中更改形状颜色
- math - 给定2个坐标和一个角度,找到C坐标
- javascript - 如何解码二进制音频数据?
- java - 如何从 Scala 访问 Java 类中的公共静态最终成员?
- php - 如何将 WordPress 元框页面属性-> 页面模板下拉菜单转换为单选按钮?
- java - Update() 方法在带有 h2 数据库的 Play Framework 中不起作用
- javascript - D3 将条形图值旋转 90 度
- java - 使用 modelmapper 将列表大小映射到 int 字段
- python - 为数据框编写循环时出现问题
- c# - 从父类的方法中使用子类的静态覆盖属性