microsoft / botbuilder-tools

Welcome to the Bot Framework Tools repository, which is the home for a set of tools for developers building bots with the Microsoft Bot Framework
https://github.com/Microsoft/botframework
MIT License
444 stars 262 forks source link

[Dispatch] - hardcoded QnA Maker API version and region #1502

Closed erradimourad closed 3 years ago

erradimourad commented 3 years ago

Tool

Name: [|Dispatch] Version: 1.7.4 OS: Windows

Describe the bug

the dispatch tools doesn't work with the preview version of QnAMaker because it uses the incorrect endpoint and there's no option to change the endpoint.

To Reproduce

Steps to reproduce the behavior:

  1. Create a managed qna maker (preview) in the european region
  2. use the dispatch init and dispatch add -t qna with the needed parameters
  3. try the dispatch create the command will not work and you will notice two things: the region is set to westus(we can change this one) and the version is v4.0 instead of v5.0-preview.1 which is the API version used for the QNA maker preview version, see the screenshot below:

    Expected behavior

    the execution of the command should connect to the QNA KB and export its content using the correct API.

Screenshots

If applicable, add screenshots to help explain your problem. image

[bug]

tsuwandy commented 3 years ago

@erradimourad, latest dispatch cli version allows you to point to the preview version of QnA API.

Follow these steps:

  1. Where you Dispatch CLI is installed, ie C:\Users\tiens\AppData\Roaming\npm\node_modules\botdispatch\bin\netcoreapp2.1

  2. Edit appsettings.json, replace this line:

     "QnAMakerEndpointUrlFormat": "{0}/qnamaker/v4.0"

    with

    "QnAMakerEndpointUrlFormat": "{0}/qnamaker/v5.0-preview.1"

  3. In the folder where dispatch CLI is normally run from, edit *.dispatch file and add "region" field to the QnA data source, ie: "services": [ { "kbId": "8a707cd7-c07c-4575-942e-4f999ffc42fd", "subscriptionKey": "KEY", "type": "qna", "name": "TravelPolicy", "region": "westus", "id": "2" }

  4. Run "dispatch refresh" or "dispatch create" again

Let me know if you are having any issues with this.

erradimourad commented 3 years ago

thank you Tien, it works on my side. but i have another questions which is related to the proposed solution: if i have a customSubDomainName for my QNA service so the endpoint url will be

customSubDomainName.api.cognitive.microsoft.com/qnamaker/v5.0-preview.1

and which is different of :

region.api.cognitive.microsoft.com/qnamaker/v5.0-preview.1

i can hardcode the value of QnAMakerEndpointUrlFormat in the setting file but i'm trying to do some script automation to handle this case. any idea is much welcome.

tsuwandy commented 3 years ago

@erradimourad, would you get different result when using customSubDomainName.api.cognitive.microsoft.com/qnamaker/v5.0-preview.1 compared to region.api.cognitive.microsoft.com/qnamaker/v5.0-preview.1?

Looking at the custom url format, you could try using customSubDomainName as region value for the QnAMaker kb source in .dispatch file.

tsuwandy commented 3 years ago

@erradimourad, will close this issue as you could point to QnA preview API. Let me know if you are seeing other issues. Thanks!