Skip to content
This repository was archived by the owner on Jul 17, 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
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ <h4 style="margin-bottom: 1rem">Assigned Labels Data</h4>
<!-- following cell will show if projectType is qaChat -->
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.prompt }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.response }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.reference }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">
<clr-datagrid *ngFor="let link of innerCell.reference">
<clr-dg-row>
<clr-dg-cell>{{ link }}</clr-dg-cell>
</clr-dg-row>
</clr-datagrid>
</clr-dg-cell>
</clr-dg-row>
</clr-datagrid>
</clr-dg-cell>
Expand Down Expand Up @@ -408,7 +414,13 @@ <h4 style="margin-bottom: 1rem">Assigned Labels Data</h4>
<!-- following cell will show if projectType is qaChat -->
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.prompt }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.response }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">{{ innerCell.reference }}</clr-dg-cell>
<clr-dg-cell *ngIf="msg.projectType == 'qaChat'">
<clr-datagrid *ngFor="let link of innerCell.reference">
<clr-dg-row>
<clr-dg-cell>{{ link }}</clr-dg-cell>
</clr-dg-row>
</clr-datagrid>
</clr-dg-cell>
</clr-dg-row>
</clr-datagrid>
</clr-dg-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,19 +589,21 @@ export class ProjectAnalyzeComponent implements OnInit {
}

sortQaChatData(sr) {
let arr = [];
for (let i = 0; i < this.followUps.length; i++) {
if (this.followUps[i].prompt && this.followUps[i].response) {
let arr = [];
let links = [];

for (let j = 0; j < this.followUps[i].reference.length; j++) {
if (this.followUps[i].reference[j].text && !this.followUps[i].reference[j].textErrMessage) {
arr.push(this.followUps[i].reference[j].text);
links.push(this.followUps[i].reference[j].text);
}
}
this.followUps[i].reference = arr;
arr.push({ prompt: this.followUps[i].prompt, response: this.followUps[i].response, reference: links });
}
}
sr.pid = this.projectId;
sr.userInput[0].questionForText[0]['followUps'] = this.followUps;
sr.userInput[0].questionForText[0]['followUps'] = arr;
if (sr._id) {
sr.userInput[0]['tid'] = sr._id;
}
Expand Down Expand Up @@ -632,7 +634,6 @@ export class ProjectAnalyzeComponent implements OnInit {
this.annotationHistory.unshift(addSubmit);
this.annotationPrevious = JSON.parse(JSON.stringify(this.annotationHistory));
}
console.log(611, this.annotationHistory);
} else {
if (from === 'review') {
if (this.srInHistory() == -1) {
Expand Down Expand Up @@ -1883,6 +1884,7 @@ export class ProjectAnalyzeComponent implements OnInit {
} else {
if (this.projectType == 'qaChat' && this.isQaChatModified()) {
this.isSkipOrBack('history');
return;
}
this.clearCheckbox();
const param = {
Expand All @@ -1894,9 +1896,12 @@ export class ProjectAnalyzeComponent implements OnInit {
}

isQaChatModified() {
let old = JSON.stringify(this.sr['originalUserInputs'][0]);
let old = this.sr['originalUserInputs'] ? JSON.stringify(this.sr['originalUserInputs'][0]) : '';
this.sr = this.sortQaChatData(this.sr);
let fresh = JSON.stringify(this.sr.questionForText[0]);
let fresh =
this.sr.questionForText && this.sr.questionForText[0].prompt && this.sr.questionForText[0].response
? JSON.stringify(this.sr.questionForText[0])
: '';
return old == fresh ? false : true;
}

Expand Down Expand Up @@ -2216,8 +2221,8 @@ export class ProjectAnalyzeComponent implements OnInit {
if (this.projectType == 'qaChat') {
if (this.isQaChatModified()) {
this.isSkipOrBack('previous');
return;
}
console.log(222, this.sr);
let tid;
if (this.sr._id) {
tid = this.sr._id;
Expand Down Expand Up @@ -3284,14 +3289,6 @@ export class ProjectAnalyzeComponent implements OnInit {
produceQaChatInit(res, from?) {
this.sr['originalUserInputs'] = res.questionForText;
this.sr._id = res._id;
// this.sr.userInputs = from == 'review' ? res.reviewInfo.userInputs : res.userInputs;
// this.sr.questionForText = from == 'review' ? [res.reviewInfo.userInputs[0].problemCategory] : res.questionForText;
// this.sr.userInput[0].questionForText[0] =
// from == 'review' ? res.reviewInfo.userInputs[0].problemCategory : res.userInputs[0].problemCategory[0];
// let links =
// from == 'review' ? res.reviewInfo.userInputs[0].problemCategory.reference : res.questionForText[0].reference;
// let follow =
// from == 'review' ? res.reviewInfo.userInputs[0].problemCategory.followUps : res.questionForText[0].followUps;
this.sr.userInputs = res.userInputs;
this.sr.questionForText = res.questionForText;
this.sr.userInput[0].questionForText[0] = res.userInputs[0].problemCategory[0];
Expand All @@ -3306,7 +3303,6 @@ export class ProjectAnalyzeComponent implements OnInit {
}
}
this.followUps = follow;
console.log(4.1, this.followUps);
for (let i = 0; i < this.followUps.length; i++) {
if (this.followUps[i].prompt && this.followUps[i].response) {
let arr = [];
Expand All @@ -3319,8 +3315,6 @@ export class ProjectAnalyzeComponent implements OnInit {
this.followUps[i].reference = arr;
}
}
console.log(4.2, this.followUps);

// make next item btn available
this.editQuestionError = '';
this.isValidQaChat();
Expand Down Expand Up @@ -3417,6 +3411,7 @@ export class ProjectAnalyzeComponent implements OnInit {
this.sr.userInputs = responseSr.userInputs;
this.sr.questionForText = responseSr.questionForText;
if (this.projectType === 'qaChat') {
this.clearUserInput();
this.produceQaChatInit(responseSr);
}
if (!this.sr.userInputs.length && this.labelType === 'HTL') {
Expand Down