Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Oct 14, 2024
1 parent 4dcbcd8 commit 8368044
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/app/knowledge-bases/knowledge-bases.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
<!-- ---------------------------------------- -->
<div class="add-kb-div">
<button id="kb-add-content" class="custom-button add-content" [disabled]="addButtonDisabled"
[matMenuTriggerFor]="menu" aria-label="Actions">
[matMenuTriggerFor]="menu">
<span class=""> {{ 'KbPage.Add' | translate }} </span>
</button>
<mat-menu #menu="matMenu" xPosition="before" class="custom-menu" style="width: 150px;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="filters">
<span class="material-icons-outlined filter-icon">filter_list</span>
<div class="selector status-selector">
<ng-select class="custom-input" editable="false" [clearable]='false' [editable]='false'
<ng-select class="custom--input" editable="false" [clearable]='false' [editable]='false'
[(ngModel)]='filterStatus' dropdownPosition='bottom'
(ngModelChange)="onLoadByFilter($event, 'status')">
<!-- <ng-option value=""> {{ 'KbPage.StatusAll' | translate }}</ng-option> -->
Expand All @@ -73,7 +73,7 @@
</div>

<div class="selector type-selector">
<ng-select class="custom-input" editable="false" [clearable]='false' [editable]='false'
<ng-select class="custom--input" editable="false" [clearable]='false' [editable]='false'
[(ngModel)]='filterType' dropdownPosition='bottom' (ngModelChange)="onLoadByFilter($event, 'type')">
<ng-option value="">
<!-- All types -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ <h1 mat-dialog-title style="margin-bottom: 6px">

