在 Azure 上更新我的代码后,我的 Cortana 技能显示 InternalServerError

My Cortana skill shows InternalServerError after updating my code on Azure

我使用 bot 框架和 LUIS 编写了一个简单的 cortana 技能,部署它,一切正常。

之前我更新了代码并上传到 Azure,然后当 Cortana 尝试启动该技能时我得到了这个 InternalServerError。然后我切换回以前的代码,但仍然出现相同的错误。

但是,Bot Framework 门户的聊天 window 在两个版本中都可以正常工作。模拟器也能正常工作。

有人可以帮忙吗?提前致谢。

这是详细的错误信息。

{
  "error": {
    "botId": "dumbot_carina",
    "botRequest": {
      "type": "message",
      "id": "Dxu2FN06OUb",
      "timestamp": "2017-08-24T10:11:57.8258747Z",
      "serviceUrl": "https://CortanaBFChannelWestUS.azurewebsites.net/",
      "channelId": "cortana",
      "from": {
        "id": "9057CB40B3D426035920CA7B7E2995332082556FE830F719B877D774D2790155"
      },
      "conversation": {
        "id": "46191e3e-57b6-48b2-b804-164d6afc3840"
      },
      "recipient": {
        "id": "dumbot_carina"
      },
      "locale": "en-US",
      "entities": [
        {
          "type": "Intent",
          "name": "Microsoft.Launch"
        },
        {
          "type": "DeviceInfo",
          "supportsDisplay": "true"
        }
      ],
      "channelData": {
        "skillId": "abec8214-0a15-4e47-aa7a-37db6faf2cd3",
        "skillProductId": "3c2f525c-1917-4f5f-8275-6173a37bb1ee",
        "isDebug": true
      }
    },
    "error": "Bot service failed with status code: InternalServerError"
  },
  "traceId": "0f0bb690-ee99-4c92-bf2e-067ff41dfa32"
}

当我在 dev portal it is showing errors for both webchat and Cortana. These errors are generic and generally mean that the issue is with your bot's code. So it's going to be really hard to help you without seeing your code. Have you tried debugging in the Emulator or using ngrok?

中查看您的机器人时

我发现了问题,因为我的应用程序无法处理空消息,所以当我说 "ask dumbot something" 时它会工作,但只有 "ask dumbot" 会失败。但是因为模拟器和聊天 window 不允许空消息,所以它们没问题。

它是 known issues for Bot Framework Skills 之一。

LuisDialog 在启动技能时失败

When a skill is launched without an utterance (i.e. "Open ", "Ask "), the activity.Text value is null. When this is passed into the LuisDialog, it throws an error. To address this you can override the MessageRecieved method and add a null check as shown below.

/// <summary>
/// Need to override the LuisDialog.MessageReceived method so that we can detect when the user invokes the skill without
/// specifying a phrase, for example: "Open Hotel Finder", or "Ask Hotel Finder". In these cases, the message received will be an empty string
/// </summary>
/// <param name="context"></param>
/// <param name="item"></param>
/// <returns></returns>
protected override async Task MessageReceived(IDialogContext context, IAwaitable<IMessageActivity> item)
{
    // Check for empty query
    var message = await item;
    if (string.isNullOrEmpty(message.Text))
    {
        // Return the Help/Welcome
        await Help(context, null);
    }
    else
    {
        await base.MessageReceived(context, item);
    }
}