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

时间:2017-08-24 11:35:48

标签: botframework luis cortana cortana-skills-kit

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

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

然而,Bot Framework门户的聊天窗口适用于这两个版本。模拟器也可以正常工作。

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

这是详细的错误消息。

{
  "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"
}

2 个答案:

答案 0 :(得分:1)

当我在dev portal中查看您的机器人时,它显示网络聊天和Cortana的错误。这些错误是通用的,通常意味着问题出在机器人的代码中。因此,如果没有看到您的代码,您将很难帮助您。您是否尝试过调试Emulator或使用ngrok

enter image description here

答案 1 :(得分:1)

我发现了问题,因为我的应用程序无法处理空消息,因此当我说“询问dumbot某些东西”时它会起作用,但只有“问dumbot”才会失败。但是因为模拟器和聊天窗口不允许空消息所以它们没问题。

这是known issues for Bot Framework Skills之一。

LuisDialog在技能发布时失败

  

如果在没有话语的情况下启动技能(即“打开”,“询问”),则activity.Text值为空。   当这被传递到LuisDialog时,它会抛出一个错误。至   解决此问题,您可以覆盖MessageRecieved方法并添加一个   null check,如下所示。

/// <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);
    }
}