Skip to content

Commit

Permalink
Bettering
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Jan 11, 2024
1 parent ff2d5fc commit 455ec35
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backend/files/system/openai/magic.startup/magic.ai.chat.hl
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ select prompt, max(completion) as completion
add:x:@.session
.
.
role:system
role:assistant
content:x:@.result
while
mt:x:@.fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h3 class="fw-bold">Chatbot Wizard</h3>

</form>

<div class="row" *ngIf="sqlIte && crawling" class="mt-4 messages">
<div class="row" *ngIf="sqlIte && crawling" class="mt-4 messages" id="messageWrapper">

<div
*ngFor="let idx of messages; index as i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class ChatbotWizardComponent implements OnInit, OnDestroy {

this.chat_models = models;
this.chat_models = this.chat_models.filter((idx: OpenAIModel) => idx.id.startsWith('gpt'));
let defModel = this.chat_models.filter(x => x.id === 'gpt-4');
let defModel = this.chat_models.filter(x => x.id === 'gpt-4-1106-preview');

if (defModel.length > 0) {

Expand Down Expand Up @@ -351,6 +351,12 @@ export class ChatbotWizardComponent implements OnInit, OnDestroy {

this.hubConnection.on(feedbackChannel, (args) => {

const messageWrapper = document.getElementById('messageWrapper');
let shouldScroll= false;
if(messageWrapper.scrollTop + 10 > (messageWrapper.scrollHeight - messageWrapper.offsetHeight)) {
shouldScroll = true;
}

args = JSON.parse(args);
this.messages.push(args);
this.doneCreatingBot = args.type === 'success' || args.type === 'error';
Expand All @@ -368,11 +374,14 @@ export class ChatbotWizardComponent implements OnInit, OnDestroy {
this.hubConnection = null;
this.finished = true;
}
setTimeout(() => {

if(shouldScroll) {
setTimeout(() => {

const domEl = document.getElementById('m_' + (this.messages.length - 1));
domEl.scrollIntoView()
}, 50);
domEl.scrollIntoView();
}, 50);
}
});

this.hubConnection.start().then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,13 @@ export class MachineLearningEditTypeComponent implements OnInit {

if (this.data?.model) {
this.model = this.models.filter(x => x.id === this.data.model)[0];
} else if (this.data) {
this.model = this.models.filter(x => x.id === 'gpt-3.5-turbo')[0];
} else {
this.model = this.models.filter(x => x.id === 'gpt-3.5-turbo')[0];
const gpt4 = this.models.filter(x => x.id === 'gpt-4-1106-preview');
if (gpt4.length > 0) {
this.model = gpt4[0];
} else {
this.model = this.models.filter(x => x.id === 'gpt-3.5-turbo')[0];
}
}

if (this.data?.vector_model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class MachineLearningEmbedUiComponent implements OnInit {
themesSearch: string[] = [];
type: string = null;
header: string = 'Ask about our services or products';
buttonTxt: string = '';
buttonTxt: string = 'AI Chatbot';
search: boolean = false;
chat: boolean = true;
markdown: boolean = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3 mat-dialog-title class="mb-0">Progress</h3>
You can close this window if you want to, you will be notified when the process is done
</p>

<div class="messages">
<div class="messages" id="messageWrapper">

<div
*ngFor="let idx of messages; index as i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ export class MachineLearningImportFeedbackComponent implements OnInit, OnDestroy
}).build();

this.hubConnection.on(result.result, (args) => {


const messageWrapper = document.getElementById('messageWrapper');
let shouldScroll= false;
if(messageWrapper.scrollTop + 10 > (messageWrapper.scrollHeight - messageWrapper.offsetHeight)) {
shouldScroll = true;
}

args = JSON.parse(args);
this.messages.push(args);

Expand All @@ -65,11 +71,14 @@ export class MachineLearningImportFeedbackComponent implements OnInit, OnDestroy

this.generalService.showFeedback(args.message, 'errorMessage');
}
setTimeout(() => {

if(shouldScroll) {
setTimeout(() => {

const domEl = document.getElementById('m_' + (this.messages.length - 1));
domEl.scrollIntoView()
}, 50);
domEl.scrollIntoView();
}, 50);
}
});

this.hubConnection.start().then(() => {
Expand Down

0 comments on commit 455ec35

Please sign in to comment.