@@ -170,10 +170,10 @@ export class Builder {
170170 // otherwise create a new kb
171171 if ( recognizer . getKBId ( ) && recognizer . getKBId ( ) !== '' ) {
172172 // To see if need update the model
173- needPublish = await this . updateKB ( currentKB , content . content , qnaBuildCore , recognizer , currentKB . name , delayDuration )
173+ needPublish = await this . updateKB ( currentKB , qnaBuildCore , recognizer , delayDuration )
174174 } else {
175175 // create a new kb
176- needPublish = await this . createKB ( content . content , qnaBuildCore , recognizer , currentKB . name , delayDuration )
176+ needPublish = await this . createKB ( currentKB , qnaBuildCore , recognizer , delayDuration )
177177 }
178178
179179 if ( needPublish ) {
@@ -315,36 +315,36 @@ export class Builder {
315315 return { kb : currentQna . kb , alterations : currentQna . alterations }
316316 }
317317
318- async updateKB ( currentKB : any , qnaContent : string , qnaBuildCore : QnaBuildCore , recognizer : Recognizer , kbName : string , delayDuration : number ) {
318+ async updateKB ( currentKB : any , qnaBuildCore : QnaBuildCore , recognizer : Recognizer , delayDuration : number ) {
319319 await delay ( delayDuration )
320320 const existingKB = await qnaBuildCore . exportKB ( recognizer . getKBId ( ) , 'Prod' )
321321
322322 // compare models
323323 const isKBEqual = qnaBuildCore . isKBEqual ( currentKB , existingKB )
324324 if ( ! isKBEqual ) {
325325 try {
326- this . handler ( `Updating to new version for kb ${ kbName } ...\n` )
326+ this . handler ( `Updating to new version for kb ${ currentKB . name } ...\n` )
327327 await delay ( delayDuration )
328- await qnaBuildCore . replaceKB ( recognizer . getKBId ( ) , qnaContent )
328+ await qnaBuildCore . replaceKB ( recognizer . getKBId ( ) , currentKB )
329329
330- this . handler ( `Updating finished for kb ${ kbName } \n` )
330+ this . handler ( `Updating finished for kb ${ currentKB . name } \n` )
331331 } catch ( err ) {
332332 err . text = `Updating knowledge base failed: \n${ err . text } `
333333 throw err
334334 }
335335
336336 return true
337337 } else {
338- this . handler ( `kb ${ kbName } has no changes\n` )
338+ this . handler ( `kb ${ currentKB . name } has no changes\n` )
339339 return false
340340 }
341341 }
342342
343- async createKB ( qnaContent : string , qnaBuildCore : QnaBuildCore , recognizer : Recognizer , kbName : string , delayDuration : number ) {
344- this . handler ( `Creating qnamaker KB: ${ kbName } ...\n` )
343+ async createKB ( currentKB : any , qnaBuildCore : QnaBuildCore , recognizer : Recognizer , delayDuration : number ) {
344+ this . handler ( `Creating qnamaker KB: ${ currentKB . name } ...\n` )
345345 await delay ( delayDuration )
346346 const emptyKBJson = {
347- name : kbName ,
347+ name : currentKB . name ,
348348 qnaList : [ ] ,
349349 urls : [ ] ,
350350 files : [ ]
@@ -356,9 +356,9 @@ export class Builder {
356356 const opResult = await this . getKBOperationStatus ( qnaBuildCore , operationId , delayDuration )
357357 recognizer . setKBId ( opResult . resourceLocation . split ( '/' ) [ 2 ] )
358358 await delay ( delayDuration )
359- await qnaBuildCore . replaceKB ( recognizer . getKBId ( ) , qnaContent )
359+ await qnaBuildCore . replaceKB ( recognizer . getKBId ( ) , currentKB )
360360
361- this . handler ( `Creating finished for kb ${ kbName } \n` )
361+ this . handler ( `Creating finished for kb ${ currentKB . name } \n` )
362362 } catch ( err ) {
363363 err . text = `Creating knowledge base failed: \n${ err . text } `
364364 throw err
0 commit comments