【问题标题】:LUIS Code works in channel (iframe) but fails in emulatorLUIS 代码在通道(iframe)中工作,但在模拟器中失败
【发布时间】:2017-09-09 05:20:46
【问题描述】:

当我将以下代码同步到我的 Git 项目并在我的 Azure Bot 实例通道上进行测试时,我的以下代码运行良好:

[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
    string s = string.Empty;
    string name = string.Empty;

    var entities = new List<EntityRecommendation>(result.Entities);
    if (entities.Any((entity) => entity.Type == "ClientName"))
    {
        var clientName = entities.Where((entity) => entity.Type == "ClientName").First();
        name = clientName.Entity;
        s += "Your name is " + name;
    }
    else
    {
        s += "What is your name?";
    }
    await context.PostAsync($"You gave a greeting. {s}");
    context.Wait(MessageReceived);
}

但是当我在模拟器上运行它时,我收到“抱歉,我的机器人代码有问题”。出现以下错误:

发生了 ScriptHost 错误 执行函数时出现异常:Functions.messages。 Microsoft.Bot.Builder: 值不能为空。 参数名称:modelID。

最重要的是我收到警告:

找不到程序集“Microsoft.Bot.Builder.resources,版本=3.9.0.0, 文化=en-US,PublicKeyToken=31bf3856ad364e35'。您是否缺少私人 汇编文件?

如何让它在我的模拟器上运行?在将其推送到我的实例之前,我宁愿先在本地对其进行测试。

【问题讨论】:

  • 我会删除并阅读 BotBuilder nuget 包
  • 嗨,我该怎么做?我的解决方案中没有 Nuget 包管理器。我从 Azure 门户下载了代码。我尝试从 project.json 和 messages.csproj 中注释掉 Microsoft.Bot.Builder 包,但这对我的问题没有任何影响。

标签: c# azure-language-understanding azure-bot-service


【解决方案1】:

我能够通过硬编码我的 LUISApiKeyLUISAppID 进行本地调试。我从门户 > MyAzureBot > 设置 > 应用程序设置中获得了这些值。

他们在本周末推出了一些新的更改 - 从门户下载的 Bot Service 项目不再是 CSX,它们看起来像常规的 Web 项目,因此现在可以使用 nuget 包管理器。但即使正确安装了 nuget 包,它仍然存在上述相同的错误。这次我可以卸载并重新安装它,我实际上可以看到 /bin 文件夹。那里的 Bot Builder 包仍然存在同样的错误。

我仍然想要一个非黑客解决方案。但是这个目前运行良好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-16
    • 2013-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多