diff --git a/frontend/angular.json b/frontend/angular.json index 2dc3089..a04a27f 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -118,6 +118,9 @@ } }, "cli": { - "schematicCollections": ["@angular-eslint/schematics"] + "schematicCollections": [ + "@angular-eslint/schematics" + ], + "analytics": false } } diff --git a/frontend/src/app/service/llama/llama.service.ts b/frontend/src/app/service/llama/llama.service.ts index f98abe0..da24b65 100644 --- a/frontend/src/app/service/llama/llama.service.ts +++ b/frontend/src/app/service/llama/llama.service.ts @@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { LlamaResponseResult } from '../../models/llama-response.interface'; import { BehaviorSubject, Observable, of, tap } from 'rxjs'; import { LlamaResponseMock } from '../../mocks/LlamaResponse.mock'; +import { FEEDBACK } from 'src/app/models/feedback.enum'; @Injectable({ providedIn: 'root' @@ -15,16 +16,21 @@ export class LlamaService { askQuestion(question: string, userId: string): Observable { console.log('endpoint: /askQuestion'); console.log('body', { question, userId }); - return of(LlamaResponseMock).pipe( - tap(data => { - this.lastResults.next(data); - this.lastQuestionAsked.next(question); - }) - ); - //this.httpClient.post('', { question, userId }); - } + // return of(LlamaResponseMock).pipe( + // tap(data => { + // this.lastResults.next(data); + // this.lastQuestionAsked.next(question); + // }) + // ); + return this.httpClient.post('http://127.0.0.1:8000/askQuestion/', { question, userId }).pipe( + tap(data => { + this.lastResults.next(data); + this.lastQuestionAsked.next(question); + }) + ); + } - sendFeedback(feedback: string, userId: string): Observable { + sendFeedback(feedback: FEEDBACK, userId: string): Observable { console.log('endpoint: /sendFeedback'); console.log('body', { feedback, @@ -32,7 +38,13 @@ export class LlamaService { question: this.lastQuestionAsked.getValue(), results: this.lastResults.getValue() }); - return of(true); - // this.httpClient.post('', { feedback, userId, previousQuestion, previousResults }); + // return of(true); + return this.httpClient.post('http://127.0.0.1:8000/sendFeedback/' + , { + feedback, + userId, + previousQuestion: this.lastQuestionAsked.getValue(), + previousResults: this.lastResults.getValue() + }); } }