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

Commit 3984a45

Browse files
authored
remove empty followUps && historyBack validation && references display more clear && clear unnecessary console && init new qa data (#439)
1 parent 8d5b796 commit 3984a45

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

annotation-app/src/app/component/projects/project-analyze/latest-annotation-data/latest-annotation-data.component.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,13 @@ <h4 style="margin-bottom: 1rem">Assigned Labels Data</h4>
280280
<!-- following cell will show if projectType is qaChat -->
281281
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.prompt }}</clr-dg-cell>
282282
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.response }}</clr-dg-cell>
283-
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.reference }}</clr-dg-cell>
283+
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">
284+
<clr-datagrid *ngFor="let link of innerCell.reference">
285+
<clr-dg-row>
286+
<clr-dg-cell>{{ link }}</clr-dg-cell>
287+
</clr-dg-row>
288+
</clr-datagrid>
289+
</clr-dg-cell>
284290
</clr-dg-row>
285291
</clr-datagrid>
286292
</clr-dg-cell>
@@ -408,7 +414,13 @@ <h4 style="margin-bottom: 1rem">Assigned Labels Data</h4>
408414
<!-- following cell will show if projectType is qaChat -->
409415
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.prompt }}</clr-dg-cell>
410416
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.response }}</clr-dg-cell>
411-
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.reference }}</clr-dg-cell>
417+
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">
418+
<clr-datagrid *ngFor="let link of innerCell.reference">
419+
<clr-dg-row>
420+
<clr-dg-cell>{{ link }}</clr-dg-cell>
421+
</clr-dg-row>
422+
</clr-datagrid>
423+
</clr-dg-cell>
412424
</clr-dg-row>
413425
</clr-datagrid>
414426
</clr-dg-cell>

annotation-app/src/app/component/projects/project-analyze/project-analyze.component.ts

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -589,19 +589,21 @@ export class ProjectAnalyzeComponent implements OnInit {
589589
}
590590

591591
sortQaChatData(sr) {
592+
let arr = [];
592593
for (let i = 0; i < this.followUps.length; i++) {
593594
if (this.followUps[i].prompt && this.followUps[i].response) {
594-
let arr = [];
595+
let links = [];
596+
595597
for (let j = 0; j < this.followUps[i].reference.length; j++) {
596598
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);
598600
}
599601
}
600-
this.followUps[i].reference = arr;
602+
arr.push({ prompt: this.followUps[i].prompt, response: this.followUps[i].response, reference: links });
601603
}
602604
}
603605
sr.pid = this.projectId;
604-
sr.userInput[0].questionForText[0]['followUps'] = this.followUps;
606+
sr.userInput[0].questionForText[0]['followUps'] = arr;
605607
if (sr._id) {
606608
sr.userInput[0]['tid'] = sr._id;
607609
}
@@ -632,7 +634,6 @@ export class ProjectAnalyzeComponent implements OnInit {
632634
this.annotationHistory.unshift(addSubmit);
633635
this.annotationPrevious = JSON.parse(JSON.stringify(this.annotationHistory));
634636
}
635-
console.log(611, this.annotationHistory);
636637
} else {
637638
if (from === 'review') {
638639
if (this.srInHistory() == -1) {
@@ -1883,6 +1884,7 @@ export class ProjectAnalyzeComponent implements OnInit {
18831884
} else {
18841885
if (this.projectType == 'qaChat' && this.isQaChatModified()) {
18851886
this.isSkipOrBack('history');
1887+
return;
18861888
}
18871889
this.clearCheckbox();
18881890
const param = {
@@ -1894,9 +1896,12 @@ export class ProjectAnalyzeComponent implements OnInit {
18941896
}
18951897

18961898
isQaChatModified() {
1897-
let old = JSON.stringify(this.sr['originalUserInputs'][0]);
1899+
let old = this.sr['originalUserInputs'] ? JSON.stringify(this.sr['originalUserInputs'][0]) : '';
18981900
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+
: '';
19001905
return old == fresh ? false : true;
19011906
}
19021907

@@ -2216,8 +2221,8 @@ export class ProjectAnalyzeComponent implements OnInit {
22162221
if (this.projectType == 'qaChat') {
22172222
if (this.isQaChatModified()) {
22182223
this.isSkipOrBack('previous');
2224+
return;
22192225
}
2220-
console.log(222, this.sr);
22212226
let tid;
22222227
if (this.sr._id) {
22232228
tid = this.sr._id;
@@ -3284,14 +3289,6 @@ export class ProjectAnalyzeComponent implements OnInit {
32843289
produceQaChatInit(res, from?) {
32853290
this.sr['originalUserInputs'] = res.questionForText;
32863291
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;
32953292
this.sr.userInputs = res.userInputs;
32963293
this.sr.questionForText = res.questionForText;
32973294
this.sr.userInput[0].questionForText[0] = res.userInputs[0].problemCategory[0];
@@ -3306,7 +3303,6 @@ export class ProjectAnalyzeComponent implements OnInit {
33063303
}
33073304
}
33083305
this.followUps = follow;
3309-
console.log(4.1, this.followUps);
33103306
for (let i = 0; i < this.followUps.length; i++) {
33113307
if (this.followUps[i].prompt && this.followUps[i].response) {
33123308
let arr = [];
@@ -3319,8 +3315,6 @@ export class ProjectAnalyzeComponent implements OnInit {
33193315
this.followUps[i].reference = arr;
33203316
}
33213317
}
3322-
console.log(4.2, this.followUps);
3323-
33243318
// make next item btn available
33253319
this.editQuestionError = '';
33263320
this.isValidQaChat();
@@ -3417,6 +3411,7 @@ export class ProjectAnalyzeComponent implements OnInit {
34173411
this.sr.userInputs = responseSr.userInputs;
34183412
this.sr.questionForText = responseSr.questionForText;
34193413
if (this.projectType === 'qaChat') {
3414+
this.clearUserInput();
34203415
this.produceQaChatInit(responseSr);
34213416
}
34223417
if (!this.sr.userInputs.length && this.labelType === 'HTL') {

0 commit comments

Comments
 (0)