diff --git a/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/update_cognitive_models.ps1 b/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/update_cognitive_models.ps1 index 5c7646c315..725dd15d56 100644 --- a/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/update_cognitive_models.ps1 +++ b/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/update_cognitive_models.ps1 @@ -4,7 +4,7 @@ Param( [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [switch] $RemoteToLocal, [string] $dispatchFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'Dispatch'), - [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), + [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), [string] $qnaFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'QnA'), [string] $lgOutFolder = $(Join-Path (Get-Location) 'Services'), [string] $logFile = $(Join-Path $PSScriptRoot .. "update_cognitive_models_log.txt") @@ -28,7 +28,8 @@ $config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.N foreach ($langCode in $languageMap.Keys) { $models = $languageMap[$langCode] - + $dispatch = $models.dispatchModel + if($RemoteToLocal) { # Update local LU files based on hosted models @@ -42,6 +43,17 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($luisApp.id).lu" ` -o $(Join-Path $luisFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } # Update local LU files based on hosted QnA KBs @@ -55,6 +67,18 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($kb.id).lu" ` -o $(Join-Path $qnaFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } } else @@ -85,7 +109,6 @@ foreach ($langCode in $languageMap.Keys) { # Update dispatch model Write-Host "> Updating dispatch model ..." -$dispatch = $models.dispatchModel dispatch refresh ` --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` --dataFolder $dispatchFolder 2>> $logFile | Out-Null @@ -94,4 +117,4 @@ dispatch refresh ` Write-Host "> Running LuisGen ..." luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null -Write-Host "> Done." \ No newline at end of file +Write-Host "> Done." diff --git a/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/update_cognitive_models.ps1 b/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/update_cognitive_models.ps1 index 5c7646c315..725dd15d56 100644 --- a/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/update_cognitive_models.ps1 +++ b/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/update_cognitive_models.ps1 @@ -4,7 +4,7 @@ Param( [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [switch] $RemoteToLocal, [string] $dispatchFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'Dispatch'), - [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), + [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), [string] $qnaFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'QnA'), [string] $lgOutFolder = $(Join-Path (Get-Location) 'Services'), [string] $logFile = $(Join-Path $PSScriptRoot .. "update_cognitive_models_log.txt") @@ -28,7 +28,8 @@ $config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.N foreach ($langCode in $languageMap.Keys) { $models = $languageMap[$langCode] - + $dispatch = $models.dispatchModel + if($RemoteToLocal) { # Update local LU files based on hosted models @@ -42,6 +43,17 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($luisApp.id).lu" ` -o $(Join-Path $luisFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } # Update local LU files based on hosted QnA KBs @@ -55,6 +67,18 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($kb.id).lu" ` -o $(Join-Path $qnaFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } } else @@ -85,7 +109,6 @@ foreach ($langCode in $languageMap.Keys) { # Update dispatch model Write-Host "> Updating dispatch model ..." -$dispatch = $models.dispatchModel dispatch refresh ` --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` --dataFolder $dispatchFolder 2>> $logFile | Out-Null @@ -94,4 +117,4 @@ dispatch refresh ` Write-Host "> Running LuisGen ..." luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null -Write-Host "> Done." \ No newline at end of file +Write-Host "> Done." diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/update_cognitive_models.ps1 b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/update_cognitive_models.ps1 index 5c7646c315..725dd15d56 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/update_cognitive_models.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Deployment/Scripts/update_cognitive_models.ps1 @@ -4,7 +4,7 @@ Param( [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [switch] $RemoteToLocal, [string] $dispatchFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'Dispatch'), - [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), + [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), [string] $qnaFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'QnA'), [string] $lgOutFolder = $(Join-Path (Get-Location) 'Services'), [string] $logFile = $(Join-Path $PSScriptRoot .. "update_cognitive_models_log.txt") @@ -28,7 +28,8 @@ $config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.N foreach ($langCode in $languageMap.Keys) { $models = $languageMap[$langCode] - + $dispatch = $models.dispatchModel + if($RemoteToLocal) { # Update local LU files based on hosted models @@ -42,6 +43,17 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($luisApp.id).lu" ` -o $(Join-Path $luisFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } # Update local LU files based on hosted QnA KBs @@ -55,6 +67,18 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($kb.id).lu" ` -o $(Join-Path $qnaFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } } else @@ -85,7 +109,6 @@ foreach ($langCode in $languageMap.Keys) { # Update dispatch model Write-Host "> Updating dispatch model ..." -$dispatch = $models.dispatchModel dispatch refresh ` --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` --dataFolder $dispatchFolder 2>> $logFile | Out-Null @@ -94,4 +117,4 @@ dispatch refresh ` Write-Host "> Running LuisGen ..." luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null -Write-Host "> Done." \ No newline at end of file +Write-Host "> Done." diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/update_cognitive_models.ps1 b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/update_cognitive_models.ps1 index 5c7646c315..725dd15d56 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/update_cognitive_models.ps1 +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Deployment/Scripts/update_cognitive_models.ps1 @@ -4,7 +4,7 @@ Param( [string] $configFile = $(Join-Path (Get-Location) 'cognitivemodels.json'), [switch] $RemoteToLocal, [string] $dispatchFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'Dispatch'), - [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), + [string] $luisFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'LU'), [string] $qnaFolder = $(Join-Path $PSScriptRoot '..' 'Resources' 'QnA'), [string] $lgOutFolder = $(Join-Path (Get-Location) 'Services'), [string] $logFile = $(Join-Path $PSScriptRoot .. "update_cognitive_models_log.txt") @@ -28,7 +28,8 @@ $config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.N foreach ($langCode in $languageMap.Keys) { $models = $languageMap[$langCode] - + $dispatch = $models.dispatchModel + if($RemoteToLocal) { # Update local LU files based on hosted models @@ -42,6 +43,17 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($luisApp.id).lu" ` -o $(Join-Path $luisFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } # Update local LU files based on hosted QnA KBs @@ -55,6 +67,18 @@ foreach ($langCode in $languageMap.Keys) { --stdin ` -n "$($kb.id).lu" ` -o $(Join-Path $qnaFolder $langCode) + + # 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 $dispatchFolder) 2>> $logFile | Out-Null } } else @@ -85,7 +109,6 @@ foreach ($langCode in $languageMap.Keys) { # Update dispatch model Write-Host "> Updating dispatch model ..." -$dispatch = $models.dispatchModel dispatch refresh ` --dispatch $(Join-Path $dispatchFolder $langCode "$($dispatch.name).dispatch") ` --dataFolder $dispatchFolder 2>> $logFile | Out-Null @@ -94,4 +117,4 @@ dispatch refresh ` Write-Host "> Running LuisGen ..." luisgen $(Join-Path $dispatchFolder $langCode "$($dispatch.name).json") -cs "DispatchLuis" -o $lgOutFolder 2>> $logFile | Out-Null -Write-Host "> Done." \ No newline at end of file +Write-Host "> Done."