我有一个表单,我得到用户输入。在完成表单时我想触发luis intent。我使用了json来触发intent但是它给了我所有意图的数据而不是触发最高得分意图。从c#代码调用luis的所有可能方法是什么?
表单代码 - public static IForm BuildForm(){
OnCompletionAsyncDelegate<DocumentFormFlow> processDocumentSearch = async (context, Docdata) =>
{
string message = "Thanks for using chat bot Please wait while we search your document , Welcome Again !!! :)";
await context.PostAsync(message);
string query = "fetch me " + Docdata.ClientName + " " + Docdata.SelectDocument + "document";
//这里我想触发下面给出的luis intent方法DocumentSearchIntent
};
return new FormBuilder<DocumentFormFlow>()
.Message("Welcome to the Chat bot !")
.OnCompletion(processDocumentSearch)
.Build();
}
Luis intent方法 - [LuisIntent(“DocumentSearch”)] public async Task DocumentSearchIntent(IDialogContext context,LuisResult result){
FilesFound.Clear();
var msj = context.MakeMessage();
var clientname = string.Empty;
var documenttype = string.Empty;
EntityRecommendation rec;
if (result.TryFindEntity("ClientName", out rec))
clientname = rec.Entity;
if (result.TryFindEntity("DocumentType", out rec))
documenttype = rec.Entity;
if (documenttype.Contains("."))
documenttype = documenttype.Replace(" ", "");
if (clientname == string.Empty || documenttype == string.Empty)
msj.Text = "Could you please provide both input for client name and document.";
else
{
DirSearch(path, clientname, documenttype);
int count = 0;
do
{
if (FilesFound.Count == 0)
{
msj.Text = "No document found for this search";
break;
}
msj.Text += FilesFound[count].ToString();
count++;
} while (count < FilesFound.Count);
}
await context.PostAsync(msj);
context.Wait(MessageReceived);
}