@@ -589,19 +589,21 @@ export class ProjectAnalyzeComponent implements OnInit {
589
589
}
590
590
591
591
sortQaChatData ( sr ) {
592
+ let arr = [ ] ;
592
593
for ( let i = 0 ; i < this . followUps . length ; i ++ ) {
593
594
if ( this . followUps [ i ] . prompt && this . followUps [ i ] . response ) {
594
- let arr = [ ] ;
595
+ let links = [ ] ;
596
+
595
597
for ( let j = 0 ; j < this . followUps [ i ] . reference . length ; j ++ ) {
596
598
if ( this . followUps [ i ] . reference [ j ] . text && ! this . followUps [ i ] . reference [ j ] . textErrMessage ) {
597
- arr . push ( this . followUps [ i ] . reference [ j ] . text ) ;
599
+ links . push ( this . followUps [ i ] . reference [ j ] . text ) ;
598
600
}
599
601
}
600
- this . followUps [ i ] . reference = arr ;
602
+ arr . push ( { prompt : this . followUps [ i ] . prompt , response : this . followUps [ i ] . response , reference : links } ) ;
601
603
}
602
604
}
603
605
sr . pid = this . projectId ;
604
- sr . userInput [ 0 ] . questionForText [ 0 ] [ 'followUps' ] = this . followUps ;
606
+ sr . userInput [ 0 ] . questionForText [ 0 ] [ 'followUps' ] = arr ;
605
607
if ( sr . _id ) {
606
608
sr . userInput [ 0 ] [ 'tid' ] = sr . _id ;
607
609
}
@@ -632,7 +634,6 @@ export class ProjectAnalyzeComponent implements OnInit {
632
634
this . annotationHistory . unshift ( addSubmit ) ;
633
635
this . annotationPrevious = JSON . parse ( JSON . stringify ( this . annotationHistory ) ) ;
634
636
}
635
- console . log ( 611 , this . annotationHistory ) ;
636
637
} else {
637
638
if ( from === 'review' ) {
638
639
if ( this . srInHistory ( ) == - 1 ) {
@@ -1883,6 +1884,7 @@ export class ProjectAnalyzeComponent implements OnInit {
1883
1884
} else {
1884
1885
if ( this . projectType == 'qaChat' && this . isQaChatModified ( ) ) {
1885
1886
this . isSkipOrBack ( 'history' ) ;
1887
+ return ;
1886
1888
}
1887
1889
this . clearCheckbox ( ) ;
1888
1890
const param = {
@@ -1894,9 +1896,12 @@ export class ProjectAnalyzeComponent implements OnInit {
1894
1896
}
1895
1897
1896
1898
isQaChatModified ( ) {
1897
- let old = JSON . stringify ( this . sr [ 'originalUserInputs' ] [ 0 ] ) ;
1899
+ let old = this . sr [ 'originalUserInputs' ] ? JSON . stringify ( this . sr [ 'originalUserInputs' ] [ 0 ] ) : '' ;
1898
1900
this . sr = this . sortQaChatData ( this . sr ) ;
1899
- let fresh = JSON . stringify ( this . sr . questionForText [ 0 ] ) ;
1901
+ let fresh =
1902
+ this . sr . questionForText && this . sr . questionForText [ 0 ] . prompt && this . sr . questionForText [ 0 ] . response
1903
+ ? JSON . stringify ( this . sr . questionForText [ 0 ] )
1904
+ : '' ;
1900
1905
return old == fresh ? false : true ;
1901
1906
}
1902
1907
@@ -2216,8 +2221,8 @@ export class ProjectAnalyzeComponent implements OnInit {
2216
2221
if ( this . projectType == 'qaChat' ) {
2217
2222
if ( this . isQaChatModified ( ) ) {
2218
2223
this . isSkipOrBack ( 'previous' ) ;
2224
+ return ;
2219
2225
}
2220
- console . log ( 222 , this . sr ) ;
2221
2226
let tid ;
2222
2227
if ( this . sr . _id ) {
2223
2228
tid = this . sr . _id ;
@@ -3284,14 +3289,6 @@ export class ProjectAnalyzeComponent implements OnInit {
3284
3289
produceQaChatInit ( res , from ?) {
3285
3290
this . sr [ 'originalUserInputs' ] = res . questionForText ;
3286
3291
this . sr . _id = res . _id ;
3287
- // this.sr.userInputs = from == 'review' ? res.reviewInfo.userInputs : res.userInputs;
3288
- // this.sr.questionForText = from == 'review' ? [res.reviewInfo.userInputs[0].problemCategory] : res.questionForText;
3289
- // this.sr.userInput[0].questionForText[0] =
3290
- // from == 'review' ? res.reviewInfo.userInputs[0].problemCategory : res.userInputs[0].problemCategory[0];
3291
- // let links =
3292
- // from == 'review' ? res.reviewInfo.userInputs[0].problemCategory.reference : res.questionForText[0].reference;
3293
- // let follow =
3294
- // from == 'review' ? res.reviewInfo.userInputs[0].problemCategory.followUps : res.questionForText[0].followUps;
3295
3292
this . sr . userInputs = res . userInputs ;
3296
3293
this . sr . questionForText = res . questionForText ;
3297
3294
this . sr . userInput [ 0 ] . questionForText [ 0 ] = res . userInputs [ 0 ] . problemCategory [ 0 ] ;
@@ -3306,7 +3303,6 @@ export class ProjectAnalyzeComponent implements OnInit {
3306
3303
}
3307
3304
}
3308
3305
this . followUps = follow ;
3309
- console . log ( 4.1 , this . followUps ) ;
3310
3306
for ( let i = 0 ; i < this . followUps . length ; i ++ ) {
3311
3307
if ( this . followUps [ i ] . prompt && this . followUps [ i ] . response ) {
3312
3308
let arr = [ ] ;
@@ -3319,8 +3315,6 @@ export class ProjectAnalyzeComponent implements OnInit {
3319
3315
this . followUps [ i ] . reference = arr ;
3320
3316
}
3321
3317
}
3322
- console . log ( 4.2 , this . followUps ) ;
3323
-
3324
3318
// make next item btn available
3325
3319
this . editQuestionError = '' ;
3326
3320
this . isValidQaChat ( ) ;
@@ -3417,6 +3411,7 @@ export class ProjectAnalyzeComponent implements OnInit {
3417
3411
this . sr . userInputs = responseSr . userInputs ;
3418
3412
this . sr . questionForText = responseSr . questionForText ;
3419
3413
if ( this . projectType === 'qaChat' ) {
3414
+ this . clearUserInput ( ) ;
3420
3415
this . produceQaChatInit ( responseSr ) ;
3421
3416
}
3422
3417
if ( ! this . sr . userInputs . length && this . labelType === 'HTL' ) {
0 commit comments