diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/general.lu b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/General.lu similarity index 99% rename from skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/general.lu rename to skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/General.lu index bbbf8ca9b6..954456c397 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/general.lu +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/General.lu @@ -561,4 +561,4 @@ $PREBUILT:ordinal > # List entities -> # RegEx entities \ No newline at end of file +> # RegEx entities diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings.lu b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/Settings.lu similarity index 100% rename from skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings.lu rename to skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/Settings.lu diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_dispatch.lu b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsDispatch.lu similarity index 100% rename from skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_dispatch.lu rename to skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsDispatch.lu diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_name.lu b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsName.lu similarity index 100% rename from skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_name.lu rename to skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsName.lu diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_value.lu b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsValue.lu similarity index 100% rename from skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/settings_value.lu rename to skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/LU/en/SettingsValue.lu diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/template.json b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/template.json index c5a800f089..a962277a51 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/template.json +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Resources/template.json @@ -191,13 +191,17 @@ } ], "outputs": { + "botWebAppName": { + "type": "string", + "value": "[parameters('botWebAppName')]" + }, "ApplicationInsights": { "type": "object", "value": { "InstrumentationKey": "[reference(resourceId('Microsoft.Insights/components', parameters('appInsightsName'))).InstrumentationKey]" } }, - "storage": { + "blobStorage": { "type": "object", "value": { "connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('cleanStorageAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('cleanStorageAccountName')), '2018-07-01').keys[0].value, ';EndpointSuffix=core.windows.net')]", @@ -208,7 +212,7 @@ "type": "object", "value": { "cosmosDBEndpoint": "[reference(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName'))).documentEndpoint]", - "authkey": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName')), '2015-04-08').primaryMasterKey]", + "authKey": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName')), '2015-04-08').primaryMasterKey]", "databaseId": "botstate-db", "collectionId": "botstate-collection" } @@ -216,6 +220,7 @@ "luis": { "type": "object", "value": { + "accountName": "[parameters('luisServiceName')]", "key": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', parameters('luisServiceName')),'2017-04-18').key1]" } } diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 index 47e87dc943..0b79e0c717 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 @@ -113,6 +113,7 @@ if ($parametersFile) { --parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`"" if ($validation) { + $validation >> $logFile $validation = $validation | ConvertFrom-Json if (-not $validation.error) { @@ -125,8 +126,9 @@ if ($parametersFile) { --parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`"" } else { - Write-Host "! Template is not valid with provided parameters." -ForegroundColor DarkRed + Write-Host "! Template is not valid with provided parameters. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta Break } @@ -140,6 +142,7 @@ else { --parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`"" if ($validation) { + $validation >> $logFile $validation = $validation | ConvertFrom-Json if (-not $validation.error) { @@ -151,8 +154,9 @@ else { --parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`"" } else { - Write-Host "! Template is not valid with provided parameters." -ForegroundColor DarkRed - Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed + Write-Host "! Template is not valid with provided parameters. Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta Break } @@ -171,6 +175,8 @@ if ($outputs) # Log and convert to JSON $outputs >> $logFile $outputs = $outputs | ConvertFrom-Json + $outputMap = @{} + $outputs.PSObject.Properties | Foreach-Object { $outputMap[$_.Name] = $_.Value } # Update appsettings.json Write-Host "> Updating appsettings.json ..." @@ -183,21 +189,19 @@ if ($outputs) $settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId $settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword - if ($outputs.ApplicationInsights) { $settings | Add-Member -Type NoteProperty -Force -Name 'ApplicationInsights' -Value $outputs.ApplicationInsights.value } - if ($outputs.storage) { $settings | Add-Member -Type NoteProperty -Force -Name 'blobStorage' -Value $outputs.storage.value } - if ($outputs.cosmosDb) { $settings | Add-Member -Type NoteProperty -Force -Name 'cosmosDb' -Value $outputs.cosmosDb.value } - if ($outputs.contentModerator) { $settings | Add-Member -Type NoteProperty -Force -Name 'contentModerator' -Value $outputs.contentModerator.value } - + foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value } $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json) + + if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key } # Delay to let QnA Maker finish setting up Start-Sleep -s 30 # Deploy cognitive models - Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -outFolder `"$($projDir)`" -languages `"$($languages)`"" + Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" # Publish bot - Invoke-Expression "$(Join-Path $PSScriptRoot 'publish.ps1') -name $($name) -resourceGroup $($resourceGroup) -projFolder `"$($projDir)`"" + Invoke-Expression "& '$(Join-Path $PSScriptRoot 'publish.ps1')' -name $($outputs.botWebAppName.value) -resourceGroup $($resourceGroup) -projFolder '$($projDir)'" Write-Host "> Done." } @@ -232,4 +236,4 @@ else Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta Break -} +} \ No newline at end of file diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy_cognitive_models.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy_cognitive_models.ps1 index 47644591b0..22b708c23c 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy_cognitive_models.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy_cognitive_models.ps1 @@ -4,13 +4,18 @@ Param( [string] $name, [string] $luisAuthoringRegion, [string] $luisAuthoringKey, + [string] $luisAccountName, + [string] $luisSubscriptionKey, + [string] $qnaSubscriptionKey, + [string] $resourceGroup, + [switch] $useDispatch, [string] $languages = "en-us", [string] $outFolder = $(Get-Location), [string] $logFile = $(Join-Path $PSScriptRoot .. "deploy_cognitive_models_log.txt") ) . $PSScriptRoot\luis_functions.ps1 - +. $PSScriptRoot\qna_functions.ps1 # Reset log file if (Test-Path $logFile) { @@ -23,7 +28,6 @@ else { # Get mandatory parameters if (-not $name) { $name = Read-Host "? Base name for Cognitive Models" - $resourceGroup = $name } if (-not $luisAuthoringRegion) { @@ -55,6 +59,43 @@ if (-not $luisAuthoringKey) { } } +if (-not $luisAccountName) { + $luisAccountName = Read-Host "? LUIS Service Name (exising service in Azure required)" +} + +if (-not $resourceGroup) { + $resourceGroup = $name + + $rgExists = az group exists -n $resourceGroup + if ($rgExists -eq "false") + { + $resourceGroup = Read-Host "? LUIS Service Resource Group (exising service in Azure required)" + } +} + +if (-not $luisSubscriptionKey) { + $keys = az cognitiveservices account keys list --name $luisAccountName --resource-group $resourceGroup | ConvertFrom-Json + + if ($keys) { + $luisSubscriptionKey = $keys.key1 + } + else { + Write-Host "! Could not retrieve LUIS Subscription Key." -ForgroundColor DarkRed + Write-Host "+ Verify the -luisAccountName and -resourceGroup parameters are correct." -ForegroundColor Magenta + Break + } +} + +if (-not $qnaSubscriptionKey) { + $useQna = $false +} +else { + $useQna = $true +} + +$azAccount = az account show | ConvertFrom-Json +$azAccessToken = $(Invoke-Expression "az account get-access-token") | ConvertFrom-Json + # Get languages $languageArr = $languages -split "," @@ -66,36 +107,183 @@ Write-Host "> Deploying cognitive models ..." foreach ($language in $languageArr) { $langCode = ($language -split "-")[0] + $config = New-Object PSObject - $config = @{ - languageModels = @() - } + if ($useDispatch) { + # Add dispatch to config + $config | Add-Member -MemberType NoteProperty -Name dispatchModel -Value $(New-Object PSObject) + + # Initialize Dispatch + Write-Host "> Initializing dispatch model ..." + $dispatchName = "$($name)$($langCode)_Dispatch" + $dataFolder = Join-Path $PSScriptRoot .. Resources Dispatch $langCode + (dispatch init ` + --name $dispatchName ` + --luisAuthoringKey $luisAuthoringKey ` + --luisAuthoringRegion $luisAuthoringRegion ` + --dataFolder $dataFolder) 2>> $logFile | Out-Null + } # Deploy LUIS apps $luisFiles = Get-ChildItem "$(Join-Path $PSScriptRoot .. 'Resources' 'LU' $langCode)" | Where {$_.extension -eq ".lu"} - foreach ($lu in $luisFiles) - { - # Deploy LUIS model - $luisApp = DeployLUIS -name $name -lu_file $lu -region $luisAuthoringRegion -luisAuthoringKey $luisAuthoringKey -language $language -log $logFile + if ($luisFiles) { + $config | Add-Member -MemberType NoteProperty -Name languageModels -Value @() + + foreach ($lu in $luisFiles) + { + # Deploy LUIS model + $luisApp = DeployLUIS ` + -name $name ` + -lu_file $lu ` + -region $luisAuthoringRegion ` + -luisAuthoringKey $luisAuthoringKey ` + -language $language ` + -log $logFile - if ($luisApp) { - # Add to config - $config.languageModels += @{ - id = $lu.BaseName - name = $luisApp.name - appid = $luisApp.id - authoringkey = $luisAuthoringKey - subscriptionkey = $luisAuthoringKey - version = $luisApp.activeVersion - region = $luisAuthoringRegion + Write-Host "> Setting LUIS subscription key ..." + if ($luisApp) { + # Setting subscription key + $addKeyResult = luis add appazureaccount ` + --appId $luisApp.id ` + --authoringKey $luisAuthoringKey ` + --region $luisAuthoringRegion ` + --accountName $luisAccountName ` + --azureSubscriptionId $azAccount.id ` + --resourceGroup $resourceGroup ` + --armToken "$($azAccessToken.accessToken)" 2>> $logFile + + if (-not $addKeyResult) { + $luisKeySet = $false + Write-Host "! Could not assign subscription key automatically. Review the log for more information. " -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Write-Host "+ Please assign your subscription key manually in the LUIS portal." -ForegroundColor Magenta + } + + if ($useDispatch) { + # Add luis app to dispatch + Write-Host "> Adding $($lu.BaseName) app to dispatch model ..." + (dispatch add ` + --type "luis" ` + --name $luisApp.name ` + --id $luisApp.id ` + --region $luisApp.region ` + --intentName "l_$($lu.BaseName)" ` + --dataFolder $dataFolder ` + --dispatch "$(Join-Path $dataFolder "$($dispatchName).dispatch")") 2>> $logFile | Out-Null + } + + # Add to config + $config.languageModels += @{ + id = $lu.BaseName + name = $luisApp.name + appid = $luisApp.id + authoringkey = $luisAuthoringKey + subscriptionkey = $luisSubscriptionKey + version = $luisApp.activeVersion + region = $luisAuthoringRegion + } + } + else { + Write-Host "! Could not create LUIS app. Skipping dispatch add." -ForegroundColor Cyan } + } + } + + if ($useQna) { + if (Test-Path $(Join-Path $PSScriptRoot .. 'Resources' 'QnA' $langCode)) { + # Deploy QnA Maker KBs + $qnaFiles = Get-ChildItem "$(Join-Path $PSScriptRoot .. 'Resources' 'QnA' $langCode)" -Recurse | Where {$_.extension -eq ".lu"} + + if ($qnaFiles) { + $config | Add-Member -MemberType NoteProperty -Name knowledgebases -Value @() + + foreach ($lu in $qnaFiles) + { + # Deploy QnA Knowledgebase + $qnaKb = DeployKB -name $name -lu_file $lu -qnaSubscriptionKey $qnaSubscriptionKey -log $logFile + + if ($qnaKb) { + if ($useDispatch) { + Write-Host "> Adding $($lu.BaseName) kb to dispatch model ..." + (dispatch add ` + --type "qna" ` + --name $qnaKb.name ` + --id $qnaKb.id ` + --key $qnaSubscriptionKey ` + --intentName "q_$($lu.BaseName)" ` + --dataFolder $dataFolder ` + --dispatch "$(Join-Path $dataFolder "$($dispatchName).dispatch")") 2>> $logFile | Out-Null + } + + # Add to config + $config.knowledgebases += @{ + id = $lu.BaseName + name = $qnaKb.name + kbId = $qnaKb.kbId + subscriptionKey = $qnaKb.subscriptionKey + endpointKey = $qnaKb.endpointKey + hostname = $qnaKb.hostname + } + } + else { + Write-Host "! Could not create knowledgebase. Skipping dispatch add." -ForegroundColor Cyan + } + } + } + } + else { + Write-Host "! No knowledgebases found. Skipping." -ForegroundColor Cyan + } + } + else { + Write-Host "! No QnA Maker Subscription Key provided. Skipping knowledgebases." -ForegroundColor Cyan + } + + if ($useDispatch) { + # Create dispatch model + Write-Host "> Creating dispatch model..." + $dispatch = (dispatch create ` + --dispatch "$(Join-Path $dataFolder "$($dispatchName).dispatch")" ` + --dataFolder $dataFolder ` + --culture $language) 2>> $logFile - RunLuisGen $lu "$($lu.BaseName)" $(Join-Path $outFolder Services) + if (-not $dispatch) { + Write-Host "! Could not create Dispatch app. Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break } else { - Write-Host "! Deployment failed for LUIS app: $($lu.BaseName)" -ForegroundColor Cyan + $dispatchApp = $dispatch | ConvertFrom-Json + + # Setting subscription key + Write-Host "> Setting LUIS subscription key ..." + $addKeyResult = luis add appazureaccount ` + --appId $dispatchApp.appId ` + --accountName $luisAccountName ` + --authoringKey $luisAuthoringKey ` + --region $luisAuthoringRegion ` + --azureSubscriptionId $azAccount.id ` + --resourceGroup $resourceGroup ` + --armToken $azAccessToken.accessToken 2>> $logFile + + if (-not $addKeyResult) { + $luisKeySet = $false + Write-Host "! Could not assign subscription key automatically. Review the log for more information. " -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Write-Host "+ Please assign your subscription key manually in the LUIS portal." -ForegroundColor Magenta + } + + # Add to config + $config.dispatchModel = @{ + type = "dispatch" + name = $dispatchApp.name + appid = $dispatchApp.appId + authoringkey = $luisauthoringkey + subscriptionkey = $luisSubscriptionKey + region = $luisAuthoringRegion + } } - } + } # Add config to cognitivemodels dictionary $settings.cognitiveModels | Add-Member -Type NoteProperty -Force -Name $langCode -Value $config diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/luis_functions.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/luis_functions.ps1 index 04907c3754..3096c24a54 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/luis_functions.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/luis_functions.ps1 @@ -37,13 +37,13 @@ function DeployLUIS ($name, $lu_file, $region, $luisAuthoringKey, $language, $lo } } -function UpdateLUIS ($lu_file, $appId, $version, $authoringKey, $subscriptionKey, $log) +function UpdateLUIS ($lu_file, $appId, $version, $region, $authoringKey, $subscriptionKey, $log) { $id = $lu_file.BaseName $outFile = "$($id).luis" $outFolder = $lu_file.DirectoryName - $luisApp = luis get application --appId $appId --authoringKey $authoringKey | ConvertFrom-Json + $luisApp = luis get application --appId $appId --region $region --authoringKey $authoringKey | ConvertFrom-Json # Parse LU file Write-Host "> Parsing $($id) LU file ..." @@ -53,10 +53,11 @@ function UpdateLUIS ($lu_file, $appId, $version, $authoringKey, $subscriptionKey --out_folder $outFolder ` --out $outFile - Write-Host "? Getting current versions ..." + Write-Host "> Getting current versions ..." # Get list of current versions $versions = luis list versions ` --appId $appId ` + --region $region ` --authoringKey $authoringKey | ConvertFrom-Json # If the current version exists @@ -69,6 +70,7 @@ function UpdateLUIS ($lu_file, $appId, $version, $authoringKey, $subscriptionKey luis delete version ` --appId $appId ` --versionId "backup" ` + --region $region ` --authoringKey $authoringKey ` --force --wait | Out-Null } @@ -78,6 +80,7 @@ function UpdateLUIS ($lu_file, $appId, $version, $authoringKey, $subscriptionKey luis rename version ` --appId $appId ` --versionId $version ` + --region $region ` --newVersionId backup ` --authoringKey $authoringKey ` --subscriptionKey $subscriptionKey ` @@ -89,14 +92,15 @@ function UpdateLUIS ($lu_file, $appId, $version, $authoringKey, $subscriptionKey luis import version ` --appId $appId ` --versionId $version ` + --region $region ` --authoringKey $authoringKey ` --subscriptionKey $subscriptionKey ` --in "$(Join-Path $outFolder $outFile)" ` --wait | ConvertFrom-Json # train and publish luis app - $(luis train version --appId $appId --authoringKey $authoringKey --versionId $version --wait - & luis publish version --appId $appId --authoringKey $authoringKey --versionId $version --wait) 2>&1 | Out-Null + $(luis train version --appId $appId --region $region --authoringKey $authoringKey --versionId $version --wait + & luis publish version --appId $appId --region $region --authoringKey $authoringKey --versionId $version --wait) 2>&1 | Out-Null } function RunLuisGen($lu_file, $outName, $outFolder) { diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/publish.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/publish.ps1 index 7fbd70786a..d06cbc9df6 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/publish.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/publish.ps1 @@ -4,7 +4,7 @@ Param( [string] $name, [string] $resourceGroup, [string] $projFolder = $(Get-Location), - [string] $logFile = $(Join-Path $PSScriptRoot .. "publish.txt") + [string] $logFile = $(Join-Path $PSScriptRoot .. "publish_log.txt") ) # Reset log file diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/qna_functions.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/qna_functions.ps1 new file mode 100644 index 0000000000..cac35fae67 --- /dev/null +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/qna_functions.ps1 @@ -0,0 +1,87 @@ +function DeployKB ($name, $lu_file, $qnaSubscriptionKey, $log) +{ + $id = $lu_file.BaseName + $outFile = "$($id).qna" + $outFolder = $lu_file.DirectoryName + + # Parse LU file + Write-Host "> Parsing $($id) LU file ..." + ludown parse toqna ` + --in $lu_file ` + --out_folder $outFolder ` + --out $outFile + + # Create QnA Maker kb + Write-Host "> Deploying $($id) QnA kb ..." + + # These values pretty much guarantee success. We can decrease them if the QnA backend gets faster + $initialDelaySeconds = 30; + $retryAttemptsRemaining = 3; + $retryDelaySeconds = 15; + $retryDelayIncrease = 30; + + while ($retryAttemptsRemaining -ge 0) { + $qnaKb = (qnamaker create kb ` + --name $id ` + --subscriptionKey $qnaSubscriptionKey ` + --in $(Join-Path $outFolder $outFile) ` + --force ` + --wait ` + --msbot) 2>> $log + + if (-not $qnaKb) { + $retryAttemptsRemaining = $retryAttemptsRemaining - 1 + Write-Host $retryAttemptsRemaining + Start-Sleep -s $retryDelaySeconds + $retryDelaySeconds += $retryDelayIncrease + + if ($retryAttemptsRemaining -lt 0) { + Write-Host "! Unable to create QnA KB." -ForegroundColor Cyan + } + else { + Write-Host "> Retrying ..." + Continue + } + } + else { + Break + } + } + + if (-not $qnaKb) { + Write-Host "! Could not deploy knowledgebase. Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($log)" -ForegroundColor DarkRed + Return $null + } + else { + $qnaKb = $qnaKb | ConvertFrom-Json + + # Publish QnA Maker knowledgebase + $(qnamaker publish kb --kbId $qnaKb.kbId --subscriptionKey $qnaSubscriptionKey) 2>> $log | Out-Null + + Return $qnaKb + } +} + +function UpdateKB ($lu_file, $kbId, $qnaSubscriptionKey) +{ + $id = $lu_file.BaseName + $outFile = "$($id).qna" + $outFolder = $lu_file.DirectoryName + + # Parse LU file + Write-Host "> Parsing $($id) LU file ..." + ludown parse toqna ` + --in $lu_file ` + --out_folder $outFolder ` + --out $outFile + + Write-Host "> Replacing $($id) QnA kb ..." + qnamaker replace kb ` + --in $(Join-Path $outFolder $outFile) ` + --kbId $kbId ` + --subscriptionKey $qnaSubscriptionKey + + # Publish QnA Maker knowledgebase + $(qnamaker publish kb --kbId $kbId --subscriptionKey $qnaSubscriptionKey) 2>&1 | Out-Null +} diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/update_cognitive_models.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/update_cognitive_models.ps1 index 7c239a9699..e015ff3a63 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/update_cognitive_models.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/update_cognitive_models.ps1 @@ -1,8 +1,8 @@ #Requires -Version 6 Param( - [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [switch] $RemoteToLocal, + [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [string] $dispatchFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'Dispatch'), [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), [string] $qnaFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'QnA'), @@ -30,30 +30,57 @@ foreach ($langCode in $languageMap.Keys) { $models = $languageMap[$langCode] $dispatch = $models.dispatchModel - if($RemoteToLocal) + if ($RemoteToLocal) { # Update local LU files based on hosted models foreach ($luisApp in $models.languageModels) { + $culture = (luis get application ` + --appId $luisApp.appId ` + --authoringKey $luisApp.authoringKey ` + --subscriptionKey $luisApp.subscriptionKey ` + --region $luisApp.region | ConvertFrom-Json).culture + Write-Host "> Updating local $($luisApp.id).lu file ..." luis export version ` --appId $luisApp.appid ` --versionId $luisApp.version ` + --region $luisApp.region ` --authoringKey $luisApp.authoringKey | ludown refresh ` --stdin ` -n "$($luisApp.id).lu" ` -o $(Join-Path $luisFolder $langCode) - + + # Parse LU file + $id = $luisApp.id + $outFile = "$($id).luis" + $outFolder = $(Join-Path $luisFolder $langCode) + $appName = "$($name)$($langCode)_$($id)" + + Write-Host "> Parsing $($luisApp.id) LU file ..." + ludown parse toluis ` + --in $(Join-Path $outFolder "$($luisApp.id).lu") ` + --luis_culture $culture ` + --out_folder $(Join-Path $luisFolder $langCode) ` + --out "$($luisApp.id).luis" + + Write-Host "> Running LuisGen for $($luisApp.id) app ..." + $luPath = $(Join-Path $luisFolder $langCode "$($luisApp.id).lu") + RunLuisGen -lu_file $(Get-Item $luPath) -outName "$($luisApp.id)" -outFolder $lgOutFolder + # Add the LUIS application to the dispatch model. # If the LUIS application id already exists within the model no action will be taken - Write-Host "> Adding $($luisApp.id) app to dispatch model ... " - (dispatch add ` - --type "luis" ` - --name $luisApp.name ` - --id $luisApp.appid ` - --intentName "l_$($luisApp.id)" ` - --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` - --dataFolder $(Join-Path $dispatchFolder $langCode)) 2>> $logFile | Out-Null + if ($dispatch) { + Write-Host "> Adding $($luisApp.id) app to dispatch model ... " + (dispatch add ` + --type "luis" ` + --name $luisApp.name ` + --id $luisApp.appid ` + --region $luisApp.region ` + --intentName "l_$($luisApp.id)" ` + --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` + --dataFolder $(Join-Path $dispatchFolder $langCode)) 2>> $logFile | Out-Null + } } # Update local LU files based on hosted QnA KBs @@ -70,15 +97,17 @@ foreach ($langCode in $languageMap.Keys) { # Add the knowledge base to the dispatch model. # If the knowledge base id already exists within the model no action will be taken - Write-Host "> Adding $($kb.id) kb to dispatch model ..." - (dispatch add ` - --type "qna" ` - --name $kb.name ` - --id $kb.kbId ` - --key $kb.subscriptionKey ` - --intentName "q_$($kb.id)" ` - --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` - --dataFolder $(Join-Path $dispatchFolder $langCode)) 2>> $logFile | Out-Null + if ($dispatch) { + Write-Host "> Adding $($kb.id) kb to dispatch model ..." + (dispatch add ` + --type "qna" ` + --name $kb.name ` + --id $kb.kbId ` + --key $kb.subscriptionKey ` + --intentName "q_$($kb.id)" ` + --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` + --dataFolder $(Join-Path $dispatchFolder $langCode)) 2>> $logFile | Out-Null + } } } else @@ -91,6 +120,7 @@ foreach ($langCode in $languageMap.Keys) { -lu_file $lu ` -appId $luisApp.appid ` -version $luisApp.version ` + -region $luisApp.region ` -authoringKey $luisApp.authoringKey ` -subscriptionKey $app.subscriptionKey } @@ -105,16 +135,18 @@ foreach ($langCode in $languageMap.Keys) { -qnaSubscriptionKey $kb.subscriptionKey } } -} -# Update dispatch model -Write-Host "> Updating dispatch model ..." -dispatch refresh ` - --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` - --dataFolder $(Join-Path $dispatchFolder $langCode) 2>> $logFile | Out-Null + if ($dispatch) { + # Update dispatch model + Write-Host "> Updating dispatch model ..." + dispatch refresh ` + --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` + --dataFolder $(Join-Path $dispatchFolder $langCode) 2>> $logFile | Out-Null -# Update dispatch.cs file -Write-Host "> Running LuisGen ..." -luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null + # Update dispatch.cs file + Write-Host "> Running LuisGen for Dispatch app..." + luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null + } +} -Write-Host "> Done." +Write-Host "> Done." \ No newline at end of file diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/MainDialog.cs b/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/MainDialog.cs index dcf72e470d..24a7ccd30c 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/MainDialog.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/MainDialog.cs @@ -65,7 +65,7 @@ public MainDialog( var localeConfig = _services.CognitiveModelSets[locale]; // If dispatch result is general luis model - localeConfig.LuisServices.TryGetValue("settings", out var luisService); + localeConfig.LuisServices.TryGetValue("Settings", out var luisService); if (luisService == null) { @@ -74,7 +74,7 @@ public MainDialog( else { var turnResult = EndOfTurn; - var result = await luisService.RecognizeAsync(dc.Context, CancellationToken.None); + var result = await luisService.RecognizeAsync(dc.Context, CancellationToken.None); var intent = result?.TopIntent().intent; // Update state with vehicle settings luis result and entities @@ -83,15 +83,15 @@ public MainDialog( // switch on general intents switch (intent) { - case settingsLuis.Intent.VEHICLE_SETTINGS_CHANGE: - case settingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE: - case settingsLuis.Intent.VEHICLE_SETTINGS_CHECK: + case SettingsLuis.Intent.VEHICLE_SETTINGS_CHANGE: + case SettingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE: + case SettingsLuis.Intent.VEHICLE_SETTINGS_CHECK: { turnResult = await dc.BeginDialogAsync(nameof(VehicleSettingsDialog)); break; } - case settingsLuis.Intent.None: + case SettingsLuis.Intent.None: { await dc.Context.SendActivityAsync(_responseManager.GetResponse(AutomotiveSkillSharedResponses.DidntUnderstandMessage)); turnResult = new DialogTurnResult(DialogTurnStatus.Complete); @@ -140,7 +140,7 @@ public MainDialog( var localeConfig = _services.CognitiveModelSets[locale]; // check general luis intent - localeConfig.LuisServices.TryGetValue("general", out var luisService); + localeConfig.LuisServices.TryGetValue("General", out var luisService); if (luisService == null) { diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/VehicleSettingsDialog.cs b/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/VehicleSettingsDialog.cs index 5b133261dc..12bbb3da9e 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/VehicleSettingsDialog.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Dialogs/VehicleSettingsDialog.cs @@ -60,12 +60,12 @@ public VehicleSettingsDialog( TelemetryClient = telemetryClient; // Initialise supporting LUIS models for followup questions - vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_name"]; - vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_value"]; + vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["SettingsName"]; + vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["SettingsValue"]; // Initialise supporting LUIS models for followup questions - vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_name"]; - vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_value"]; + vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["SettingsName"]; + vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["SettingsValue"]; // Supporting setting files are stored as embedded resources var resourceAssembly = typeof(VehicleSettingsDialog).Assembly; @@ -126,11 +126,11 @@ public VehicleSettingsDialog( switch (topIntent.Value) { - case settingsLuis.Intent.VEHICLE_SETTINGS_CHANGE: - case settingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE: + case SettingsLuis.Intent.VEHICLE_SETTINGS_CHANGE: + case SettingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE: // Perform post-processing on the entities, if it's declarative we indicate for special processing (opposite of the condition they've expressed) - settingFilter.PostProcessSettingName(state, topIntent.Value == settingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE ? true : false); + settingFilter.PostProcessSettingName(state, topIntent.Value == SettingsLuis.Intent.VEHICLE_SETTINGS_DECLARATIVE ? true : false); // Perform content logic and remove entities that don't make sense settingFilter.ApplyContentLogic(state); @@ -194,7 +194,7 @@ public VehicleSettingsDialog( return await sc.NextAsync(); } - case settingsLuis.Intent.VEHICLE_SETTINGS_CHECK: + case SettingsLuis.Intent.VEHICLE_SETTINGS_CHECK: await sc.Context.SendActivityAsync(sc.Context.Activity.CreateReply("The skill doesn't support checking vehicle settings quite yet!")); return await sc.EndDialogAsync(true, cancellationToken); @@ -215,7 +215,7 @@ private async Task SettingNameSelectionValidator(PromptValidatorContext(promptContext.Context, CancellationToken.None); + var nameSelectionResult = await vehicleSettingNameSelectionLuisRecognizer.RecognizeAsync(promptContext.Context, CancellationToken.None); state.AddRecognizerResult(nameSelectionResult); var selectedSettingNames = new List(); @@ -342,7 +342,7 @@ private async Task SettingValueSelectionValidator(PromptValidatorContext(promptContext.Context, CancellationToken.None); + var valueSelectionResult = await vehicleSettingValueSelectionLuisRecognizer.RecognizeAsync(promptContext.Context, CancellationToken.None); state.AddRecognizerResult(valueSelectionResult); var valueEntities = new List(); diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Models/AutomotiveSkillState.cs b/skills/src/csharp/automotiveskill/automotiveskill/Models/AutomotiveSkillState.cs index 2ab98bcbd0..6b56fbb1ae 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Models/AutomotiveSkillState.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Models/AutomotiveSkillState.cs @@ -12,7 +12,7 @@ public AutomotiveSkillState() { } - public settingsLuis VehicleSettingsLuisResult { get; set; } + public SettingsLuis VehicleSettingsLuisResult { get; set; } public IDictionary> Entities { get; set; } = new Dictionary>(); @@ -20,7 +20,7 @@ public AutomotiveSkillState() public IList Statuses { get; set; } = new List(); - public void AddRecognizerResult(settingsLuis luisResult) + public void AddRecognizerResult(SettingsLuis luisResult) { Clear(); @@ -52,7 +52,7 @@ public void AddRecognizerResult(settingsLuis luisResult) } } - public void AddRecognizerResult(settings_nameLuis luisResult) + public void AddRecognizerResult(SettingsNameLuis luisResult) { // Remove transient entity types. Entities.Remove("INDEX"); @@ -68,7 +68,7 @@ public void AddRecognizerResult(settings_nameLuis luisResult) } } - public void AddRecognizerResult(settings_valueLuis luisResult) + public void AddRecognizerResult(SettingsValueLuis luisResult) { // Remove transient entity types. Entities.Remove("INDEX"); diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_dispatchLuis.cs b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsDispatchLuis.cs similarity index 88% rename from skills/src/csharp/automotiveskill/automotiveskill/Services/settings_dispatchLuis.cs rename to skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsDispatchLuis.cs index 9703c7bb81..993f24a314 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_dispatchLuis.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsDispatchLuis.cs @@ -1,5 +1,5 @@ // -// Code generated by LUISGen deployment\resources\lu\en\settings_dispatch.luis -cs Luis.settings_dispatchLuis -o services +// Code generated by LUISGen // Tool github: https://github.com/microsoft/botbuilder-tools // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -10,7 +10,7 @@ using Microsoft.Bot.Builder.AI.Luis; namespace Luis { - public class settings_dispatchLuis: IRecognizerConvert + public partial class SettingsDispatchLuis: IRecognizerConvert { public string Text; public string AlteredText; @@ -52,7 +52,7 @@ public class _Instance public void Convert(dynamic result) { - var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); + var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); Text = app.Text; AlteredText = app.AlteredText; Intents = app.Intents; diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Services/settingsLuis.cs b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsLuis.cs similarity index 89% rename from skills/src/csharp/automotiveskill/automotiveskill/Services/settingsLuis.cs rename to skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsLuis.cs index 66ec3202db..177578f7a4 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Services/settingsLuis.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsLuis.cs @@ -1,5 +1,5 @@ // -// Code generated by LUISGen deployment\resources\lu\en\settings.luis -cs Luis.settingsLuis -o services +// Code generated by LUISGen // Tool github: https://github.com/microsoft/botbuilder-tools // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -10,7 +10,7 @@ using Microsoft.Bot.Builder.AI.Luis; namespace Luis { - public class settingsLuis: IRecognizerConvert + public partial class SettingsLuis: IRecognizerConvert { public string Text; public string AlteredText; @@ -52,7 +52,7 @@ public class _Instance public void Convert(dynamic result) { - var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); + var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); Text = app.Text; AlteredText = app.AlteredText; Intents = app.Intents; diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_nameLuis.cs b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsNameLuis.cs similarity index 86% rename from skills/src/csharp/automotiveskill/automotiveskill/Services/settings_nameLuis.cs rename to skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsNameLuis.cs index 9e0206cf8a..60184f5794 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_nameLuis.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsNameLuis.cs @@ -1,5 +1,5 @@ // -// Code generated by LUISGen deployment\resources\lu\en\settings_name.luis -cs Luis.settings_nameLuis -o services +// Code generated by LUISGen // Tool github: https://github.com/microsoft/botbuilder-tools // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -10,7 +10,7 @@ using Microsoft.Bot.Builder.AI.Luis; namespace Luis { - public class settings_nameLuis: IRecognizerConvert + public partial class SettingsNameLuis: IRecognizerConvert { public string Text; public string AlteredText; @@ -42,7 +42,7 @@ public class _Instance public void Convert(dynamic result) { - var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); + var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); Text = app.Text; AlteredText = app.AlteredText; Intents = app.Intents; diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_valueLuis.cs b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsValueLuis.cs similarity index 88% rename from skills/src/csharp/automotiveskill/automotiveskill/Services/settings_valueLuis.cs rename to skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsValueLuis.cs index ef512e31df..9a7122453a 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Services/settings_valueLuis.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Services/SettingsValueLuis.cs @@ -1,5 +1,5 @@ // -// Code generated by LUISGen deployment\resources\lu\en\settings_value.luis -cs Luis.settings_valueLuis -o services +// Code generated by LUISGen // Tool github: https://github.com/microsoft/botbuilder-tools // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -10,7 +10,7 @@ using Microsoft.Bot.Builder.AI.Luis; namespace Luis { - public class settings_valueLuis: IRecognizerConvert + public partial class SettingsValueLuis: IRecognizerConvert { public string Text; public string AlteredText; @@ -50,7 +50,7 @@ public class _Instance public void Convert(dynamic result) { - var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); + var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); Text = app.Text; AlteredText = app.AlteredText; Intents = app.Intents; diff --git a/skills/src/csharp/automotiveskill/automotiveskill/cognitivemodels.json b/skills/src/csharp/automotiveskill/automotiveskill/cognitivemodels.json index a26bf2232c..05945ab9ad 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/cognitivemodels.json +++ b/skills/src/csharp/automotiveskill/automotiveskill/cognitivemodels.json @@ -3,7 +3,7 @@ "en": { "languageModels": [ { - "id": "general", + "id": "General", "name": "", "appId": "", "authoringKey": "", @@ -12,7 +12,7 @@ "region": "" }, { - "id": "settings", + "id": "Settings", "name": "", "appId": "", "authoringKey": "", @@ -21,7 +21,7 @@ "region": "" }, { - "id": "settings_name", + "id": "SettingsName", "name": "", "appId": "", "authoringKey": "", @@ -30,7 +30,7 @@ "region": "" }, { - "id": "settings_value", + "id": "SettingsValue", "name": "", "appId": "", "authoringKey": "", diff --git a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/AutomotiveSkillTestBase.cs b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/AutomotiveSkillTestBase.cs index 3005bcf68e..5bda05733b 100644 --- a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/AutomotiveSkillTestBase.cs +++ b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/AutomotiveSkillTestBase.cs @@ -50,10 +50,10 @@ public override void Initialize() { LuisServices = new Dictionary { - { "general", new MockLuisRecognizer() }, - { "settings", new MockLuisRecognizer() }, - { "settings_name", new MockLuisRecognizer() }, - { "settings_value", new MockLuisRecognizer() } + { "General", new MockLuisRecognizer() }, + { "Settings", new MockLuisRecognizer() }, + { "SettingsName", new MockLuisRecognizer() }, + { "SettingsValue", new MockLuisRecognizer() } } } } diff --git a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockLuisRecognizer.cs b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockLuisRecognizer.cs index 8e11afb737..b301c77a3d 100644 --- a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockLuisRecognizer.cs +++ b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockLuisRecognizer.cs @@ -31,21 +31,21 @@ public Task RecognizeAsync(ITurnContext turnContext, CancellationToken can var t = typeof(T); var text = turnContext.Activity.Text; - if (t.Name.Equals(typeof(settingsLuis).Name)) + if (t.Name.Equals(typeof(SettingsLuis).Name)) { var mockVehicle = new MockVehicleSettingsIntent(text); var test = mockVehicle as object; mockResult = (T)test; } - else if (t.Name.Equals(typeof(settings_nameLuis).Name)) + else if (t.Name.Equals(typeof(SettingsNameLuis).Name)) { var mockVehicleNameIntent = new MockVehicleSettingsNameIntent(text); var test = mockVehicleNameIntent as object; mockResult = (T)test; } - else if (t.Name.Equals(typeof(settings_valueLuis).Name)) + else if (t.Name.Equals(typeof(SettingsValueLuis).Name)) { var mockVehicleValueIntent = new MockVehicleSettingsValueIntent(text); diff --git a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsIntent.cs b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsIntent.cs index fd8ea29326..eb168d1f86 100644 --- a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsIntent.cs +++ b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsIntent.cs @@ -5,7 +5,7 @@ namespace AutomotiveSkillTest.Flow.Fakes { - public class MockVehicleSettingsIntent : settingsLuis + public class MockVehicleSettingsIntent : SettingsLuis { private Intent intent; private double score; diff --git a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsNameIntent.cs b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsNameIntent.cs index 1af26915c5..e0ba249080 100644 --- a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsNameIntent.cs +++ b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsNameIntent.cs @@ -5,7 +5,7 @@ namespace AutomotiveSkillTest.Flow.Fakes { - public class MockVehicleSettingsNameIntent : settings_nameLuis + public class MockVehicleSettingsNameIntent : SettingsNameLuis { private string userInput; private Intent intent; @@ -18,7 +18,7 @@ public MockVehicleSettingsNameIntent(string userInput) throw new ArgumentNullException(nameof(userInput)); } - this.Entities = new settings_nameLuis._Entities(); + this.Entities = new SettingsNameLuis._Entities(); this.Intents = new Dictionary(); this.userInput = userInput; @@ -27,7 +27,7 @@ public MockVehicleSettingsNameIntent(string userInput) intentScore.Score = 0.9909704; intentScore.Properties = new Dictionary(); - this.Intents.Add(settings_nameLuis.Intent.SETTING_NAME_SELECTION, intentScore); + this.Intents.Add(SettingsNameLuis.Intent.SETTING_NAME_SELECTION, intentScore); switch (userInput.ToLower()) { diff --git a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsValueIntent.cs b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsValueIntent.cs index 9cab21a0ef..d8eda19e21 100644 --- a/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsValueIntent.cs +++ b/skills/src/csharp/automotiveskill/automotiveskilltest/Flow/Fakes/MockVehicleSettingsValueIntent.cs @@ -5,7 +5,7 @@ namespace AutomotiveSkillTest.Flow.Fakes { - public class MockVehicleSettingsValueIntent : settings_valueLuis + public class MockVehicleSettingsValueIntent : SettingsValueLuis { private Intent intent; private double score; @@ -17,14 +17,14 @@ public MockVehicleSettingsValueIntent(string userInput) throw new ArgumentNullException(nameof(userInput)); } - this.Entities = new settings_valueLuis._Entities(); + this.Entities = new SettingsValueLuis._Entities(); this.Intents = new Dictionary(); var intentScore = new Microsoft.Bot.Builder.IntentScore(); intentScore.Score = 0.9909704; intentScore.Properties = new Dictionary(); - this.Intents.Add(settings_valueLuis.Intent.SETTING_VALUE_SELECTION, intentScore); + this.Intents.Add(SettingsValueLuis.Intent.SETTING_VALUE_SELECTION, intentScore); switch (userInput.ToLower()) {