天气技能Azure Web测试本身可以运行,但连接到Virtual Assistant时无法运行

时间:2019-09-25 09:13:27

标签: c# azure botframework

我正在尝试将实验性Weather技能添加到Virtual Assistant中,并通过Azure Web Test对其进行测试。 虚拟助手和天气技能都可以按照自己的方式工作,但是如果我使用botskills connect将技能附加到助手上,请重新发布并在Azure中进行测试,然后在虚拟助手中询问天气,提示“发送...发送失败”

检查“通道”页面时,我看到网关超时错误。

“向您的机器人发送此消息时出错:HTTP状态代码GatewayTimeout”

使用以下命令将技能附加到虚拟助手时

botskills connect --botName MyBotName-xxxxx --remoteManifest“ https://weatherskill-xxxxx.azurewebsites.net/api/skill/manifest” –luisFolder“(技能解决方案文件夹的路径)\ Deployment \ Resources \ LU \ en \” –cs --verbose

一切正常,直到收到此警告

”无法自动配置身份验证连接。 您的技能清单中没有Azure Active Directory v2身份验证连接。”​​

问题可能与此有关吗? 我该怎么解决?

我在这里发布评论中要求的代码。

编辑:我想提一下虚拟助手和这项技能也位于两个不同的Azure资源组中

从虚拟助手项目:

skills.json:

{
    "skills": [
        {
            "id": "WeatherSkill",
            "msaAppId": "obfuscated",
            "name": "WeatherSkill",
            "endpoint": "https://magicbotreplyweatherskill-xxxxxxx.azurewebsites.net/api/skill/messages",
            "description": "The weather skill provides an example of displaying the current weather using AccuWeather.",
            "authenticationConnections": [],
            "actions": [
                {
                    "id": "WeatherSkill_getForecast",
                    "definition": {
                        "description": "Showing the weather forecast.",
                        "slots": [
                            {
                                "name": "location",
                                "types": [
                                    "string"
                                ]
                            }
                        ],
                        "triggers": {
                            "utteranceSources": [
                                {
                                    "locale": "en",
                                    "source": [
                                        "WeatherSkill#GetForecast"
                                    ]
                                }
                            ]
                        }
                    }
                }
            ]
        }
    ]
}

appsettings.json:

{
  "oauthConnections": [],
  "microsoftAppId": "obfuscated",
  "microsoftAppPassword": "obfuscated",
  "contentModerator": {
    "key": "obfuscated"
  },
  "qnaMaker": {
    "endpoint": "https://magicbotreplyresourcegroup-qnahost-xxxxxxx.azurewebsites.net",
    "key": "obfuscated"
  },
  "blobStorage": {
    "connectionString": "DefaultEndpointsProtocol=https;AccountName=magicbotreplyresourcegro;AccountKey=obfuscated;EndpointSuffix=core.windows.net",
    "container": "transcripts"
  },
  "applicationInsights": {
    "InstrumentationKey": "obfuscated"
  },
  "botWebAppName": "MagicBotReplyResourceGroup-xxxxxxx",
  "luis": {
    "accountName": "MagicBotReplyResourceGroup-luis-xxxxxxx",
    "key": "obfuscated",
    "region": "westeurope"
  },
  "cosmosDb": {
    "authKey": "obfuscated",
    "collectionId": "botstate-collection",
    "cosmosDBEndpoint": "https://magicbotreplyresourcegroup-xxxx.documents.azure.com:443/",
    "databaseId": "botstate-db"
  },
  "WeatherApiKey": "obfuscated"
}

launchsettings.json:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:xxxx/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "VirtualAssistantTest1": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:xxxx/"
    }
  }
}

botname_en_dispatch.dispatch:

{
  "authoringRegion": "westeurope",
  "culture": "en-us",
  "hierarchical": true,
  "useAllTrainingData": false,
  "dontReviseUtterance": false,
  "copyLuisData": true,
  "normalizeDiacritics": true,
  "services": [
    {
      "intentName": "l_General",
      "appId": "obfuscated",
      "authoringKey": "obfuscated",
      "version": "0.1",
      "region": "westeurope",
      "type": "luis",
      "name": "MaGiCBoTen_General",
      "id": "1"
    },
    {
      "intentName": "q_Chitchat",
      "kbId": "obfuscated",
      "subscriptionKey": "obfuscated",
      "type": "qna",
      "name": "Chitchat",
      "id": "2"
    },
    {
      "intentName": "q_Faq",
      "kbId": "obfuscated",
      "subscriptionKey": "obfuscated",
      "type": "qna",
      "name": "Faq",
      "id": "3"
    }
  ],
  "serviceIds": [
    "1",
    "2",
    "3"
  ],
  "appId": "obfuscated",
  "authoringKey": "obfuscated",
  "version": "Dispatch",
  "region": "westeurope",
  "type": "dispatch",
  "name": "MaGiCBoTen_Dispatch"
}

cognitivemodels.json:

