Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 7a0572b

Browse files
Vishwac Sena KannanVishwac Sena Kannan
authored andcommitted
Fixing default for QnA to be .qna
1 parent f8874b1 commit 7a0572b

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

packages/luis/src/commands/luis/translate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export default class LuisTranslate extends Command {
1818
srclang: flags.string({description: 'Source lang code. Auto detect if missing.'}),
1919
tgtlang: flags.string({description: 'Comma separated list of target languages.', required: true}),
2020
translatekey: flags.string({description: 'Machine translation endpoint key.', required: true}),
21-
translate_comments: flags.string({description: 'When set, machine translate comments found in .lu or .qna file'}),
22-
translate_link_text: flags.string({description: 'When set, machine translate link description in .lu or .qna file'}),
21+
translate_comments: flags.string({description: 'When set, machine translate comments found in .lu file'}),
22+
translate_link_text: flags.string({description: 'When set, machine translate link description in .lu file'}),
2323
}
2424

2525
/* tslint:disable:forin no-for-in*/

packages/luis/src/commands/qnamaker/convert.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class QnamakerConvert extends Command {
1313
in: flags.string({description: 'Source .qna file(s) or QnA KB JSON file', required: true}),
1414
alterations: flags.boolean({description: 'Indicates if files is QnA Alterations'}),
1515
log: flags.boolean({description: 'Enables log messages', default: false}),
16-
sort: flags.boolean({description: 'When set, questions collections are alphabetically sorted are alphabetically sorted in .lu files', default: false}),
16+
sort: flags.boolean({description: 'When set, questions collections are alphabetically sorted are alphabetically sorted in .qna files', default: false}),
1717
recurse: flags.boolean({description: 'Indicates if sub-folders need to be considered to file .qna file(s)'}),
1818
out: flags.string({description: 'Output file or folder name. If not specified stdout will be used as output'}),
1919
name: flags.string({description: 'Name of the QnA KB'}),
@@ -70,12 +70,12 @@ export default class QnamakerConvert extends Command {
7070
}
7171

7272
private async writeOutput(convertedObject: any, flags: any, isQnA: boolean) {
73-
let filePath = await file.generateNewFilePath(flags.out, flags.in, isQnA)
73+
let filePath = await file.generateNewFilePath(flags.out, flags.in, isQnA, '', fileExtEnum.QnAFile)
7474
try {
7575
if (isQnA) {
7676
await fs.writeFile(filePath, JSON.stringify(convertedObject.finalQnAJSON, null, 2), 'utf-8')
7777
if (convertedObject.finalQnAAlterations) {
78-
let filePathAlterations = await file.generateNewFilePath(flags.out, flags.in, isQnA, 'alterations_')
78+
let filePathAlterations = await file.generateNewFilePath(flags.out, flags.in, isQnA, 'alterations_', fileExtEnum.QnAFile)
7979
await fs.writeFile(filePathAlterations, JSON.stringify(convertedObject.finalQnAAlterations, null, 2), 'utf-8')
8080
}
8181
} else {

packages/luis/src/commands/qnamaker/translate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ const luConverter = require('./../../parser/lufile/parseFileContents')
99
const fileExtEnum = require('./../../parser/lufile/helpers').FileExtTypeEnum
1010

1111
export default class QnamakerTranslate extends Command {
12-
static description = 'Translate given LUIS application JSON model or lu file(s)'
12+
static description = 'Translate given QnA maker application JSON model or qna file(s)'
1313

1414
static flags: flags.Input<any> = {
15-
in: flags.string({description: 'Source .lu file(s) or LUIS application JSON model', required: true}),
16-
recurse: flags.boolean({description: 'Indicates if sub-folders need to be considered to file .lu file(s)'}),
15+
in: flags.string({description: 'Source .qna file(s) or QnA maker application JSON model', required: true}),
16+
recurse: flags.boolean({description: 'Indicates if sub-folders need to be considered to find .qna file(s)'}),
1717
out: flags.string({description: 'Output folder name. If not specified stdout will be used as output'}),
1818
srclang: flags.string({description: 'Source lang code. Auto detect if missing.'}),
1919
tgtlang: flags.string({description: 'Comma separated list of target languages.', required: true}),
2020
translatekey: flags.string({description: 'Machine translation endpoint key.', required: true}),
21-
translate_comments: flags.string({description: 'When set, machine translate comments found in .lu or .qna file'}),
22-
translate_link_text: flags.string({description: 'When set, machine translate link description in .lu or .qna file'}),
21+
translate_comments: flags.string({description: 'When set, machine translate comments found in .qna file'}),
22+
translate_link_text: flags.string({description: 'When set, machine translate link description in .qna file'}),
2323
}
2424

2525
/* tslint:disable:forin no-for-in*/

packages/luis/src/utils/filehelper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getContentFromFile(file: string) {
5858
return fileContent
5959
}
6060

61-
export async function generateNewFilePath(outFileName: string, inputfile: string, isLu: boolean, prefix = ''): Promise<string> {
61+
export async function generateNewFilePath(outFileName: string, inputfile: string, isLu: boolean, prefix = '', extType: string = helpers.FileExtTypeEnum.LUFile): Promise<string> {
6262
let base = path.resolve(outFileName)
6363
let extension = path.extname(base)
6464
if (extension) {
@@ -70,9 +70,9 @@ export async function generateNewFilePath(outFileName: string, inputfile: string
7070
let name = ''
7171
let inputStat = await fs.stat(inputfile)
7272
if (inputStat.isFile()) {
73-
name += path.basename(inputfile, path.extname(inputfile)) + (isLu ? '.json' : '.lu')
73+
name += path.basename(inputfile, path.extname(inputfile)) + (isLu ? '.json' : extType)
7474
} else {
75-
name += isLu ? 'converted.json' : 'converted.lu'
75+
name += isLu ? 'converted.json' : `converted.${extType}`
7676
}
7777
return path.join(base, prefix + name)
7878
}

0 commit comments

Comments
 (0)