【问题标题】:How to configure multiple QnA models inside projects appsettings.json?如何在项目 appsettings.json 中配置多个 QnA 模型?
【发布时间】:2019-09-17 09:44:32
【问题描述】:

我有一个使用 Dispatch 工具在 Luis & QnA 模型上运行的机器人。现在这里的问题是我已经制作了另一个 QnA 模型,我想在我的机器人项目中配置它,即我想更新我的 c# 项目的 appsettings.json 中的知识库 ID。 我怎样才能做到这一点?因为没有我的第二个 QnA 没有被选中。

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },

  "MicrosoftAppId": "xxxxxxxxxxxxx",
  "MicrosoftAppPassword": "xxxxxxxxxxxxxxxx",

  "QnAKnowledgebaseId": "xxxxxxxxxxxx",
  "QnAAuthKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "QnAEndpointHostName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

   "QnAKnowledgebaseId": "xxxxxxxxxxxx",
  "QnAAuthKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "QnAEndpointHostName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",



  "LuisAppId": "xxxxxxxxxxxxxxxxxxxx",
  "LuisAPIKey": "xxxxxxxxxxxxxxxxxxxxx",
  "LuisAPIHostName": "xxxxxx",



 `enter code here`"AllowedHosts": "*"
}

【问题讨论】:

    标签: c# botframework dispatch qnamaker


    【解决方案1】:

    您为什么不能在应用设置中将其设置为 MODELNAME_QnAKnowledgebaseId 等,然后使用简单的 switch case 或在您的机器人中调用它?

    },
    
      "MicrosoftAppId": "xxxxxxxxxxxxx",
      "MicrosoftAppPassword": "xxxxxxxxxxxxxxxx",
    
      "MODEL1_QnAKnowledgebaseId": "xxxxxxxxxxxx",
      "MODEL1_QnAAuthKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "MODEL1_QnAEndpointHostName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    
      "MODEL2_QnAKnowledgebaseId": "xxxxxxxxxxxx",
      "MODEL2_QnAAuthKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "MODEL2_QnAEndpointHostName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    
      "LuisAppId": "xxxxxxxxxxxxxxxxxxxx",
      "LuisAPIKey": "xxxxxxxxxxxxxxxxxxxxx",
      "LuisAPIHostName": "xxxxxx",
    
     "AllowedHosts": "*"
    }
    
    

    然后在您的 BotServices 中:

    
    public BotServices(IConfiguration configuration)
            {
                // Read the setting for cognitive services (LUIS, QnA) from the appsettings.json
    
                MODEL1_QnA = new QnAMaker(new QnAMakerEndpoint
                {
                    KnowledgeBaseId = configuration["MODEL1_QnAKnowledgebaseId"],
                    EndpointKey = configuration["MODEL1_QnAEndpointKey"],
                    Host = configuration["MODEL1_QnAEndpointHostName"]
                });
            }
    

    【讨论】:

    • 在这样实现时..我的机器人停止工作..我已经调试并在我的 BotServices 类中进行更改..这件事发生了
    • 我正在为多个 qna 知识库使用单个 qna 服务。这是正确的方法还是我们必须为每个知识库创建多个服务?
    猜你喜欢
    • 1970-01-01
    • 2021-10-10
    • 2020-03-01
    • 2011-10-11
    • 1970-01-01
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多