0
我有这段代码。对话链问题(传递消息)
public class HotelBotDialog
{
public static readonly IDialog<string> dialog = Chain.PostToChain()
.Select(msg => msg.Text)
.Switch(
new RegexCase<IDialog<string>>(new Regex("^hi", RegexOptions.IgnoreCase), (context, txt) =>
{
return Chain.ContinueWith(new GreetingDialog(), AfterGreetingContinuation);
}),
new DefaultCase<string, IDialog<string>>((context, txt) =>
{
return Chain.ContinueWith(FormDialog.FromForm(RoomReservation.BuildForm), AfterGreetingContinuation);
}))
.Unwrap()
.PostToUser();
private async static Task<IDialog<string>> AfterGreetingContinuation(IBotContext context, IAwaitable<object> res)
{
var token = await res;
var name = "User";
context.UserData.TryGetValue<string>("Name", out name);
return Chain.Return($"Thank you for using the hotel bot: {name}");
}
}
}
这将工作,但问题是,每当我陷入了“默认情况下,”我需要在第二个条目,以揭开序幕我的形式进入。所以这是对话框如下
我:测试 BOT: 我:Test2的 BOT:欢迎您到酒店机器人......等等等等
我要的是
我:测试 机器人:欢迎来到酒店的机器人...
我会认为有什么问题,我没有通过原来的消息或什么东西。
有人可以帮忙吗?
非常感谢!这就是诀窍! – Matt