【发布时间】:2019-02-03 01:05:59
【问题描述】:
我已经从 GitHub 下载、配置和部署了 Microsoft Virtual Assistant 开源项目:https://github.com/Microsoft/AI
我想从日历技能开始,并且已经配置了一切。 当我请求我当前的日历条目时,身份验证提示会显示在 botframework 模拟器中,我可以使用我的 Azure AD 帐户进行身份验证。
之后,一片寂静……
在 CalendarSkill 的 SummaryDialog.cs 中有一个 WaterfallStep 的定义,如下所示:
var showSummary = new WaterfallStep[]
{
GetAuthToken,
AfterGetAuthToken,
ShowEventsSummary,
CallReadEventDialog,
AskForShowOverview,
AfterAskForShowOverview
};
GetAuthToken 步骤已执行,但随后执行停止。 AfterGetAuthToken 根本没有被调用。
这是项目内部的GetAuthToken函数:
protected async Task<DialogTurnResult> GetAuthToken(WaterfallStepContext sc, CancellationToken cancellationToken)
{
try
{
var skillOptions = (CalendarSkillDialogOptions)sc.Options;
// If in Skill mode we ask the calling Bot for the token
if (skillOptions != null && skillOptions.SkillMode)
{
// We trigger a Token Request from the Parent Bot by sending a "TokenRequest" event back and then waiting for a "TokenResponse"
// TODO Error handling - if we get a new activity that isn't an event
var response = sc.Context.Activity.CreateReply();
response.Type = ActivityTypes.Event;
response.Name = "tokens/request";
// Send the tokens/request Event
await sc.Context.SendActivityAsync(response);
// Wait for the tokens/response event
return await sc.PromptAsync(SkillModeAuth, new PromptOptions());
}
else
{
return await sc.PromptAsync(nameof(MultiProviderAuthDialog), new PromptOptions());
}
}
catch (SkillException ex)
{
await HandleDialogExceptions(sc, ex);
return new DialogTurnResult(DialogTurnStatus.Cancelled, CommonUtil.DialogTurnResultCancelAllDialogs);
}
catch (Exception ex)
{
await HandleDialogExceptions(sc, ex);
return new DialogTurnResult(DialogTurnStatus.Cancelled, CommonUtil.DialogTurnResultCancelAllDialogs);
}
}
我在代码中做错了什么还是我的配置中缺少任何东西?
【问题讨论】:
-
嗨,Franz,您愿意分享一下您是如何在 appSettings 中配置 oauthConnections 的吗?谢谢
标签: azure-active-directory botframework