Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion build/botframework-cli-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pr:
jobs:
- job: CLI
variables:
buildVersion: '4.9.0-RC6'
buildVersion: '4.9.0-RC42'
_version: ${{coalesce(variables.version, variables.buildVersion)}}

steps:
Expand Down
2 changes: 1 addition & 1 deletion build/botframework-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pr:
jobs:
- job: CLI
variables:
buildVersion: '4.9.0-RC6'
buildVersion: '4.9.0-RC42'
_version: ${{coalesce(variables.version, variables.buildVersion)}}

steps:
Expand Down
28 changes: 16 additions & 12 deletions packages/lu/src/parser/luis/luConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ const parseEntitiesToLu = function(luisJson){
}
fileContent += NEWLINE + NEWLINE;
}
fileContent += `@ ml `;
fileContent += entity.name.includes(' ') ? `"${entity.name}"` : `${entity.name}`;
fileContent += `@ ${getEntityType(entity.features)} ${writeEntityName(entity.name)}`;
fileContent += addRolesAndFeatures(entity);
fileContent += NEWLINE + NEWLINE;
} else {
Expand All @@ -205,6 +204,10 @@ const parseEntitiesToLu = function(luisJson){
return fileContent
}

const writeEntityName = function(entityName) {
return entityName.includes(' ') ? `"${entityName}"` : `${entityName}`
}

const parseToLuPrebuiltEntities = function(luisJson){
let fileContent = ''
if(!luisJson.prebuiltEntities){
Expand Down Expand Up @@ -367,7 +370,7 @@ const addAppMetaData = function(LUISJSON) {
const handleNDepthEntity = function(entity) {
let fileContent = '';
const BASE_TAB_STOP = 1;
fileContent += `@ ${EntityTypeEnum.ML} ${entity.name}`;
fileContent += `@ ${getEntityType(entity.features)} ${writeEntityName(entity.name)}`;
fileContent += addRolesAndFeatures(entity);
fileContent += NEWLINE;
fileContent += addNDepthChildDefinitions(entity.children, BASE_TAB_STOP, fileContent) + NEWLINE + NEWLINE
Expand All @@ -383,15 +386,7 @@ const addNDepthChildDefinitions = function(childCollection, tabStop, fileContent
let myFileContent = '';
(childCollection || []).forEach(child => {
myFileContent += "".padStart(tabStop * 4, ' ');
myFileContent += '- @ ';
// find constraint
let constraint = (child.features || []).find(feature => feature.isRequired == true);
if (constraint !== undefined) {
myFileContent += constraint.modelName;
} else {
myFileContent += EntityTypeEnum.ML;
}
myFileContent += ` ${child.name}`;
myFileContent += `- @ ${getEntityType(child.features)} ${writeEntityName(child.name)}`;
myFileContent += addRolesAndFeatures(child);
myFileContent += NEWLINE;
if (child.children && child.children.length !== 0) {
Expand All @@ -400,6 +395,15 @@ const addNDepthChildDefinitions = function(childCollection, tabStop, fileContent
});
return myFileContent;
}
const getEntityType = function(features) {
// find constraint
let constraint = (features || []).find(feature => feature.isRequired == true);
if (constraint !== undefined) {
return constraint.modelName;
} else {
return EntityTypeEnum.ML;
}
}
/**
* Helper to construt role and features list for an entity
* @param {Object} entity
Expand Down
4 changes: 4 additions & 0 deletions packages/lu/test/commands/luis/convert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ describe('luis:convert version 7 upgrade test', () => {
it('luis:convert successfully converts LUIS JSON model with no phrase lists (output must have phraselists if any v6 concepts are present in the .lu file)', async () => {
await assertToJSON('./../../fixtures/testcases/plWithFlags.lu', './../../fixtures/verified/plWithFlags.json')
})

it('Child entities names with spaces in them parse correctly to .lu format', async () => {
await assertToLu('./../../fixtures/testcases/Child_Entity_With_Spaces.json', './../../fixtures/verified/Child_Entity_With_Spaces.lu')
})
})

describe('luis:convert negative tests', () => {
Expand Down
Loading