diff --git a/frontend/src/app/service/llama/llama.service.ts b/frontend/src/app/service/llama/llama.service.ts index f3fdc67..c8a4426 100644 --- a/frontend/src/app/service/llama/llama.service.ts +++ b/frontend/src/app/service/llama/llama.service.ts @@ -15,30 +15,31 @@ export class LlamaService { private lastAnswer = new BehaviorSubject(''); askQuestion(question: string, userId: string): Observable { - return of({ ...LlamaResponseMock, question, userId }).pipe( - tap(data => { - this.lastResults.next(data); - this.lastQuestionAsked.next(question); - this.lastAnswer.next(data.answer); - }) - ); - // return this.httpClient - // .post('http://127.0.0.1:8000/askQuestion/', { question, userId }) - // .pipe( - // tap(data => { - // this.lastResults.next(data); - // this.lastQuestionAsked.next(question); - // }) - // ); + // return of({ ...LlamaResponseMock, question, userId }).pipe( + // tap(data => { + // this.lastResults.next(data); + // this.lastQuestionAsked.next(question); + // this.lastAnswer.next(data.answer); + // }) + // ); + 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: FEEDBACK, userId: string): Observable { - return of(true); - // return this.httpClient.post('http://127.0.0.1:8000/sendFeedback/', { - // feedback, - // userId, - // previousQuestion: this.lastQuestionAsked.getValue(), - // previousResults: this.lastResults.getValue() - // }); + // return of(true); + return this.httpClient.post('http://127.0.0.1:8000/sendFeedback/', { + feedback, + userId, + previousQuestion: this.lastQuestionAsked.getValue(), + previousResults: this.lastResults.getValue(), + previousAnswer: this.lastAnswer.getValue() + }); } }