Skip to content

Commit

Permalink
Merge pull request #169 from takenet/feature/566700-test-ac
Browse files Browse the repository at this point in the history
feat(ai-hub): create a new property in analisisInf
  • Loading branch information
alacerdah authored Dec 21, 2023
2 parents 41147c5 + 24c2e4e commit 0a7bc24
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/analysisInfo/analysisInfo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const HIGHLIGHT_START = '<span class="highlight">';
const HIGHLIGHT_END = '</span>';
const DEFAULT_INTENTS_LABEL = 'Intents';
const DEFAULT_ENTITIES_LABEL = 'Entities';
const DEFAULT_CONTENTS_LABEL = 'Contents';
const DEFAULT_INTENT_NAME = 'None';

class AnalysisInfoController extends ComponentController {
Expand All @@ -16,8 +17,10 @@ class AnalysisInfoController extends ComponentController {

public intentsLabel: string;
public entitiesLabel: string;
public contentsLabel: string;
public entities: Entity[];
public intents: Intent[];
public contents: Content[];
public analysis: { id: string, content: string, promise: Promise<any> };
public selectedIntention: string;
public structuredEntities: { [id: string]: string[] } = {};
Expand All @@ -37,6 +40,7 @@ class AnalysisInfoController extends ComponentController {
super();
this.intentsLabel = this.intentsLabel || DEFAULT_INTENTS_LABEL;
this.entitiesLabel = this.entitiesLabel || DEFAULT_ENTITIES_LABEL;
this.contentsLabel = this.contentsLabel || DEFAULT_CONTENTS_LABEL;
}

async $onInit() {
Expand Down
5 changes: 5 additions & 0 deletions src/components/analysisInfo/analysisInfo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@
}
}
}

.divisor {
padding-top: 10px !important;
margin-top: 12px;
}
15 changes: 14 additions & 1 deletion src/components/analysisInfo/analysisInfoView.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
</div>
<div class="hidden-content" ng-class="{ 'display': $ctrl.displayHiddencontent }" ng-if="$ctrl.displayEntityContent">
<div class="title">{{ $ctrl.entitiesLabel }}</div>
<bds-typo class="title">{{ $ctrl.entitiesLabel }}</bds-typo>
<div ng-repeat="(name, values) in $ctrl.structuredEntities" class="entity">
<div class="name">
{{ name }}
Expand All @@ -25,6 +25,19 @@
</div>
</div>
</div>
<div class="hidden-content divisor" ng-class="{ 'display': $ctrl.displayHiddencontent }" ng-if="$ctrl.displayEntityContent && $ctrl.displayHiddencontent && $ctrl.analysisResult.contents.length > 0">
<bds-typo class="title">
{{ $ctrl.contentsLabel }}
</bds-typo>
<div ng-repeat="content in $ctrl.analysisResult.contents" class="entity">
<div class="name">
{{ content.name }}
</div>
<div class="value">
{{ content.result.content }}
</div>
</div>
</div>
<div class="expand" ng-click="$ctrl.toggleContent()" ng-if="$ctrl.displayEntityContent">
<i class="icon icon-arrowdown" ng-if="!$ctrl.displayHiddencontent"></i>
<i class="icon icon-arrowup" ng-if="$ctrl.displayHiddencontent"></i>
Expand Down
14 changes: 13 additions & 1 deletion src/typings/ArtificialIntelligence.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ interface Analysis {
text: string;
intentions: AnalysisIntent[];
entities: AnalysisEntity[];
contents: Content[];
provider: string;
modelId: string;
}
Expand Down Expand Up @@ -30,6 +31,17 @@ interface Entity {
values: EntityValue[];
}

interface Content {
id: string
name: string
result: Result
}

interface Result {
type: string
content: string
}

interface Intent {
id?: string;
storageDate?: Date;
Expand All @@ -39,4 +51,4 @@ interface Intent {
countQuestions?: number;
tooltip?: any;
healthScore?: any;
}
}

0 comments on commit 0a7bc24

Please sign in to comment.