<div class="field-box">
<div class="action-wait-slider">
<div class="action-wait-range">10</div>
<mat-slider class="wait-slider" thumbLabel step="1" min="10" max="2048" [(ngModel)]="max_tokens"
<div class="action-wait-range">{{max_tokens_min}}</div>
<mat-slider class="wait-slider" thumbLabel step="1" [min]="max_tokens_min" max="2048" [(ngModel)]="max_tokens"
(change)="updateSliderValue($event.value, 'max_tokens')" aria-label="units">
</mat-slider>
<div class="action-wait-range">2048</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {

public selectedModel: any // = this.models_list[0].value;
public max_tokens: number;
public max_tokens_min: number;
public temperature: number; // 0.7
public topK: number;
public context: string
Expand Down Expand Up @@ -114,7 +115,8 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {


this.max_tokens = this.selectedNamespace.preview_settings.max_tokens;
// this.logger.log("[MODAL PREVIEW SETTINGS] max_tokens ", this.max_tokens)
this.logger.log("[MODAL PREVIEW SETTINGS] max_tokens ", this.max_tokens)


this.temperature = this.selectedNamespace.preview_settings.temperature
// this.logger.log("[MODAL PREVIEW SETTINGS] temperature ", this.temperature)
Expand All @@ -140,9 +142,15 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
if (!this.selectedNamespace.preview_settings.citations) {
this.citations = false
this.selectedNamespace.preview_settings.citations = this.citations
this.max_tokens_min = 10
this.logger.log("[MODAL PREVIEW SETTINGS] max_tokens_min ", this.max_tokens_min)
} else {
this.citations = this.selectedNamespace.preview_settings.citations
this.citations = this.selectedNamespace.preview_settings.citations;
this.max_tokens_min = 1024;
// this.max_tokens = 1024;
// this.selectedNamespace.preview_settings.max_tokens = this.max_tokens
this.logger.log("[MODAL PREVIEW SETTINGS] citations ", this.citations)
this.logger.log("[MODAL PREVIEW SETTINGS] max_tokens_min ", this.max_tokens_min)
}


Expand All @@ -162,7 +170,6 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
}

ngOnInit(): void {

const ai_models = loadTokenMultiplier(this.appConfigService.getConfig().aiModels)
// this.logger.log("[MODAL PREVIEW SETTINGS] ai_models ", ai_models)

Expand Down Expand Up @@ -232,8 +239,8 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
}

updateSliderValue(value, type) {
// this.logger.log("[MODAL PREVIEW SETTINGS] value: ", value);
// this.logger.log("[MODAL PREVIEW SETTINGS] type: ", type);
this.logger.log("[MODAL PREVIEW SETTINGS] value: ", value);
this.logger.log("[MODAL PREVIEW SETTINGS] type: ", type);
// this.logger.log("[MODAL PREVIEW SETTINGS] wasOpenedFromThePreviewKBModal: ", this.wasOpenedFromThePreviewKBModal);
if (type === "max_tokens") {
if (!this.wasOpenedFromThePreviewKBModal) {
Expand Down Expand Up @@ -331,8 +338,7 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
changeAdvancePrompt(event) {
this.logger.log("[MODAL PREVIEW SETTINGS] changeAdvancedContext event ", event.target.checked)
this.advancedPrompt = event.target.checked
// advancedPrompt: boolean = false;
// citations: boolean = false;

if (!this.wasOpenedFromThePreviewKBModal) {
this.selectedNamespace.preview_settings.advancedPrompt = this.advancedPrompt
this.logger.log("[MODAL PREVIEW SETTINGS] changeAdvancedContext this.selectedNamespace ", this.selectedNamespace)
Expand All @@ -342,21 +348,30 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
this.kbService.hasChagedAiSettings(this.aiSettingsObject)

if (this.advancedPrompt !== this.selectedNamespace.preview_settings.advancedPrompt) {
if (this.hasAlreadyOverrideAdvancedContex !== true) {
// if (this.hasAlreadyOverrideAdvancedContex !== true) {
this.countOfOverrides = this.countOfOverrides + 1;
}
// }
this.hasAlreadyOverrideAdvancedContex = true
} else {
} else if (this.advancedPrompt !== this.selectedNamespace.preview_settings.advancedPrompt) {
this.countOfOverrides = this.countOfOverrides - 1;
this.hasAlreadyOverrideAdvancedContex = false
}

}

changeCitations(event) {
this.logger.log("[MODAL PREVIEW SETTINGS] changeCitations event ", event.target.checked)
this.citations = event.target.checked
// advancedPrompt: boolean = false;
// citations: boolean = false;
this.citations = event.target.checked;
if (this.citations === true) {
this.max_tokens_min = 1024
this.max_tokens = 1024
this.selectedNamespace.preview_settings.max_tokens = this.max_tokens
} else {
this.max_tokens_min = 10;
this.max_tokens = 256
this.selectedNamespace.preview_settings.max_tokens = this.max_tokens
}


if (!this.wasOpenedFromThePreviewKBModal) {
this.selectedNamespace.preview_settings.citations = this.citations
Expand All @@ -366,15 +381,31 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
this.aiSettingsObject[0].citations = this.citations;
this.kbService.hasChagedAiSettings(this.aiSettingsObject)

if (this.citations !== this.selectedNamespace.preview_settings.advancedPrompt) {
if (this.hasAlreadyOverrideCitations !== true) {
// if (this.citations !== this.selectedNamespace.preview_settings.citations) {
// if (this.hasAlreadyOverrideCitations !== true) {
// this.countOfOverrides = this.countOfOverrides + 1;
// }
// this.hasAlreadyOverrideCitations = true
// this.logger.log('hasAlreadyOverrideCitations ' , this.hasAlreadyOverrideCitations)
// } else {
// this.logger.log('here y hasAlreadyOverrideCitations' , this.hasAlreadyOverrideCitations)
// this.countOfOverrides = this.countOfOverrides - 1;
// }

if (this.citations !== this.selectedNamespace.preview_settings.citations) {
// if (this.hasAlreadyOverrideCitations !== true) {
this.countOfOverrides = this.countOfOverrides + 1;
}
// }
this.hasAlreadyOverrideCitations = true
} else {
this.logger.log('hasAlreadyOverrideCitations ' , this.hasAlreadyOverrideCitations)
} else if (this.citations === this.selectedNamespace.preview_settings.citations) {
this.hasAlreadyOverrideCitations = false
this.logger.log('here y hasAlreadyOverrideCitations' , this.hasAlreadyOverrideCitations)
this.countOfOverrides = this.countOfOverrides - 1;
}



}

onSavePreviewSettings() {
Expand Down Expand Up @@ -419,6 +450,12 @@ export class ModalPreviewSettingsComponent implements OnInit, OnChanges {
this.advancedPrompt = this.selectedNamespaceClone.preview_settings.advancedPrompt

this.citations = this.selectedNamespaceClone.preview_settings.citations
this.logger.log('Reset this.citations ', this.citations)
if (this.citations) {
this.max_tokens_min = 1024;
} else {
this.max_tokens_min = 10;
}
// this.selectedNamespace.preview_settings.context = this.contextDefaultValue;

// this.aiSettingsObject[0].model = this.modelDefaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1 mat-dialog-title>{{ 'KbPage.TitleSitemap' | translate }} </h1>
{{'KbPage.IndexingType' | translate}}
</span>

<ng-select class="custom-ng-select" style="min-width: 200px; margin-bottom: 6px;"
<ng-select class="scrape-types-select" style="min-width: 200px; margin-bottom: 6px;"
appendTo="body"
[items]="scrape_types | selectOptionsTranslate"
bindLabel="name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ mat-expansion-panel ::ng-deep {
}
}

::ng-deep.ng-select-container {
height: 48px !important;
margin-top: 3px;
border-radius: 6px;
::ng-deep.ng-select.scrape-types-select .ng-select-container {
// height: 48px !important;
margin-top: 4px;
border-radius: 5px;
border: solid 1px #e4e4e4 !important;
box-shadow: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 mat-dialog-title style="font-family: 'Poppins';"> {{ 'KbPage.titleUrls' | t
{{'KbPage.IndexingType' | translate}}
</span>

<ng-select class="custom-ng-select" style="min-width: 200px; margin-bottom: 6px;"
<ng-select class="scrape-types-select" style="min-width: 200px; margin-bottom: 6px;"
appendTo="body"
[items]="scrape_types | selectOptionsTranslate" bindLabel="name" bindValue="value"
placeholder="{{ 'KbPage.PlaceholderSelectEngine' | translate }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ mat-expansion-panel ::ng-deep {
}
}

::ng-deep.ng-select-container {
height: 48px !important;
margin-top: 3px;
border-radius: 6px;
::ng-deep.ng-select.scrape-types-select .ng-select-container {
// height: 48px !important;
margin-top: 4px;
border-radius: 5px;
border: solid 1px #e4e4e4 !important;
box-shadow: none;
}
Expand Down
16 changes: 16 additions & 0 deletions src/assets/css/demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,17 @@ footer ul {
border: none;
}

.ng-select.custom--input .ng-select-container {
box-shadow: 0 0 4px #c7c7c7 !important;
border: unset !important;
border-radius: 12px !important;
}

.ng-select-container {
height: 36px !important;
}


.ng-select.ng-select-tags .ng-dropdown-panel.ng-select-bottom {
margin-top: 0px !important;
margin-left: 0px !important;
Expand All @@ -1850,6 +1861,11 @@ footer ul {
outline: 1px solid $icon-color;
}

// Used
.mat-form-field-appearance-outline .mat-form-field-infix {
padding: 4.64px 0px 10px 0px !important;
}

// ::ng-deep
.cds-mat-tooltip {
// background-color: #fff !important;
Expand Down

0 comments on commit 8368044

Please sign in to comment.