有没有办法我可以和路易斯对话

时间:2019-02-01 09:18:09

标签: c# botframework luis

我正试图根据我的意图调用一个对话框。 但是我遇到了错误。请检查我的代码。它到达UserInteraction对话框,但控件没有转到Getuserpurpose。它显示错误“我的机器人代码有问题”

我尝试调试,发现该控件在StartAsync Task之后转移到Webapi配置类。

[LuisIntent("Getfile")]
    public async Task GetfileIntent(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("Sure we can help you on that... ");
        //PromptDialog.Text(context, UserEnteredInfo, "can you please provide us with below info. " +
        //    "Purpose" + "Client name" + "Team Name");
        await context.PostAsync("But first i need to know the purpose ");
      //  Conversation.SendAsync(Activity, () => new UserInteraction());
       context.Call(new UserInteraction(),ResumeAfterFeedback);

    }
    private async Task ResumeAfterFeedback(IDialogContext context, IAwaitable<object> result)
    {
        await context.PostAsync("Prepared an email for you");
        context.Wait(MessageReceived);
    }


[Serializable]
public class UserInteraction : IDialog<object>
{
    protected string Purpose { get; set; }
    protected string ClientName { get; set; }
    protected string Teamname { get; set; }

    public async Task StartAsync(IDialogContext context)
    {
        await context.PostAsync("Please enter the purpose");

       // context.Wait(this.MessageReceivedAsync);
        context.Wait(Getuserpurpose);

    }
    public async Task Getuserpurpose(IDialogContext context, IAwaitable<IMessageActivity> argument)
    {
        var message = await argument;
        this.Purpose = message.Text;
        await context.PostAsync("Now please tell me the client name");
        context.Wait(Getuserclient);

    }

1 个答案:

答案 0 :(得分:0)

我刚刚测试了一下,它确实按预期工作。

df1 <- structure(list(group = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L),
 variable = c("fishers_here", 
 "money_per_fisher", "unnecessary_variable", "fishers_here", "money_per_fisher", 
 "unnecessary_variable", "fishers_here", "money_per_fisher"), 
value = c(100L, 2000L, 10L, 140L, 8000L, 304L, 10L, 9000L
)), class = "data.frame", row.names = c(NA, -8L))