在使用LUIS的对话框中处理图像输入的正确流程是什么? [英] What's the correct flow to handle image inputs in a dialog that uses LUIS?
问题描述
我正在用c#组装一个机器人,该机器人可以接受用户的图像输入以及文本输入.我使用LUIS作为AI框架来确定对话模式中的意图.但是,似乎两种输入不能共存:LUIS和附件.我想知道这种情况下是否有推荐的模式.请帮忙! :|
I'm putting together a bot in c# that accepts image inputs from the user as well as text input. I'm using LUIS as the AI framework to determine intents in a dialog pattern. However, it seems like both types of input can't coexist: LUIS and attachments. I would like to know if there is a recommended pattern for this scenario. Please help! :|
推荐答案
所以我发现了一个更好的模式,尽管与Praveen的回答很相似.
So I found out a better pattern, though is along the lines to Praveen's answer.
您要在MessageController中检查附件activity.Attachments == null
,但除此之外,您还必须创建所谓的RootDialog并将所有对话发送到该对话,然后可以从中将对话转发到其他Dialog.
In the MesssageController you want to check for attachments activity.Attachments == null
but in addition, you have to create what is called a RootDialog and send all conversations there from which you can forward conversations to other Dialogs.
在我的情况下,我正在将希望LUIS处理的消息转发到将LUIS作为服务继承的对话框类.其他消息(例如附件)将发送到另一个对话框类进行处理.
In my case, I'm forwarding the messages that I want LUIS to handle to a dialog class that inherit LUIS as a service. Other messages, such as attachments are sent to another dialog class to be handled.
获取附件并在对话框代码中处理它的另一种方法是使用PromptAttachment
调用作为捕获器,以供用户输入附件:
Another way to get an attachment and handle it inside your dialog code is by using the PromptAttachment
call as a catcher for user's input of the attachment:
var dialog = new PromptDialog.PromptAttachment(message.ToString(), "Sorry, I didn't get the receipt. Try again please.", 2);
context.Call(dialog, AddImageToReceiptRecord);
干杯! :)
这篇关于在使用LUIS的对话框中处理图像输入的正确流程是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!