Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Sep 23, 2024
1 parent 570adef commit 4e834ef
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@
// margin: 100px auto;
// margin: 80px auto;
margin: 75.01px auto;
width: 40px;
height: 40px;
width: 41px;
height: 41px;
// width: 100px;
// height: 100px;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ <h1 mat-dialog-title> {{ 'Preview' | translate }} </h1>

<div *ngIf="show_answer" class="form--container" style="margin-bottom: 0px;">
<p *ngIf="answer" class="answer-title">
{{ 'KbPage.Answer' | translate }} <span> ({{ 'KbPage.GeneratedByModel' | translate: {ai_model_name: qa?.ai_model } }}) </span>
{{ 'KbPage.Answer' | translate }}

<span *ngIf="qa?.ai_model"> ({{ 'KbPage.GeneratedByModel' | translate: {ai_model_name: qa?.ai_model } }}) </span>
</p>
<div id="answer" class="answer">

Expand All @@ -66,7 +68,7 @@ <h1 mat-dialog-title> {{ 'Preview' | translate }} </h1>
<hr class="horizontal-line" *ngIf="qa && qa.source">

<p *ngIf="qa && qa.source" class="answer-title">{{ 'KbPage.Source' | translate }}</p>
<div id="answer" class="answer">
<div *ngIf="qa && qa.source" id="answer" class="answer">
<span *ngIf="qa && qa.source">{{ 'KbPage.Source' | translate }}:
<a *ngIf="source_url" href="{{source_url}}" target="_blank">{{ source_url }}</a>
<span *ngIf="!source_url">{{ qa.source }}</span>
Expand All @@ -75,11 +77,15 @@ <h1 mat-dialog-title> {{ 'Preview' | translate }} </h1>
</div>
<label *ngIf="!aiQuotaExceeded" class="control-label response-time-label">
<!-- {{ 'KbPage.LabelResponseTime' | translate: translateparam }} -->
{{ 'Analytics.Metrics.ResponseTime' | translate }}: <span> {{ 'KbPage.AIResponseTime' | translate: translateparam }} </span>
<span *ngIf="responseTime">
{{ 'Analytics.Metrics.ResponseTime' | translate }}: <span> {{ 'KbPage.AIResponseTime' | translate: translateparam }} </span>
</span>
</label>
<label *ngIf="!aiQuotaExceeded" class="control-label prompt-size-label">
<!-- {{ 'KbPage.TotalTokensUsage' | translate: {prompt_token_size: prompt_token_size } }} -->
{{ 'KbPage.PromptSize' | translate }}: <span> {{ 'KbPage.PromptSizeUsage' | translate: {prompt_token_size: prompt_token_size } }} </span>
<span *ngIf="prompt_token_size">
{{ 'KbPage.PromptSize' | translate }}: <span> {{ 'KbPage.PromptSizeUsage' | translate: {prompt_token_size: prompt_token_size } }} </span>
</span>
</label>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class ModalPreviewKnowledgeBaseComponent extends PricingBaseComponent imp
this.prompt_token_size = response.prompt_token_size;
this.logger.log("[MODAL-PREVIEW-KB] ask gpt preview prompt_token_size: ", this.prompt_token_size)
const endTime = performance.now();
this.responseTime = Math.round((endTime - startTime) / 1000);
this.responseTime = Math.round((endTime - startTime) / 1000);
this.translateparam = { respTime: this.responseTime };
this.qa = response;
this.logger.log("[MODAL-PREVIEW-KB] ask gpt preview qa: ", this.qa)
Expand All @@ -277,14 +277,21 @@ export class ModalPreviewKnowledgeBaseComponent extends PricingBaseComponent imp
this.show_answer = true;
this.searching = false;
}, (err) => {
// this.logger.log("ask gpt preview response error: ", err);
this.logger.log("ask gpt preview response error: ", err);
// this.logger.log("ask gpt preview response error message: ", error.message);
// this.logger.log("ask gpt preview response error error: ", error.error);
if (err && err.error && err.error.error_code === 13001) {
this.answer = this.translate.instant('KbPage.AiQuotaExceeded')
this.aiQuotaExceeded = true
} else {
} else if (err && err.error && err.error.message) {
this.answer = err.error.message;
} else if (err.error && err.error.error && err.error.error.answer) {
this.answer = err.error.error.answer;
// && err.headers.statusText
if (err.statusText) {
this.logger.log("ask gpt preview error h1 err.headers ", err.statusText);
this.answer = this.answer + ' (' + err.statusText + ')'
}
}

this.logger.error("ERROR ask gpt: ", err.message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
</div>
</div>

<mat-accordion>
<!-- <mat-accordion>
<mat-expansion-panel (opened)="panelOpenState = true" (closed)="panelOpenState = false" class="custom-expansion-panel">
<mat-expansion-panel-header class="disable_ripple">
<mat-panel-title> Advanced Options </mat-panel-title>
</mat-expansion-panel-header>
<div class="expansion-panel-content">
<!-- SCRAPE TYPE -->
<!- - SCRAPE TYPE - ->
<div class="option-box">
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<span class="input-label">Indexing type</span>
<!-- <mat-form-field appearance="outline">
<mat-select [(ngModel)]="selectedScrapeType" disableOptionCentering>
<mat-option *ngFor="let type of scrape_types" [value]="type.value">
{{type.name}}
</mat-option>
</mat-select>
</mat-form-field> -->
<ng-select class="custom-ng-select" style="min-width: 200px; margin-bottom: 6px;" appendTo="body" [items]="scrape_types" bindLabel="name" bindValue="value"
placeholder="{{ 'KbPage.PlaceholderSelectEngine' | translate }}" [clearable]="false"
[searchable]="false" [(ngModel)]="selectedScrapeType" (change)="onSelectScrapeType(selectedScrapeType)">
Expand All @@ -39,7 +33,7 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
</div>
<div *ngIf="selectedScrapeType === 4" class="option-box" style="width: 100%; margin-left: 12px;">
<!-- TAGS TO EXTRACT -->
<!- - TAGS TO EXTRACT - ->
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<span class="input-label">Extract Tags (Mandatory)</span>
<mat-form-field class="chip-list" appearance="outline" style="width: 95%; font-size: 13px;">
Expand All @@ -52,15 +46,15 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
<button matChipRemove>
<mat-icon>cancel</mat-icon>
</button>
<!-- <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon> -->
<!- - <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon> - ->
</mat-chip>
<input style="font-size: 13px; background-color: white; border: none;" [matChipInputFor]="extractTags" placeholder="Type and press Enter"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="addTag('extract_tags', $event)">
</mat-chip-list>
</mat-form-field>
</div>
<!-- UNWANTED TAGS -->
<!- - UNWANTED TAGS - ->
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<span class="input-label">Unwanted Tags</span>
<mat-form-field class="chip-list" appearance="outline" style="width: 95%; font-size: 13px;">
Expand All @@ -78,7 +72,7 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
</mat-form-field>
</div>
<!-- UNWANTED CLASSNAMES -->
<!- - UNWANTED CLASSNAMES - ->
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<span class="input-label">Unwanted Classnames</span>
<mat-form-field class="chip-list" appearance="outline" style="width: 95%; font-size: 13px;">
Expand All @@ -99,7 +93,7 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
</div>
</div>
</mat-expansion-panel>
</mat-accordion>
</mat-accordion> -->

<div class="form-container">
<!-- <form [formGroup]="kbForm"> -->
Expand Down

0 comments on commit 4e834ef

Please sign in to comment.