如何在表格对话框中接收附件? [英] How to receive Attachment in Form Dialog?

查看:84
本文介绍了如何在表格对话框中接收附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个Bot对话框,该对话框向用户询问并接收用户的附件.我想将其转换为表单对话框",因为我认为它更合适(请向我发送document1" ...直至documentN).您能指出我一个接收用户附件的表单对话框"示例吗?

I currently have a Bot Dialog that asks for and receives attachments from the user. I would like to convert it into a Form Dialog because I think that fits better ("Please send me document1"... upto documentN). Can you point me to an example of Form Dialog that receives attachments from the user?

我了解到FormFlow现在具有附件支持: https://github.com/Microsoft/BotBuild 2870/commits/55c3d336a6cd63ee96561eeed9a905fb8c156a87#diff-db1cd0aff903bd4f06fadb81b6f33d86

I read that FormFlow now has Attachment support: https://github.com/Microsoft/BotBuilder/pull/2870/commits/55c3d336a6cd63ee96561eeed9a905fb8c156a87#diff-db1cd0aff903bd4f06fadb81b6f33d86

除以下之外,我找不到任何示例: https://github.cn com/southworkscom/BotBuilder/blob/55c3d336a6cd63ee96561eeed9a905fb8c156a87/CSharp/Samples/Microsoft.Bot.Sample.FormFlowAttachmentsBot/ImagesForm.cs 这个对象使用了一个AwaitableAttachment对象.我不知道它来自哪里...

I cannot find any example aside from: https://github.com/southworkscom/BotBuilder/blob/55c3d336a6cd63ee96561eeed9a905fb8c156a87/CSharp/Samples/Microsoft.Bot.Sample.FormFlowAttachmentsBot/ImagesForm.cs This one uses an AwaitableAttachment object. I can't figure out where it comes from...

理想情况下,我想从用户那里接收列表,就像用户可以发送多个附件一样,我可以在普通对话框中通过消息来检索它.附件

Ideally I want to receive a List from the user, much like how a user can send multiple attachments and I in a normal dialog, I can retrieve it with messages.Attachments

列表不起作用,普通的附件对象类型也不起作用:

List doesn't work and neither does normal Attachment object type like:

    [Prompt("Send me a copy of your **Document 1**.")]
    public Attachment Doc1;

    [Prompt("Send me a copy of your **Document 2**.")]
    public Attachment Doc2;

    ...

    private static IForm<MyForm> BuildMyForm()
    {
        OnCompletionAsyncDelegate<MyForm> completeForm = async (context, state) =>
        {
            //await context.PostAsync($"Completed.");
        };

        var form = CreateCustomForm<MyForm>()
                    .Message("Let's start!")
                   .Field(nameof(Doc1))
                   .Field(nameof(Doc2))
                 ...
                    .OnCompletion(completeForm)
                    .Build();

        return (IForm<MyForm>)form;
    }

推荐答案

您的方法是正确的:找到的请求请求已合并到BotBuilder GitHub项目的develop分支上,这就是为什么看不到它的原因在master版本中.

You were on the right way: the pull request that you found has been merged on develop branch of BotBuilder GitHub's project, that's why you are not seeing it in master releases.

您可以找到:

  • 附件机器人的示例中添加了您指向的拉取请求
  • The sample of Attachment bot added with the pull request you pointed here
  • AwaitableAttachment class is here

这篇关于如何在表格对话框中接收附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