[英]Bot Framework and LUIS An error occurred while sending the request
I upgrade my bot framework to 3.13.0.3 and my LUIS dialog stop working.我将我的机器人框架升级到 3.13.0.3,我的 LUIS 对话框停止工作。 My bot start but when I write the word about the intent the bot show again the initial message and stay in this loop.
我的机器人开始了,但是当我写下关于意图的词时,机器人再次显示初始消息并保持在这个循环中。
I did verify the app ID and key, If I make a request to LUIS from the browser it works fine, but from the bot is like not make the request.我确实验证了应用程序 ID 和密钥,如果我从浏览器向 LUIS 发出请求,它工作正常,但从机器人发出请求就像不发出请求。
I did train and publish the LUIS model again我再次训练并发布了 LUIS 模型
From visual studio and Azure deployment the behavior is the same, when type the LUIS intent the bot shows again the start message.在 Visual Studio 和 Azure 部署中,行为是相同的,当键入 LUIS 意图时,机器人再次显示启动消息。 The LUISIntent is in spanish "vacantes" or "registrar"
LUISIntent 是西班牙语的“空缺”或“注册商”
Before the upgrade the bot works fine and the LUIS dialog works.在升级之前,bot 工作正常,LUIS 对话框工作正常。
using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using MP_BotMVP.SupportClasses;
using Microsoft.Bot.Builder.Luis;
using Microsoft.Bot.Builder.Luis.Models;
using System.Collections.Generic;
using System.Configuration;
using System.Threading;
namespace MP_BotMVP.Dialogs
{
[Serializable]
public class RootDialog : LuisDialog<object>
{
public RootDialog() : base(new LuisService(new LuisModelAttribute(
ConfigurationManager.AppSettings["LuisAppId"],
ConfigurationManager.AppSettings["LuisAPIKey"],
domain: ConfigurationManager.AppSettings["LuisAPIHostName"])))
{
}
[LuisIntent("")]
[LuisIntent("None")]
public async Task None(IDialogContext context, LuisResult result)
{
string strUserName = "Usuario";
try
{
strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
}
catch { }
string message = string.Format(DialogText.No_Endiendo,strUserName);
await context.PostAsync(message);
context.Wait(this.MessageReceived);
}
public override Task StartAsync(IDialogContext context)
{
context.Wait(this.MessageReceivedAsync);
return Task.CompletedTask;
}
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
await this.SendWelcomeMessage(context);
}
private async Task SendWelcomeMessage(IDialogContext context)
{
await context.PostAsync($"{DialogText.Saludo_Inicial}");
PromptDialog.Text(context, this.GetUserNameAfter, DialogText.Pedir_Nombre);
}
private async Task GetUserNameAfter(IDialogContext context, IAwaitable<object> result)
{
var userName = await result;
context.UserData.SetValue(DialogText.UserNameKey, userName);
await context.PostAsync(string.Format(DialogText.Bienvenido, userName.ToString()));
}
[LuisIntent("Saludo y Presentacion")]
public async Task Greetings(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
await this.SendWelcomeMessage(context);
}
[LuisIntent("Registrar CV")]
public async Task RecordCV(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
string strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
string strLink = System.Configuration.ConfigurationManager.AppSettings["MP_CV_Url"];
string strResponse = string.Format(DialogText.Registrar_CV, strUserName, strLink);
await context.PostAsync(strResponse);
await this.SendMayIHelp(context);
}
[LuisIntent("Buscar Vacantes")]
public Task SearchJob(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
string strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
string strResponse = string.Format(DialogText.Buscar_Vacante, strUserName);
PromptDialog.Text(context, this.SearchJobAfter, strResponse);
return Task.CompletedTask;
}
private async Task SearchJobAfter(IDialogContext context, IAwaitable<object> result)
{
var userCity = await result;
context.UserData.SetValue(DialogText.UserSelectedCityKey, userCity);
PromptDialog.Text(context, this.SearchJobAreaAfter, DialogText.Buscar_Area);
}
private async Task SearchJobAreaAfter(IDialogContext context, IAwaitable<object> result)
{
var userArea = await result;
context.UserData.SetValue(DialogText.UserSelectAreaKey, userArea);
string strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
string strUserCity = context.UserData.GetValue<string>(DialogText.UserSelectedCityKey);
string strUserArea = context.UserData.GetValue<string>(DialogText.UserSelectAreaKey);
string strLink = System.Configuration.ConfigurationManager.AppSettings["MP_CV_Url"];
string strResponse = string.Format(DialogText.Buscando_Vacante, strUserName, strUserCity, strUserArea);
await context.PostAsync(strResponse);
List<string> l_strOpps = SQLDB.Get_Opportunities(strUserCity, strUserArea);
if (l_strOpps.Count > 0)
{
await context.PostAsync(string.Format(DialogText.Si_Resultados, strUserName, l_strOpps.Count));
foreach (string str in l_strOpps)
{
await context.PostAsync(str);
}
await context.PostAsync(string.Format(DialogText.Vacantes_InfoExtra, strUserName, strLink));
await this.SendMayIHelp(context);
}
else
{
await context.PostAsync(DialogText.No_Resultados);
PromptDialog.Text(context, this.SearchJobAreaAfter, DialogText.No_Resultados_Nuevamente);
}
}
[LuisIntent("Ayuda Adicional")]
public async Task GetInfo(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
string strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
string strResponse = string.Format(DialogText.Ayuda_Adicional, strUserName);
await context.PostAsync(strResponse);
}
private async Task SendMayIHelp(IDialogContext context)
{
await context.PostAsync(DialogText.Mas_Ayuda);
}
[LuisIntent("Calificar")]
public Task GetFeedback(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
foreach (var ent in result.Entities)
{
if ((ent.Entity.ToLower() == "si") || (ent.Entity.ToLower() == "calificar"))
{
PromptDialog.Text(context, this.FeedbackAfter, DialogText.Calificar);
}
}
return Task.CompletedTask;
}
private async Task FeedbackAfter(IDialogContext context, IAwaitable<object> result)
{
var userFeedback = await result;
//TODO --> Grabar en la DB
string strUserName = context.UserData.GetValue<string>(DialogText.UserNameKey);
string strResponse = string.Format(DialogText.Despedida, strUserName);
await context.PostAsync(strResponse);
}
}
}
This is the error in the bot emulator这是机器人模拟器中的错误
{
"type": "message",
"timestamp": "2018-02-01T01:07:03.688Z",
"localTimestamp": "2018-01-31T20:07:03-05:00",
"serviceUrl": "http://localhost:32443",
"channelId": "emulator",
"from": {
"id": "8jbgkfm83h2a",
"name": "Bot"
},
"conversation": {
"id": "k9247mmn33ig"
},
"recipient": {
"id": "default-user"
},
"membersAdded": [],
"membersRemoved": [],
"locale": "en-US",
"text": "Exception: An error occurred while sending the request.",
"attachments": [
{
"contentType": "text/plain",
"content": " at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Luis.LuisService.<Microsoft-Bot-Builder-Luis-ILuisService-QueryAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Luis.Extensions.<QueryAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.LuisDialog`1.<MessageReceived>d__8.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.<Rest>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.<Microsoft-Bot-Builder-Internals-Fibers-IWait<C>-PollAsync>d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop<C>-PollAsync>d__16.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter<T>.GetResult()\r\n at Microsoft.Bot.Builder.Dialogs.Chain.LoopDialog`1.<ResumeAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.<Rest>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.<Microsoft-Bot-Builder-Internals-Fibers-IWait<C>-PollAsync>d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop<C>-PollAsync>d__16.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__23.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ScoringEventLoop`1.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.EventLoopDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.SetAmbientThreadCulture.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.QueueDrainingDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()"
}
],
"entities": [],
"replyToId": "6hj7g24i9bgf",
"id": "974a35c985dd"
}
Extract of the error text (attachments.content):错误文本摘录(attachments.content):
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Luis.LuisService.<Microsoft-Bot-Builder-Luis-ILuisService-QueryAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Luis.Extensions.<QueryAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.LuisDialog`1.<MessageReceived>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.<Rest>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.<Microsoft-Bot-Builder-Internals-Fibers-IWait<C>-PollAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop<C>-PollAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter<T>.GetResult()
at Microsoft.Bot.Builder.Dialogs.Chain.LoopDialog`1.<ResumeAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.<Rest>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.<Microsoft-Bot-Builder-Internals-Fibers-IWait<C>-PollAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop<C>-PollAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ScoringEventLoop`1.<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.EventLoopDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.SetAmbientThreadCulture.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.QueueDrainingDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
You have several problems in your dialog implementation:您的对话框实现中有几个问题:
Have a look to the definition of LuisDialog
on GitHub : you will see that the call to LUIS is made in MessageReceived
method.查看GitHub 上
LuisDialog
的定义:您将看到对 LUIS 的调用是在MessageReceived
方法中进行的。 Or this method is called using context.Wait(MessageReceived);
或者使用
context.Wait(MessageReceived);
调用此方法context.Wait(MessageReceived);
which is never used in your dialog because you are overriding StartAsync(IDialogContext context)
.它从未在您的对话框中使用,因为您正在覆盖
StartAsync(IDialogContext context)
。
As a consequence, you wil never call LUIS and go into your methods matching the intents.因此,您永远不会调用 LUIS 并进入匹配意图的方法。
To correct that point, add context.Wait(MessageReceived);
要纠正这一点,请添加
context.Wait(MessageReceived);
after your welcome process, basically at the end of GetUserNameAfter
.在您的欢迎流程之后,基本上是在
GetUserNameAfter
结束时。
One important thing from the documentation : 文档中的一件重要事情:
Ensure all dialog methods end with a plan to handle the next message.
确保所有对话方法都以处理下一条消息的计划结束。
All IDialog methods should complete with
IDialogStack.Call
,IDialogStack.Wait
, orIDialogStack.Done
.所有 IDialog 方法都应使用
IDialogStack.Call
、IDialogStack.Wait
或IDialogStack.Done
。 TheseIDialogStack
methods are exposed through theIDialogContext
that is passed to every IDialog method.这些
IDialogStack
方法是通过暴露IDialogContext
传递给每IDialog方法。 CallingIDialogStack.Forward
and using the system prompts through thePromptDialog
static methods will call one of these methods in their implementation.调用
IDialogStack.Forward
并通过PromptDialog
静态方法使用系统提示将在其实现中调用这些方法之一。
If we follow the flow of your dialog, there are several points where you will be stuck:如果我们按照您的对话流程进行操作,您可能会卡在以下几点:
End of GetUserNameAfter
method execution, where you post a message to the user and then you are not waiting for a message or ending the dialog GetUserNameAfter
方法执行结束,您向用户发布消息,然后您无需等待消息或结束对话
End of SendMayIHelp
method execution, called by several methods ( RecordCV
, SearchJobAreaAfter
when count > 0, GetInfo
, ...), where you post a message to the user and then you are not waiting for a message or ending the dialog SendMayIHelp
方法执行结束,由多个方法调用( RecordCV
、 SearchJobAreaAfter
当 count > 0 时、 GetInfo
、...),您向用户发布消息,然后您无需等待消息或结束对话
In SearchJob
& GetFeedback
, you should not return Task.CompletedTask;
在
SearchJob
和GetFeedback
,您不应return Task.CompletedTask;
after starting a PromptDialog.Text
because this prompt will resume elsewhere.在启动
PromptDialog.Text
因为此提示将在其他地方恢复。 Add async
to your methods definitions将
async
添加到您的方法定义中
End of FeedbackAfter
method execution, where you post a message to the user and then you are not waiting for a message or ending the dialog结束
FeedbackAfter
方法执行后,您向用户发布消息,然后您无需等待消息或结束对话
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.