Skip to content

Commit

Permalink
Feedback during spicing of model
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Oct 11, 2023
1 parent 215268c commit 2a0c315
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 29 deletions.
5 changes: 5 additions & 0 deletions backend/files/system/openai/import-page.post.hl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ fork
args
message:Done creating OpenAI training data from page
type:success
sockets.signal:magic.backend.chatbot
roles:root
args
message:Done creating OpenAI training data from page
type:success

// Basic logging.
log.info:OpenAI training data successfully created from page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,38 @@ export class MachineLearningImportFeedbackComponent implements OnInit, OnDestroy
this.hubConnection.start().then(() => {

this.generalService.showLoading();
this.openAIService.importUrl(
this.data.url,
this.data.type,
this.data.delay,
this.data.max,
this.data.threshold,
this.data.summarize).subscribe({
next: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Crawling started, you will be notified when it is finished', 'successMessage');
},
error: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Something went wrong as we tried to start import', 'errorMessage');
}
});
if (this.data.site === true) {
this.openAIService.importUrl(
this.data.url,
this.data.type,
this.data.delay,
this.data.max,
this.data.threshold,
this.data.summarize).subscribe({
next: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Crawling started, you will be notified when it is finished', 'successMessage');
},
error: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Something went wrong as we tried to start import', 'errorMessage');
}
});
} else {
this.openAIService.importPage(this.data.url, this.data.type, 50).subscribe({
next: () => {

this.generalService.hideLoading();
},
error: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Something went wrong as we tried to spice your model', 'errorMessage');
}
});
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export class MachineLearningModelsComponent implements OnInit {
max: result.max,
threshold: result.threshold,
summarize: result.summarize,
site: true,
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { MachineLearningTrainingService } from 'src/app/_general/services/machin
import { OpenAIService } from 'src/app/_general/services/openai.service';
import { MachineLearningEditTrainingSnippetComponent } from '../components/machine-learning-edit-training-snippet/machine-learning-edit-training-snippet.component';
import { MachineLearningSpiceComponent } from '../components/machine-learning-spice/machine-learning-spice.component';
import { MachineLearningImportFeedbackComponent } from '../components/machine-learning-import-feedback/machine-learning-import-feedback.component';

/**
* Helper component to administrate training data for OpenAI integration
Expand Down Expand Up @@ -115,17 +116,20 @@ export class MachineLearningTrainingDataComponent implements OnInit {

if (result) {

this.openAiService.importPage(result, this.type, 50).subscribe({
next: () => {

this.generalService.hideLoading();
},
error: () => {

this.generalService.hideLoading();
this.generalService.showFeedback('Something went wrong as we tried to spice your model', 'errorMessage');
}
});
this.dialog
.open(MachineLearningImportFeedbackComponent, {
width: '80vw',
maxWidth: '1280px',
data: {
url: result,
type: this.type,
delay: result.delay,
max: result.max,
threshold: result.threshold,
summarize: result.summarize,
site: false,
}
});
}
});
}
Expand Down

0 comments on commit 2a0c315

Please sign in to comment.