Skip to content

Commit

Permalink
Kb improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Nov 21, 2023
1 parent 29b831a commit 61bfb84
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/app/knowledge-bases/knowledge-bases.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
GPT-Key
</button>
<button class="btn btn-primary" (click)="openAddKnowledgeBaseModal()" [disabled]="addButtonDisabled">
{{ 'KbPage.AddKb' | translate }}
<!-- {{ 'KbPage.AddKb' | translate }} -->
Add your Website
</button>
</div>

Expand Down Expand Up @@ -184,8 +185,11 @@ <h4 class="modal-title">
<div class="info-container">
<i class="material-icons-outlined info-icon">help_outline</i>
<div class="info-text">
<p>{{ 'KbPage.AddKbInfoFirstText' | translate }}</p>
<p>{{ 'KbPage.AddKbInfoSecondText' | translate }}</p>
<!-- <p>{{ 'KbPage.AddKbInfoFirstText' | translate }}</p> -->
Set a valid URL for your Website. Tiledesk will search your website URL for relevant answers. ChatGPT will then be trained to reply in a human-like way.
Note: You can add a maximum of 3 URLs, each consisting of up to 200 pages. For larger Websites please contact us ([email protected]).

<!-- <p>{{ 'KbPage.AddKbInfoSecondText' | translate }}</p> -->
</div>
</div>

Expand Down
26 changes: 20 additions & 6 deletions src/app/knowledge-bases/knowledge-bases.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,29 @@ export class KnowledgeBasesComponent implements OnInit, OnDestroy {

saveKnowledgeBase() {

let first_index = this.newKb.url.indexOf('://') + 3;
let second_index = this.newKb.url.indexOf('www.') + 4;
// let first_index = this.newKb.url.indexOf('://') + 3;
// let second_index = this.newKb.url.indexOf('www.') + 4;
// let split_index;
// if (second_index > first_index) {
// split_index = second_index;
// } else {
// split_index = first_index;
// }
// this.newKb.name = this.newKb.url.substring(split_index);
let first_index = this.newKb.url.indexOf('://');
let second_index = this.newKb.url.indexOf('www.');

let split_index;
if (second_index > first_index) {
split_index = second_index;
if (first_index !== -1 || second_index !== -1) {
if (second_index > first_index) {
split_index = second_index + 4;
} else {
split_index = first_index + 3;
}
this.newKb.name = this.newKb.url.substring(split_index);
} else {
split_index = first_index;
this.newKb.name = this.newKb.url;
}
this.newKb.name = this.newKb.url.substring(split_index);

this.kbService.addNewKb(this.kbSettings._id, this.newKb).subscribe((savedSettings: KbSettings) => {
// console.log('[KNOWLEDGE BASES COMP] this.kbSettings addNewKb ', this.kbSettings)
Expand Down

0 comments on commit 61bfb84

Please sign in to comment.