{
  "defaultLocale": "en-us",
  "cognitiveModels": {
    "en": {
      "dispatchModel": {
        "appid": "obfuscated",
        "name": "MagicBotReplyResourceGroupen_Dispatch",
        "authoringkey": "obfuscated",
        "subscriptionkey": "obfuscated",
        "authoringRegion": "westeurope",
        "type": "dispatch",
        "region": "westeurope"
      },
      "languageModels": [
        {
          "region": "westeurope",
          "authoringRegion": "westeurope",
          "subscriptionkey": "obfuscated",
          "name": "MagicBotReplyResourceGroupen_General",
          "appid": "obfuscated",
          "authoringkey": "obfuscated",
          "version": "0.1",
          "id": "General"
        }
      ],
      "knowledgebases": [
        {
          "hostname": "https://magicbotreplyresourcegroup-qnahost-xxxxxxx.azurewebsites.net",
          "name": "Chitchat",
          "kbId": "obfuscated",
          "subscriptionKey": "obfuscated",
          "id": "Chitchat",
          "endpointKey": "obfuscated"
        },
        {
          "hostname": "https://magicbotreplyresourcegroup-qnahost-xxxxxxx.azurewebsites.net",
          "name": "Faq",
          "kbId": "obfuscated",
          "subscriptionKey": "obfuscated",
          "id": "Faq",
          "endpointKey": "obfuscated"
        }
      ]
    }
  }
}

针对技能项目:

appsettings.json:

{
  "oauthConnections": [
    {
      "name": "",
      "provider": ""
    }
  ],
  "WeatherApiKey": "obfuscated",
  "microsoftAppId": "obfuscated",
  "microsoftAppPassword": "obfuscated",
  "blobStorage": {
    "connectionString": "DefaultEndpointsProtocol=https;AccountName=magicbotreplyweatherskil;AccountKey=obfuscated;EndpointSuffix=core.windows.net",
    "container": "transcripts"
  },
  "applicationInsights": {
    "InstrumentationKey": "obfuscated"
  },
  "luis": {
    "accountName": "magicbotreplyweatherskill-luis-yyyyyyy",
    "key": "obfuscated",
    "region": "westeurope"
  },
  "botWebAppName": "magicbotreplyweatherskill-yyyyyyy",
  "cosmosDb": {
    "authKey": "obfuscated",
    "collectionId": "botstate-collection",
    "cosmosDBEndpoint": "https://magicbotreplyweatherskill-xxxxx.documents.azure.com:443/",
    "databaseId": "botstate-db"
  }
}

launchsettings.json:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:xxxx/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WeatherSkill": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:xxxx/"
    }
  }
}

cognitivemodels.json:

{
  "defaultLocale": "en-us",
  "cognitiveModels": {
    "en": {
      "languageModels": [
        {
          "id": "General",
          "authoringKey": "obfuscated",
          "version": "0.1",
          "appId": "obfuscated",
          "authoringRegion": "westeurope",
          "subscriptionKey": "obfuscated",
          "name": "magicbotreplyweatherskillen_General",
          "region": "westeurope"
        },
        {
          "id": "WeatherSkill",
          "authoringKey": "obfuscated",
          "version": "0.1",
          "appId": "obfuscated",
          "authoringRegion": "westeurope",
          "subscriptionKey": "obfuscated",
          "name": "magicbotreplyweatherskillen_WeatherSkill",
          "region": "westeurope"
        }
      ]
    }
  }
}

1 个答案:

答案 0 :(得分:0)

似乎您在botname_en_dispatch.dispatch文件中缺少一个组成部分。从.dispatch文件指向技能的luis文件的第四项服务需要包括在内,其外观应类似于以下内容。您将需要调整path属性,以便它可以根据您的技能访问WeatherSkill.luis文件。

希望有帮助!

{
  "authoringRegion": "westeurope",
  "culture": "en-us",
  "hierarchical": true,
  "useAllTrainingData": false,
  "dontReviseUtterance": false,
  "copyLuisData": true,
  "normalizeDiacritics": true,
  "services": [
    {
      "intentName": "l_General",
      "appId": "obfuscated",
      "authoringKey": "obfuscated",
      "version": "0.1",
      "region": "westeurope",
      "type": "luis",
      "name": "MaGiCBoTen_General",
      "id": "1"
    },
    {
      "intentName": "q_Chitchat",
      "kbId": "obfuscated",
      "subscriptionKey": "obfuscated",
      "type": "qna",
      "name": "Chitchat",
      "id": "2"
    },
    {
      "intentName": "q_Faq",
      "kbId": "obfuscated",
      "subscriptionKey": "obfuscated",
      "type": "qna",
      "name": "Faq",
      "id": "3"
    },
    {
      "intentName": "WeatherSkill",
      "path": "https://magicbotreplyweatherskill-xxxxxxx.azurewebsites.net/Deployment/Resources/LU/en/WeatherSkill.luis",
      "type": "file",
      "name": "WeatherSkill",
      "id": "4"
    }
  ],
  "serviceIds": [
    "1",
    "2",
    "3",
    "4"
  ],
  "appId": "obfuscated",
  "authoringKey": "obfuscated",
  "version": "Dispatch",
  "region": "westeurope",
  "type": "dispatch",
  "name": "MaGiCBoTen_Dispatch"
}