From 92fb66c11047198817d2ea38fd015c78bb78142e Mon Sep 17 00:00:00 2001 From: Lauren Mills Date: Wed, 24 Apr 2019 21:15:41 -0700 Subject: [PATCH 1/5] dispatch updates --- .../SkillRouter.cs | 2 +- .../Deployment/Scripts/add_remote_skill.ps1 | 135 +++++++++--------- .../Deployment/Scripts/deploy.ps1 | 4 +- .../Deployment/Scripts/remove_skill.ps1 | 53 ++----- 4 files changed, 85 insertions(+), 109 deletions(-) diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillRouter.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillRouter.cs index 2b70f4d7ad..26c428a160 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillRouter.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillRouter.cs @@ -17,7 +17,7 @@ public static class SkillRouter /// Whether the intent matches a Skill. public static SkillManifest IsSkill(List skillConfiguration, string dispatchIntent) { - return skillConfiguration.SingleOrDefault(s => s.Id == dispatchIntent.ToString()); + return skillConfiguration.SingleOrDefault(s => s.Actions.Any(a => a.Id == dispatchIntent.ToString())); } } } \ No newline at end of file diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/add_remote_skill.ps1 b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/add_remote_skill.ps1 index 18c6841cfd..f66295082c 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/add_remote_skill.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/add_remote_skill.ps1 @@ -84,73 +84,74 @@ if (-not $manifest) { } Write-Host "> Getting intents for dispatch ..." -$dictionary = @{ } -foreach ($action in $manifest.actions) { - if ($action.definition.triggers.utteranceSources) { - foreach ($source in $action.definition.triggers.utteranceSources) { - foreach ($luisStr in $source.source) { - $luis = $luisStr -Split '#' - if ($dictionary.ContainsKey($luis[0])) { - $intents = $dictionary[$luis[0]] - $intents += $luis[1] - $dictionary[$luis[0]] = $intents - } - else { - $dictionary.Add($luis[0], @($luis[1])) - } - } - } - } -} - -Write-Host "> Adding skill to dispatch ..." try { - $intentName = $manifest.Id - foreach ($luisApp in $dictionary.Keys) { - $intents = $dictionary[$luisApp] - $luFile = Get-ChildItem -Path $(Join-Path $luisFolder "$($luisApp).lu") ` 2>> $logFile - - if (-not $luFile) { - $luFile = Get-ChildItem -Path $(Join-Path $luisFolder $langCode "$($luisApp).lu") ` 2>> $logFile - - if ($luFile) { - $luisFolder = $(Join-Path $luisFolder $langCode) - } - else { - Write-Host "! Could not find $($manifest.Name) LU file. Please provide the -luisFolder parameter." -ForegroundColor DarkRed - Write-Host "! Checked the following locations:" -ForegroundColor DarkRed - Write-Host " $(Join-Path $luisFolder "$($luisApp).lu")" -ForegroundColor DarkRed - Write-Host " $(Join-Path $luisFolder $langCode "$($luisApp).lu")" -ForegroundColor DarkRed - Throw - } + foreach ($action in $manifest.actions) { + if ($action.definition.triggers.utteranceSources) { + $sources = @{} + foreach ($source in ($action.definition.triggers.utteranceSources | Where-Object {$_.locale -eq $langCode})) { + foreach ($luisStr in $source.source) { + $luis = $luisStr -Split '#' + if ($sources.ContainsKey($luis[0])) { + $intents = $sources[$luis[0]] + $intents += $luis[1] + $sources[$luis[0]] = $intents + } + else { + $sources.Add($luis[0], @($luis[1])) + } + } + } + + Write-Host "> Adding $($action.id) action to dispatch ..." + foreach ($luisApp in $sources.Keys) { + $intents = $sources[$luisApp] + $luFile = Get-ChildItem -Path $(Join-Path $luisFolder "$($luisApp).lu") ` 2>> $logFile + + if (-not $luFile) { + $luFile = Get-ChildItem -Path $(Join-Path $luisFolder $langCode "$($luisApp).lu") ` 2>> $logFile + + if ($luFile) { + $luisFolder = $(Join-Path $luisFolder $langCode) + } + else { + Write-Host "! Could not find $($manifest.Name) LU file. Please provide the -luisFolder parameter." -ForegroundColor DarkRed + Write-Host "! Checked the following locations:" -ForegroundColor DarkRed + Write-Host " $(Join-Path $luisFolder "$($luisApp).lu")" -ForegroundColor DarkRed + Write-Host " $(Join-Path $luisFolder $langCode "$($luisApp).lu")" -ForegroundColor DarkRed + Throw + } + } + + # Parse LU file + ludown parse toluis ` + --in $luFile ` + --luis_culture $language ` + --out_folder $luisFolder ` + --out "$($luisApp).luis" + + $luisFile = Get-ChildItem ` + -Path $luisFolder ` + -Filter "$($luisApp).luis" ` + -Recurse ` + -Force 2>> $logFile + + if ($luisFile) { + (dispatch add ` + --type file ` + --filePath $luisFile ` + --name $action.id ` + --intentName $action.id ` + --includedIntents $intents ` + --dataFolder $dispatchFolder ` + --dispatch $(Join-Path $dispatchFolder "$($dispatchName).dispatch")) 2>> $logFile | Out-Null + } + else { + Write-Host "! Could not find LUIS file: $(Join-Path $luisFolder "$($luisApp).luis")" -ForegroundColor DarkRed + Break + } + } } - - # Parse LU file - ludown parse toluis ` - --in $luFile ` - --luis_culture $language ` - --out_folder $luisFolder ` - --out "$($luisApp).luis" - - $luisFile = Get-ChildItem ` - -Path $luisFolder ` - -Filter "$($luisApp).luis" ` - -Recurse ` - -Force 2>> $logFile - - if ($luisFile) { - (dispatch add ` - --type file ` - --filePath $luisFile ` - --intentName $intentName ` - --dataFolder $dispatchFolder ` - --dispatch $(Join-Path $dispatchFolder "$($dispatchName).dispatch")) 2>> $logFile | Out-Null - } - else { - Write-Host "! Could not find LUIS file: $(Join-Path $luisFolder "$($luisApp).luis")" -ForegroundColor DarkRed - Break - } - } + } } catch { Break @@ -284,10 +285,12 @@ if ($manifest.authenticationConnections) { } } +Write-Host "> Done." + if ($manualScopesRequired) { Write-Host "+ Could not configure scopes automatically. You must configure the following scopes in the Azure Portal to use this skill: $($newScopes -Join ', ')" -ForegroundColor Magenta } if ($manualAuthRequired) { Write-Host "+ Could not configure authentication connection automatically. You must configure one of the following connection types manually in the Azure Portal: $($manifest.authenticationConnections.serviceProviderId -Join ', ')" -ForegroundColor Magenta -} \ No newline at end of file +} diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/deploy.ps1 b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/deploy.ps1 index 76eaa462a0..b4a09ee834 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/deploy.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/deploy.ps1 @@ -153,4 +153,6 @@ $settings | Add-Member -Type NoteProperty -Force -Name 'contentModerator' -Value $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder appsettings.json) # Deploy cognitive models -Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -qnaSubscriptionKey $($outputs.qnaMaker.value.key) -outFolder $($outFolder)" \ No newline at end of file +Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -qnaSubscriptionKey $($outputs.qnaMaker.value.key) -outFolder $($outFolder)" + +Write-Host "> Done." \ No newline at end of file diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/remove_skill.ps1 b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/remove_skill.ps1 index 5821931a6f..af1011e6f7 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/remove_skill.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/remove_skill.ps1 @@ -67,48 +67,17 @@ if (-not $manifest) { Break } -Write-Host "> Getting intents for dispatch ..." -$dictionary = @{ } -foreach ($action in $manifest.actions) { - if ($action.definition.triggers.utteranceSources) { - foreach ($source in $action.definition.triggers.utteranceSources) { - foreach ($luisStr in $source.source) { - $luis = $luisStr -Split '#' - if ($dictionary.ContainsKey($luis[0])) { - $intents = $dictionary[$luis[0]] - $intents += $luis[1] - $dictionary[$luis[0]] = $intents - } - else { - $dictionary.Add($luis[0], @($luis[1])) - } - } - } - } -} - Write-Host "> Removing skill from dispatch ..." -try { - $intentName = $manifest.Id - $dispatch = Get-Content $dispatchPath | ConvertFrom-Json - - if ($dispatch.services) { - foreach ($luisApp in $dictionary.Keys) { - $intents = $dictionary[$luisApp] - $toRemove = $dispatch.services | Where-Object { $_.name -eq $luisApp } - $dispatch.services = $dispatch.services | Where-Object -FilterScript { $_.name -ne $luisApp } - $dispatch.serviceIds = $dispatch.serviceIds | Where-Object -FilterScript { $toRemove.id -notcontains $_ } - } - - $dispatch | ConvertTo-Json -depth 100 | Out-File $dispatchPath - } - else { - Write-Host "! No services found in file: $($dispatchPath)" -ForegroundColor DarkRed - Break - } +$dispatch = Get-Content $dispatchPath | ConvertFrom-Json +if ($dispatch.services) { + $toRemove = $dispatch.services | Where-Object { $manifest.actions.id -contains $_.name } + $dispatch.services = $dispatch.services | Where-Object -FilterScript { $manifest.actions.id -notcontains $_.name } + $dispatch.serviceIds = $dispatch.serviceIds | Where-Object -FilterScript { $toRemove.id -notcontains $_ } + + $dispatch | ConvertTo-Json -depth 100 | Out-File $dispatchPath } -catch { - Break +else { + Write-Host "! No services found in file: $($dispatchPath)" -ForegroundColor DarkRed } Write-Host "> Running dispatch refresh ..." @@ -143,4 +112,6 @@ if (Test-Path $skillsFile) { } else { Write-Host "! Could not find file: $($skillFile)" -ForegroundColor Cyan -} \ No newline at end of file +} + +Write-Host "> Done." \ No newline at end of file From 2e72e1835be4ea51f222436632e55057fa6fb20f Mon Sep 17 00:00:00 2001 From: Lauren Mills Date: Wed, 24 Apr 2019 22:09:52 -0700 Subject: [PATCH 2/5] updated mainDialog to fix action invocatoin --- .../csharp/Sample/VirtualAssistantSample/Dialogs/MainDialog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Dialogs/MainDialog.cs b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Dialogs/MainDialog.cs index 214afa14d2..6510543fb4 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Dialogs/MainDialog.cs +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Dialogs/MainDialog.cs @@ -117,7 +117,7 @@ protected override async Task OnInterruptDialogAsync(DialogC { // We have identiifed a skill so initialize the skill connection with the target skill // the dispatch intent is the Action ID of the Skill enabling us to resolve the specific action and identify slots - await dc.BeginDialogAsync(identifiedSkill.Id, intent); + await dc.BeginDialogAsync(identifiedSkill.Id, intent.ToString()); // Pass the activity we have var result = await dc.ContinueDialogAsync(); From 121d31062e8a7d849ba7a7879d463dbed9d278ec Mon Sep 17 00:00:00 2001 From: Lauren Mills Date: Wed, 24 Apr 2019 22:10:28 -0700 Subject: [PATCH 3/5] Added stylecop ruleset reference to lib --- .../Microsoft.Bot.Builder.Skills.csproj | 4 ++++ .../Microsoft.Bot.Builder.Solutions.csproj | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj index 86465ba6f1..815a851451 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj @@ -1,5 +1,9 @@  + + ..\..\BotBuilder-DotNet.ruleset + + 4.0.0-local $(PackageVersion) diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj index f9f9fcd2cd..8d05e9789d 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj @@ -1,6 +1,8 @@ - + - + + ..\..\BotBuilder-DotNet.ruleset + 4.0.0-local From 040daeb4c381c0c9015c2b41126aee0f7714b48d Mon Sep 17 00:00:00 2001 From: Lauren Mills Date: Wed, 24 Apr 2019 22:12:54 -0700 Subject: [PATCH 4/5] updated template --- .../Deployment/Scripts/add_remote_skill.ps1 | 135 +++++++++--------- .../Template/VA/Deployment/Scripts/deploy.ps1 | 4 +- .../VA/Deployment/Scripts/remove_skill.ps1 | 53 ++----- .../csharp/Template/VA/Dialogs/MainDialog.cs | 2 +- 4 files changed, 85 insertions(+), 109 deletions(-) diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/add_remote_skill.ps1 b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/add_remote_skill.ps1 index 18c6841cfd..f66295082c 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/add_remote_skill.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/add_remote_skill.ps1 @@ -84,73 +84,74 @@ if (-not $manifest) { } Write-Host "> Getting intents for dispatch ..." -$dictionary = @{ } -foreach ($action in $manifest.actions) { - if ($action.definition.triggers.utteranceSources) { - foreach ($source in $action.definition.triggers.utteranceSources) { - foreach ($luisStr in $source.source) { - $luis = $luisStr -Split '#' - if ($dictionary.ContainsKey($luis[0])) { - $intents = $dictionary[$luis[0]] - $intents += $luis[1] - $dictionary[$luis[0]] = $intents - } - else { - $dictionary.Add($luis[0], @($luis[1])) - } - } - } - } -} - -Write-Host "> Adding skill to dispatch ..." try { - $intentName = $manifest.Id - foreach ($luisApp in $dictionary.Keys) { - $intents = $dictionary[$luisApp] - $luFile = Get-ChildItem -Path $(Join-Path $luisFolder "$($luisApp).lu") ` 2>> $logFile - - if (-not $luFile) { - $luFile = Get-ChildItem -Path $(Join-Path $luisFolder $langCode "$($luisApp).lu") ` 2>> $logFile - - if ($luFile) { - $luisFolder = $(Join-Path $luisFolder $langCode) - } - else { - Write-Host "! Could not find $($manifest.Name) LU file. Please provide the -luisFolder parameter." -ForegroundColor DarkRed - Write-Host "! Checked the following locations:" -ForegroundColor DarkRed - Write-Host " $(Join-Path $luisFolder "$($luisApp).lu")" -ForegroundColor DarkRed - Write-Host " $(Join-Path $luisFolder $langCode "$($luisApp).lu")" -ForegroundColor DarkRed - Throw - } + foreach ($action in $manifest.actions) { + if ($action.definition.triggers.utteranceSources) { + $sources = @{} + foreach ($source in ($action.definition.triggers.utteranceSources | Where-Object {$_.locale -eq $langCode})) { + foreach ($luisStr in $source.source) { + $luis = $luisStr -Split '#' + if ($sources.ContainsKey($luis[0])) { + $intents = $sources[$luis[0]] + $intents += $luis[1] + $sources[$luis[0]] = $intents + } + else { + $sources.Add($luis[0], @($luis[1])) + } + } + } + + Write-Host "> Adding $($action.id) action to dispatch ..." + foreach ($luisApp in $sources.Keys) { + $intents = $sources[$luisApp] + $luFile = Get-ChildItem -Path $(Join-Path $luisFolder "$($luisApp).lu") ` 2>> $logFile + + if (-not $luFile) { + $luFile = Get-ChildItem -Path $(Join-Path $luisFolder $langCode "$($luisApp).lu") ` 2>> $logFile + + if ($luFile) { + $luisFolder = $(Join-Path $luisFolder $langCode) + } + else { + Write-Host "! Could not find $($manifest.Name) LU file. Please provide the -luisFolder parameter." -ForegroundColor DarkRed + Write-Host "! Checked the following locations:" -ForegroundColor DarkRed + Write-Host " $(Join-Path $luisFolder "$($luisApp).lu")" -ForegroundColor DarkRed + Write-Host " $(Join-Path $luisFolder $langCode "$($luisApp).lu")" -ForegroundColor DarkRed + Throw + } + } + + # Parse LU file + ludown parse toluis ` + --in $luFile ` + --luis_culture $language ` + --out_folder $luisFolder ` + --out "$($luisApp).luis" + + $luisFile = Get-ChildItem ` + -Path $luisFolder ` + -Filter "$($luisApp).luis" ` + -Recurse ` + -Force 2>> $logFile + + if ($luisFile) { + (dispatch add ` + --type file ` + --filePath $luisFile ` + --name $action.id ` + --intentName $action.id ` + --includedIntents $intents ` + --dataFolder $dispatchFolder ` + --dispatch $(Join-Path $dispatchFolder "$($dispatchName).dispatch")) 2>> $logFile | Out-Null + } + else { + Write-Host "! Could not find LUIS file: $(Join-Path $luisFolder "$($luisApp).luis")" -ForegroundColor DarkRed + Break + } + } } - - # Parse LU file - ludown parse toluis ` - --in $luFile ` - --luis_culture $language ` - --out_folder $luisFolder ` - --out "$($luisApp).luis" - - $luisFile = Get-ChildItem ` - -Path $luisFolder ` - -Filter "$($luisApp).luis" ` - -Recurse ` - -Force 2>> $logFile - - if ($luisFile) { - (dispatch add ` - --type file ` - --filePath $luisFile ` - --intentName $intentName ` - --dataFolder $dispatchFolder ` - --dispatch $(Join-Path $dispatchFolder "$($dispatchName).dispatch")) 2>> $logFile | Out-Null - } - else { - Write-Host "! Could not find LUIS file: $(Join-Path $luisFolder "$($luisApp).luis")" -ForegroundColor DarkRed - Break - } - } + } } catch { Break @@ -284,10 +285,12 @@ if ($manifest.authenticationConnections) { } } +Write-Host "> Done." + if ($manualScopesRequired) { Write-Host "+ Could not configure scopes automatically. You must configure the following scopes in the Azure Portal to use this skill: $($newScopes -Join ', ')" -ForegroundColor Magenta } if ($manualAuthRequired) { Write-Host "+ Could not configure authentication connection automatically. You must configure one of the following connection types manually in the Azure Portal: $($manifest.authenticationConnections.serviceProviderId -Join ', ')" -ForegroundColor Magenta -} \ No newline at end of file +} diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/deploy.ps1 b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/deploy.ps1 index 76eaa462a0..b4a09ee834 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/deploy.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/deploy.ps1 @@ -153,4 +153,6 @@ $settings | Add-Member -Type NoteProperty -Force -Name 'contentModerator' -Value $settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder appsettings.json) # Deploy cognitive models -Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -qnaSubscriptionKey $($outputs.qnaMaker.value.key) -outFolder $($outFolder)" \ No newline at end of file +Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -qnaSubscriptionKey $($outputs.qnaMaker.value.key) -outFolder $($outFolder)" + +Write-Host "> Done." \ No newline at end of file diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/remove_skill.ps1 b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/remove_skill.ps1 index 5821931a6f..af1011e6f7 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/remove_skill.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/remove_skill.ps1 @@ -67,48 +67,17 @@ if (-not $manifest) { Break } -Write-Host "> Getting intents for dispatch ..." -$dictionary = @{ } -foreach ($action in $manifest.actions) { - if ($action.definition.triggers.utteranceSources) { - foreach ($source in $action.definition.triggers.utteranceSources) { - foreach ($luisStr in $source.source) { - $luis = $luisStr -Split '#' - if ($dictionary.ContainsKey($luis[0])) { - $intents = $dictionary[$luis[0]] - $intents += $luis[1] - $dictionary[$luis[0]] = $intents - } - else { - $dictionary.Add($luis[0], @($luis[1])) - } - } - } - } -} - Write-Host "> Removing skill from dispatch ..." -try { - $intentName = $manifest.Id - $dispatch = Get-Content $dispatchPath | ConvertFrom-Json - - if ($dispatch.services) { - foreach ($luisApp in $dictionary.Keys) { - $intents = $dictionary[$luisApp] - $toRemove = $dispatch.services | Where-Object { $_.name -eq $luisApp } - $dispatch.services = $dispatch.services | Where-Object -FilterScript { $_.name -ne $luisApp } - $dispatch.serviceIds = $dispatch.serviceIds | Where-Object -FilterScript { $toRemove.id -notcontains $_ } - } - - $dispatch | ConvertTo-Json -depth 100 | Out-File $dispatchPath - } - else { - Write-Host "! No services found in file: $($dispatchPath)" -ForegroundColor DarkRed - Break - } +$dispatch = Get-Content $dispatchPath | ConvertFrom-Json +if ($dispatch.services) { + $toRemove = $dispatch.services | Where-Object { $manifest.actions.id -contains $_.name } + $dispatch.services = $dispatch.services | Where-Object -FilterScript { $manifest.actions.id -notcontains $_.name } + $dispatch.serviceIds = $dispatch.serviceIds | Where-Object -FilterScript { $toRemove.id -notcontains $_ } + + $dispatch | ConvertTo-Json -depth 100 | Out-File $dispatchPath } -catch { - Break +else { + Write-Host "! No services found in file: $($dispatchPath)" -ForegroundColor DarkRed } Write-Host "> Running dispatch refresh ..." @@ -143,4 +112,6 @@ if (Test-Path $skillsFile) { } else { Write-Host "! Could not find file: $($skillFile)" -ForegroundColor Cyan -} \ No newline at end of file +} + +Write-Host "> Done." \ No newline at end of file diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Dialogs/MainDialog.cs b/templates/Virtual-Assistant-Template/csharp/Template/VA/Dialogs/MainDialog.cs index 7f83d58e2a..8445d83881 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Dialogs/MainDialog.cs +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Dialogs/MainDialog.cs @@ -105,7 +105,7 @@ protected override async Task OnInterruptDialogAsync(DialogC { // We have identiifed a skill so initialize the skill connection with the target skill // the dispatch intent is the Action ID of the Skill enabling us to resolve the specific action and identify slots - await dc.BeginDialogAsync(identifiedSkill.Id, intent); + await dc.BeginDialogAsync(identifiedSkill.Id, intent.ToString()); // Pass the activity we have var result = await dc.ContinueDialogAsync(); From 515fa686995ec3e4baebbb1c2da8f17fc3b9527d Mon Sep 17 00:00:00 2001 From: Lauren Mills Date: Thu, 25 Apr 2019 08:46:43 -0700 Subject: [PATCH 5/5] removed ruleset references --- .../Microsoft.Bot.Builder.Skills.csproj | 4 ---- .../Microsoft.Bot.Builder.Solutions.csproj | 4 ---- 2 files changed, 8 deletions(-) diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj index 815a851451..86465ba6f1 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/Microsoft.Bot.Builder.Skills.csproj @@ -1,9 +1,5 @@  - - ..\..\BotBuilder-DotNet.ruleset - - 4.0.0-local $(PackageVersion) diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj index 8d05e9789d..30b9f4a2eb 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions/Microsoft.Bot.Builder.Solutions.csproj @@ -1,9 +1,5 @@  - - ..\..\BotBuilder-DotNet.ruleset - - 4.0.0-local $(PackageVersion)