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
10 changes: 9 additions & 1 deletion packages/luis/src/commands/luis/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Settings = require('@microsoft/bf-lu/lib/parser/lubuild/settings')
const MultiLanguageRecognizer = require('@microsoft/bf-lu/lib/parser/lubuild/multi-language-recognizer')
const Recognizer = require('@microsoft/bf-lu/lib/parser/lubuild/recognizer')
const Builder = require('@microsoft/bf-lu/lib/parser/lubuild/builder').Builder
const utils = require('../../utils/index')

export default class LuisBuild extends Command {
static description = 'Build lu files to train and publish luis applications'
Expand All @@ -27,7 +28,7 @@ export default class LuisBuild extends Command {
static flags: flags.Input<any> = {
help: flags.help({char: 'h'}),
in: flags.string({char: 'i', description: 'Lu file or folder'}),
authoringKey: flags.string({description: 'LUIS authoring key', required: true}),
authoringKey: flags.string({description: 'LUIS authoring key'}),
botName: flags.string({description: 'Bot name'}),
region: flags.string({description: 'LUIS authoring region [westus|westeurope|australiaeast]', default: 'westus'}),
out: flags.string({char: 'o', description: 'Output file or folder name. If not specified, current directory will be used as output'}),
Expand All @@ -43,6 +44,7 @@ export default class LuisBuild extends Command {
async run() {
try {
const {flags} = this.parse(LuisBuild)
const userConfig = await utils.getUserConfig(this.config.configDir)

flags.stdin = await this.readStdin()

Expand All @@ -66,6 +68,12 @@ export default class LuisBuild extends Command {
throw new CLIError('Missing input. Please use stdin or pass a file or folder location with --in flag')
}

if (!flags.authoringKey && (!userConfig || !userConfig.authoringKey)) {
throw new CLIError('Missing luis authoring key. Please pass authoring key with --authoringKey flag')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

luis [](start = 36, length = 4)

Should be LUIS.

} else {
flags.authoringKey = flags.authoringKey || userConfig.authoringKey

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userConfig.authoringKey [](start = 51, length = 23)

Is there a separate PR for adding this to config? Even if config allows anything, I would still expect to see documentation updates both for this command and for config.

}

if (!flags.botName) {
throw new CLIError('Missing bot name. Please pass bot name with --botName flag')
}
Expand Down
2 changes: 1 addition & 1 deletion packages/luis/test/commands/luis/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('luis:build cli parameters test', () => {
.stderr()
.command(['luis:build', '--in', `${path.join(__dirname, './../../fixtures/testcases/lubuild')}`, '--botName', 'Contoso'])
.it('displays an error if any required input parameters are missing', ctx => {
expect(ctx.stderr).to.contain('Missing required flag:\n --authoringKey AUTHORINGKEY')
expect(ctx.stderr).to.contain('Missing luis authoring key. Please pass authoring key with --authoringKey flag')
})

test
Expand Down