Skip to content

Commit

Permalink
Merge pull request #438 from rekeyz/master
Browse files Browse the repository at this point in the history
Qa chat
  • Loading branch information
Kai-Qiao authored Mar 8, 2024
2 parents 8216bfd + 6fbf889 commit 8d5b796
Show file tree
Hide file tree
Showing 22 changed files with 1,018 additions and 278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<h5>{{ msg?.from === 'review' ? 'Review' : 'Annotation' }} Progress</h5>
<div class="left-project-info fontSizeSmall">
<clr-progress-bar
*ngIf="msg?.projectInfo.projectType != 'qaChat'"
title="{{
msg?.from === 'review'
? 'Reviewed
Expand All @@ -25,7 +26,7 @@ <h5>{{ msg?.from === 'review' ? 'Review' : 'Annotation' }} Progress</h5>
: 'Labeled Items'
}}:&nbsp;&nbsp;{{ msg?.progressInfo?.completeCase }}
</div>
<div *ngIf="msg.from !== 'review'">
<div *ngIf="msg.from !== 'review' && msg?.projectInfo.projectType != 'qaChat'">
<cds-icon shape="circle" solid size="xs" style="color: rgb(229, 229, 299)"></cds-icon>
Assigned Items:&nbsp;&nbsp;{{ msg?.progressInfo?.assignedCase }}
</div>
Expand Down Expand Up @@ -142,8 +143,12 @@ <h5>Task Details</h5>
Source:&nbsp;&nbsp;{{ msg?.projectInfo.dataSource }}
</div>
<div>Create Date:&nbsp;&nbsp;{{ msg?.projectInfo.createdDate | date : 'yyyy-MM-dd HH:mm:ss' }}</div>
<div>Assignment Logic:&nbsp;&nbsp;{{ msg?.projectInfo.assignmentLogic }}</div>
<div>Max Annotation:&nbsp;&nbsp;{{ msg?.projectInfo.maxAnnotation }}</div>
<div *ngIf="msg?.projectInfo.projectType != 'qaChat'">
Assignment Logic:&nbsp;&nbsp;{{ msg?.projectInfo.assignmentLogic }}
</div>
<div *ngIf="msg?.projectInfo.projectType != 'qaChat'">
Max Annotation:&nbsp;&nbsp;{{ msg?.projectInfo.maxAnnotation }}
</div>
<div class="ellipsis" title="{{ msg?.projectInfo.taskInstructions }}">
Instruction:&nbsp;&nbsp;{{ msg?.projectInfo.taskInstructions }}
</div>
Expand All @@ -164,7 +169,8 @@ <h5>History</h5>
*ngIf="
msg.projectInfo.projectType == 'ner' ||
(msg.projectInfo.projectType == 'qa' && msg.projectInfo.regression == false) ||
msg.projectInfo.projectType == 'log'
msg.projectInfo.projectType == 'log' ||
msg.projectInfo.projectType == 'qaChat'
"
title="{{ flag.text }}"
>
Expand All @@ -178,7 +184,8 @@ <h5>History</h5>
msg.projectInfo.projectType !== 'ner' &&
!(msg.projectInfo.projectType == 'qa' && msg.projectInfo.regression == false) &&
msg.projectInfo.projectType !== 'image' &&
msg.projectInfo.projectType !== 'log'
msg.projectInfo.projectType !== 'log' &&
msg.projectInfo.projectType !== 'qaChat'
"
title="{{ flag.key + ':' + flag.value }}"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<option value="image">Image Classification</option>
<option value="log">Log Classification</option>
<option value="qa">Question Answer</option>
<option value="qaChat">Question Answer Conversational</option>
</select>
</div>
<div class="clr-col-12 clr-col-md-1">
Expand All @@ -103,7 +104,7 @@
></textarea>
</div>
</div>
<div class="clr-row formField">
<div *ngIf="dsDialogForm.get('projectType').value != 'qaChat'" class="clr-row formField">
<label for="annotationDisplayName" class="label-tooltip clr-col-12 clr-col-md-2"
>Annotation Display Name
<clr-tooltip>
Expand Down Expand Up @@ -137,7 +138,7 @@
</clr-tooltip>
</div>
</div>
<div class="clr-row formField">
<div *ngIf="dsDialogForm.get('projectType').value != 'qaChat'" class="clr-row formField">
<label for="annotationQuestion" class="label-tooltip clr-col-12 clr-col-md-2"
>Annotation Question
<clr-tooltip>
Expand Down Expand Up @@ -173,6 +174,7 @@
</div>
</clr-wizard-page>
<clr-wizard-page
*ngIf="dsDialogForm.get('projectType').value != 'qaChat'"
[id]="2"
(clrWizardPageOnLoad)="clrWizardPageOnLoad($event)"
[clrWizardPageNextDisabled]="!dsDialogForm.get('selectedDataset').value"
Expand Down Expand Up @@ -306,7 +308,11 @@
<!-- select label and text column -->
<clr-wizard-page
[id]="3"
*ngIf="dsDialogForm.get('projectType').value !== 'image' && dsDialogForm.get('projectType').value !== 'log'"
*ngIf="
dsDialogForm.get('projectType').value !== 'image' &&
dsDialogForm.get('projectType').value !== 'log' &&
dsDialogForm.get('projectType').value !== 'qaChat'
"
(clrWizardPageCustomButton)="doCustomClick($event)"
[clrWizardPageNextDisabled]="
dsDialogForm.get('projectType').value === 'ner' || dsDialogForm.get('projectType').value === 'qa'
Expand Down Expand Up @@ -503,7 +509,7 @@
</clr-wizard-page>
<clr-wizard-page
[id]="4"
*ngIf="dsDialogForm.get('projectType').value !== 'qa'"
*ngIf="dsDialogForm.get('projectType').value !== 'qa' && dsDialogForm.get('projectType').value !== 'qaChat'"
[clrWizardPageNextDisabled]="clrWizardPageNextDisabled.page4"
(clrWizardPageOnLoad)="clrWizardPageOnLoad($event)"
>
Expand Down Expand Up @@ -903,7 +909,7 @@
<ng-template clrPageTitle>Assign Team Members</ng-template>
<div [formGroup]="dsDialogForm">
<!-- total row -->
<div class="clr-row formField">
<div *ngIf="dsDialogForm.get('projectType').value !== 'qaChat'" class="clr-row formField">
<label for="totalRow" class="label-tooltip clr-col-12 clr-col-md-2">{{
dsDialogForm.get('projectType').value === 'image'
? 'Total Items'
Expand All @@ -925,7 +931,7 @@
</div>
</div>
<!-- maxAnnotations -->
<div class="clr-row formField">
<div *ngIf="dsDialogForm.get('projectType').value !== 'qaChat'" class="clr-row formField">
<label for="maxAnnotations" class="label-tooltip clr-col-12 clr-col-md-2"
>Max Annotations Per Case<span>*</span>
<clr-tooltip>
Expand Down Expand Up @@ -1042,8 +1048,13 @@
[ngModelOptions]="{ standalone: true }"
/>
</div>
<div style="margin-right: 0.5rem; margin-left: 0.5rem">-</div>
<div class="clr-input-wrapper clr-col-4">
<div
*ngIf="dsDialogForm.get('projectType').value !== 'qaChat'"
style="margin-right: 0.5rem; margin-left: 0.5rem"
>
-
</div>
<div *ngIf="dsDialogForm.get('projectType').value !== 'qaChat'" class="clr-input-wrapper clr-col-4">
<input
type="number"
class="clr-input"
Expand Down Expand Up @@ -1204,7 +1215,7 @@
</div>
</clr-wizard-page>
<clr-wizard-page
*ngIf="dsDialogForm.get('projectType').value !== 'image'"
*ngIf="dsDialogForm.get('projectType').value !== 'image' && dsDialogForm.get('projectType').value !== 'qaChat'"
[id]="6"
[clrWizardPageNextDisabled]="
isShowNumeric ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ export class CreateProjectComponent implements OnInit {
}
if (e === 'clr-wizard-page-5') {
this.toEvenlyDistributeTicket();
if (this.dsDialogForm.get('totalRow').value < 1 || this.dsDialogForm.get('maxAnnotations').value < 0) {
if (
this.dsDialogForm.get('projectType').value !== 'qaChat' &&
(this.dsDialogForm.get('totalRow').value < 1 || this.dsDialogForm.get('maxAnnotations').value < 0)
) {
return (this.clrWizardPageNextDisabled.page5 = true);
}
if (!this.assignType[0].checked && !this.assignType[1].checked) {
Expand All @@ -201,6 +204,10 @@ export class CreateProjectComponent implements OnInit {
}
}
this.clrWizardPageNextDisabled.page5 = false;
if (this.dsDialogForm.get('projectType').value === 'qaChat') {
this.clrWizardPageNextDisabled.page4 = false;
this.clrWizardPageNextDisabled.page6 = false;
}
return;
}
if (e === 'clr-wizard-page-6') {
Expand Down Expand Up @@ -336,11 +343,6 @@ export class CreateProjectComponent implements OnInit {
if ('custom-previous' === buttonType) {
this.wizard.previous();
}

// if ('custom-finish' === buttonType) {
// // if click the image type finish in assign email page
// this.toCreate();
// }
}

createForm(): void {
Expand Down Expand Up @@ -517,37 +519,14 @@ export class CreateProjectComponent implements OnInit {
this.checkboxChecked = [];
this.helpfulText = [];
}

// if (this.dsDialogForm.get('projectType').value !== 'ner') {
// this.dsDialogForm.get('labels').setValue([]);
// this.categoryList = [];
// }
// this.isShowLabelRadio = false;
// this.nonEnglish = 0;
// this.totalCase = 0;
// this.dsDialogForm.get('totalRow').setValue(0);
// this.minLabel = null;
// this.maxLabel = null;
// this.dsDialogForm.get('min').setValue(null);
// this.dsDialogForm.get('max').setValue(null);
// this.labelType = '';
// this.isNumeric = null;
// this.isShowNumeric = false;
// this.dsDialogForm.get('multipleLabel').setValue(null);
// this.isMultipleLabel = null;
// this.isMutilNumericLabel = false;
// this.isUploadLabel = false;
// this.dsDialogForm.get('mutilLabelArray').reset();
// while (this.mutilLabelArray.length > 2) {
// this.mutilLabelArray.removeAt(2);
// }
}

changeProjectType() {
this.clearFormdata(1);
this.dealAnnotationQuestionTex(this.dsDialogForm.value.projectType);
this.getMyDatasets(this.dsDialogForm.get('projectType').value).then((res) => {});
this.getMyDatasets(this.dsDialogForm.get('projectType').value);
}

dealAnnotationQuestionTex(type) {
const questesion = {
qa: 'Label all answers in the given text corpus according to the question.',
Expand All @@ -556,7 +535,11 @@ export class CreateProjectComponent implements OnInit {
let questionTex = Object.keys(questesion).includes(type) ? questesion[type] : this.dataset.annotationQuestion;
this.dsDialogForm.get('annotationQuestion').setValue(questionTex);
}

getMyDatasets(projectType) {
if (projectType == 'qaChat') {
return;
}
let a =
projectType == 'text' || projectType == 'tabular' || projectType == 'ner' || projectType == 'qa'
? 'csv'
Expand Down Expand Up @@ -1182,6 +1165,12 @@ export class CreateProjectComponent implements OnInit {
formData.append('pname', this.dsDialogForm.value.projectName);
formData.append('projectType', this.dsDialogForm.value.projectType);
formData.append('taskInstruction', this.dsDialogForm.value.taskInstruction);
formData.append('assignee', JSON.stringify(this.toCheckAssigneeList()));
if (this.dsDialogForm.value.projectType === 'qaChat') {
formData.append('isMultipleLabel', 'true');
formData.append('labels', '');
return this.apiService.postDataset(formData);
}
formData.append('ticketDescription', this.dsDialogForm.value.annotationDisplayName);
formData.append('annotationQuestion', this.dsDialogForm.value.annotationQuestion);
formData.append('fileName', this.datasetInfo.fileName);
Expand Down Expand Up @@ -1236,7 +1225,6 @@ export class CreateProjectComponent implements OnInit {
formData.append('slack', this.assignType[1].checked ? JSON.stringify(this.slackList) : '[]');
formData.append('maxAnnotations', this.dsDialogForm.value.maxAnnotations);
formData.append('assignmentLogic', this.dsDialogForm.value.assignmentLogic);
formData.append('assignee', JSON.stringify(this.toCheckAssigneeList()));
formData.append('min', this.categoryListInfoToCategoryList()[0].min);
formData.append('max', this.categoryListInfoToCategoryList()[0].max);
formData.append('estimator', this.dsDialogForm.value.selectedClassifier);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2019-2023 VMware, Inc.
<!-- Copyright 2019-2024 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 -->

<div class="modal footerLeft">
Expand Down Expand Up @@ -71,7 +71,8 @@ <h3 class="modal-title">Download Datasets</h3>
msg.projectType == 'qa' ||
msg.projectType == 'image' ||
msg.labelType == 'numericLabel' ||
msg.projectType == 'log'
msg.projectType == 'log' ||
msg.projectType == 'qaChat'
"
/>
<label>Top Label</label>
Expand All @@ -89,13 +90,14 @@ <h3 class="modal-title">Download Datasets</h3>
msg.projectType == 'qa' ||
msg.projectType == 'image' ||
msg.labelType == 'numericLabel' ||
msg.projectType == 'log'
msg.projectType == 'log' ||
msg.projectType == 'qaChat'
"
/>
<label>Probabilistic</label>
</clr-radio-wrapper>
</clr-radio-container>
<div class="clr-checkbox-wrapper removeEntry">
<div *ngIf="msg.projectType !== 'qaChat'" class="clr-checkbox-wrapper removeEntry">
<input
type="checkbox"
id="removeUnlabel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2019-2023 VMware, Inc.
<!-- Copyright 2019-2024 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 -->

<div class="modal footerLeft">
Expand Down Expand Up @@ -54,7 +54,8 @@ <h3 class="modal-title">Generate Datasets</h3>
msg.projectType == 'qa' ||
msg.projectType == 'image' ||
msg.projectType == 'log' ||
msg.labelType == 'numericLabel'
msg.labelType == 'numericLabel' ||
msg.projectType == 'qaChat'
"
/>
<label>Top Label</label>
Expand All @@ -72,13 +73,14 @@ <h3 class="modal-title">Generate Datasets</h3>
msg.projectType == 'qa' ||
msg.projectType == 'image' ||
msg.projectType == 'log' ||
msg.labelType == 'numericLabel'
msg.labelType == 'numericLabel' ||
msg.projectType == 'qaChat'
"
/>
<label>Probabilistic</label>
</clr-radio-wrapper>
</clr-radio-container>
<div class="clr-checkbox-wrapper removeEntry">
<div *ngIf="msg.projectType !== 'qaChat'" class="clr-checkbox-wrapper removeEntry">
<input
type="checkbox"
id="removeUnlabel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2019-2023 VMware, Inc.
<!-- Copyright 2019-2024 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 -->

<div class="modal">
Expand Down Expand Up @@ -217,7 +217,9 @@ <h3 class="modal-title">Edit Project</h3>
class="clr-input"
title="Number of tickets assigned"
placeholder="Number of tickets assigned"
[disabled]="!(user.email && !user.setUserErrMessage && !user.emailReg)"
[disabled]="
!(user.email && !user.setUserErrMessage && !user.emailReg) || msg.projectType == 'qaChat'
"
[(ngModel)]="user.assignedCase"
(blur)="inputTicketsUpdate(user)"
style="width: 100%"
Expand Down Expand Up @@ -783,7 +785,10 @@ <h3 class="modal-title">Edit Project</h3>
</div>
<div
class="prev-info clr-row"
*ngIf="labelType == 'numericLabel' || msg.projectType == 'ner' || msg.isMultipleLabel"
*ngIf="
(labelType == 'numericLabel' || msg.projectType == 'ner' || msg.isMultipleLabel) &&
msg.projectType !== 'qaChat'
"
>
<label for="assignmentLogicEdit" class="label-tooltip clr-col-12 clr-col-md-2">Assignment Logic</label>
<div class="clr-input-wrapper clr-col-12 clr-col-md-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 VMware, Inc.
Copyright 2019-2024 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -96,7 +96,12 @@ export class EditProjectComponent implements OnInit {
this.msg = JSON.parse(JSON.stringify(this.msgInEdit));
const al = this.msg.al;
this.previousProjectName = this.msg.projectName;
this.showLabel = !((this.msg.integration.source && this.msg.integration.externalId[0]) || this.msg.projectType == "qa" || this.msg.labelType == "HTL");
this.showLabel = !(
(this.msg.integration.source && this.msg.integration.externalId[0]) ||
this.msg.projectType == 'qa' ||
this.msg.labelType == 'HTL' ||
this.msg.projectType == 'qaChat'
);
this.inputProjectName = this.msg.projectName;
this.inputTaskInstruction = this.msg.taskInstructions;
this.inputfrequency = al.frequency ? al.frequency : null;
Expand Down Expand Up @@ -150,7 +155,7 @@ export class EditProjectComponent implements OnInit {
} else if (this.labelType === 'HTL') {
this.categoryList = this.msg.categoryList;
} else {
this.msg.categoryList.split(',').forEach((element) => {
this.msg.categoryList?.split(',').forEach((element) => {
const flag = { status: 'old', originalLabel: element, editLabel: element };
this.categoryList.push(flag);
});
Expand Down
Loading

0 comments on commit 8d5b796

Please sign in to comment.