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 packages/lu/src/parser/lufile/parseFileContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ const validateAndGetRoles = function(parsedContent, roles, line, entityName, ent
let roleFound = parsedContent.LUISJsonStructure.flatListOfEntityAndRoles.find(item => item.roles.includes(role) || item.name === role);
if (roleFound !== undefined) {
// PL entities use roles for things like interchangeable, disabled, enabled for all models. There are really not 'dupes'.
let hasBadNonPLRoles = (roleFound.roles || []).filter(item => item !== PLCONSTS.INTERCHANGEABLE && item !== PLCONSTS.ENABLEDFORALLMODELS && item !== PLCONSTS.DISABLED);
let hasBadNonPLRoles = (roleFound.roles || []).filter(item => item.toLowerCase() !== PLCONSTS.INTERCHANGEABLE && item.toLowerCase() !== PLCONSTS.ENABLEDFORALLMODELS && item.toLowerCase() !== PLCONSTS.DISABLED);
if (hasBadNonPLRoles.length !== 0) {
let errorMsg = `Roles must be unique across entity types. Invalid role definition found "${entityName}". Prior definition - '@ ${roleFound.type} ${roleFound.name}${roleFound.roles.length > 0 ? ` hasRoles ${roleFound.roles.join(',')}` : ``}'`;
let error = BuildDiagnostic({
Expand Down
2 changes: 1 addition & 1 deletion packages/lu/src/parser/luis/luConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ const addRolesAndFeatures = function(entity) {
const updateUtterancesList = function (srcCollection, tgtCollection, attribute) {
(srcCollection || []).forEach(srcItem => {
let matchInTarget = tgtCollection.find(item => item.intent.name == srcItem.intent);
if(matchInTarget.utterances.length === 0) {
if(!matchInTarget || matchInTarget.utterances.length === 0) {
addUtteranceToCollection(attribute, srcItem, matchInTarget);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1175,5 +1175,27 @@ describe('V2 Entity definitions using @ notation', function () {
.catch(err => done(err))
})
})

describe('phrase lists with enabledForAllModels', function(){
it('BF-CLI #789 - phrase lists with enabledForAllModels parse correctly', function(done){
let luContent1 = new luObj(`@ phraselist Iam_gpl(interchangeable) enabledForAllModels =
- I
- I'm
- I am
- I be

@ phraselist my_gpl(interchangeable) enabledForAllModels =
- my
- mine
- me
`);
luBuilder.fromLUAsync([luContent1])
.then(res => {
assert.isTrue(res.model_features.length === 2);
done()
})
.catch(err => done(err))
})
})

});