Skip to content

Commit

Permalink
fix: add back public prompt requests + add logs for error cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tkubica-edu committed Jul 9, 2024
1 parent b8a22ce commit a49e002
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions src/app/wlo-search/template/template.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,41 @@ export class TemplateComponent implements OnInit {

/** calls the Z-API to invoke ChatGPT */
private generateFromPrompt() {
// TODO: Implement job widgets
this.jobsWidgetReady = true;
// this.aiTextPromptsService
// .publicPrompt({
// widgetNodeId: 'c937cabf-5ffd-47f0-a5e8-ef0ed370baf0',
// contextNodeId: this.topicCollectionID(),
// })
// .subscribe((result: any) => {
// const response = result.responses[0];
// console.log('RESPONSE: ', response);
// this.generatedHeader.set(response);
// });
// this.aiTextPromptsService
// .publicPrompt({
// widgetNodeId: 'a625a9d6-383d-4835-84f2-a8e2792ea13f',
// contextNodeId: this.topicCollectionID(),
// })
// .subscribe((result: any) => {
// const response = result.responses[0];
// console.log('RESPONSE 2: ', response);
// this.generatedJobText.set(response);
// this.jobsWidgetReady = true;
// });
this.aiTextPromptsService
.publicPrompt({
widgetNodeId: 'c937cabf-5ffd-47f0-a5e8-ef0ed370baf0',
contextNodeId: this.topicCollectionID(),
body: {},
})
.subscribe(
(result: any) => {
const response = result.responses[0];
console.log('RESPONSE: ', response);
this.generatedHeader.set(response);
},
(error: any) => {
console.log('An error occurred: ', error);
this.jobsWidgetReady = true;
},
);
this.aiTextPromptsService
.publicPrompt({
widgetNodeId: 'a625a9d6-383d-4835-84f2-a8e2792ea13f',
contextNodeId: this.topicCollectionID(),
body: {},
})
.subscribe(
(result: any) => {
const response = result.responses[0];
console.log('RESPONSE 2: ', response);
this.generatedJobText.set(response);
this.jobsWidgetReady = true;
},
(error: any) => {
console.log('An error occurred: ', error);
this.jobsWidgetReady = true;
},
);
}

// https://stackoverflow.com/a/16348977
Expand Down

0 comments on commit a49e002

Please sign in to comment.