我有一个获取用户输入的表单。在完成表单时,我想触发luis意图。我使用json触发意图,但它给了我所有意图的数据,而不是触发最高得分意图。从c#代码调用luis的所有可能方法是什么
表单代码-公共静态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意图方法- LuisIntent("DocumentSearch")公共异步任务上下文(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);
}
https://stackoverflow.com/questions/54906203
复制相似问题