Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Sync dispatch model with new cognitive models #1432

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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."
Write-Host "> Done."
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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."
Write-Host "> Done."
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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."
Write-Host "> Done."
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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."
Write-Host "> Done."