经过return await sc.BeginDialogAsync(nameof(MainDialog));
的10到15次
错误是:
错误“:[”请求有效负载无效。确保提供有效的 请求有效负载。“]
场景: 用途:企业Bot模板
发送后在主对话框中=> QnA答案结果是使用建议卡[竖起/按下拇指]要求反馈
如果用户选择“向上/向下竖起大拇指”,则他们可以结束对话框。 如果他们没有选择任何选项,则用户需要输入另一个需要再次通过Maindialog处理的查询(DISPATCH => LUIS / QnA)。
在我的情况下,没有给出反馈的用户将在10点后输入新查询 15次出现服务器错误。
var answers = await qnaService.GetAnswersAsync(dc.Context);
if (answers != null && answers.Count() > 0 && answers[0].Score >= _bestQnAScore)
{
string personalizedAnswer = DialogUtilities.PersonalizeAnswer(answers[0].Answer, _authResult, greetingInQNAAnswerSetting);
if (!string.IsNullOrEmpty(personalizedAnswer))
{
personalizedAnswer = StringUtils.URLBlankSpaceHelper(personalizedAnswer);
await dc.Context.SendActivityAsync(personalizedAnswer, personalizedAnswer, "acceptingInput");
string[] arrQnAMetadata = _configuration["QnAMetadata"].ToString().Split(',');
string stringToCheck = (answers[0].Metadata.Length > 0) ? answers[0].Metadata.FirstOrDefault().Value.ToLower() : string.Empty;
bool isChitChat = arrQnAMetadata.Any(stringToCheck.Contains);
if (!isChitChat)
{
await dc.BeginDialogAsync(nameof(FeedbackDialog), new VM_Luis_AuthResult(null, _authResult, _EnumDISPATCHIntent.ToString()));
}
else
{
#region OPEN/CLOSE TICKET
FeedbackLogger.LogUserFeedback(_authResult.UserEmail, dc.Context.Activity.Conversation.Id, dc.Context.Activity.Text, _authResult.Country, _authResult.City, _authResult.OfficeLocation, TicketState.Open, TicketStatus.None, ref this._topScoringIntent, ref this._ticketNumber);
FeedbackLogger.LogUserFeedback(_authResult.UserEmail, dc.Context.Activity.Conversation.Id, dc.Context.Activity.Text, _authResult.Country, _authResult.City, _authResult.OfficeLocation, TicketState.Closed, TicketStatus.Successful, ref this._topScoringIntent, ref this._ticketNumber);
#endregion
await dc.EndDialogAsync();
}
}
}
else
{
await _responder.ReplyWith(dc.Context, MainResponses.ResponseIds.Confused);
await dc.EndDialogAsync();
}
FeedbackDialog.cs
private async Task<DialogTurnResult> OnFeedbackResult(WaterfallStepContext sc, CancellationToken cancellationToken)
{
var res = Convert.ToString(sc.Result);
if (InterruptionsConstants.NegativeFeedback.Any(f => res.ToLower() == f))
{
await sc.Context.SendActivityAsync("Thank You!");
return await sc.EndDialogAsync();
}
else if (InterruptionsConstants.PositiveFeedback.Any(f => res.ToLower() == f))
{
await sc.Context.SendActivityAsync("Thank you very much");
return await sc.EndDialogAsync();
}
else
{
return await sc.BeginDialogAsync(nameof(MainDialog));
}
}