Skip to content

Commit

Permalink
Update commit for v1 backend
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulCalot committed Oct 28, 2023
1 parent 94e235c commit bf414ad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
5 changes: 4 additions & 1 deletion frontend/angular.json
Expand Up @@ -118,6 +118,9 @@
}
},
"cli": {
"schematicCollections": ["@angular-eslint/schematics"]
"schematicCollections": [
"@angular-eslint/schematics"
],
"analytics": false
}
}
34 changes: 23 additions & 11 deletions frontend/src/app/service/llama/llama.service.ts
Expand Up @@ -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'
Expand All @@ -15,24 +16,35 @@ export class LlamaService {
askQuestion(question: string, userId: string): Observable<LlamaResponseResult> {
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<LlamaResponse>('<PASTE_URL_HERE>', { question, userId });
}
// return of(LlamaResponseMock).pipe(
// tap(data => {
// this.lastResults.next(data);
// this.lastQuestionAsked.next(question);
// })
// );
return this.httpClient.post<LlamaResponseResult>('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<boolean> {
sendFeedback(feedback: FEEDBACK, userId: string): Observable<boolean> {
console.log('endpoint: /sendFeedback');
console.log('body', {
feedback,
userId,
question: this.lastQuestionAsked.getValue(),
results: this.lastResults.getValue()
});
return of(true);
// this.httpClient.post<LlamaResponse>('<PASTE_URL_HERE>', { feedback, userId, previousQuestion, previousResults });
// return of(true);
return this.httpClient.post<boolean>('http://127.0.0.1:8000/sendFeedback/'
, {
feedback,
userId,
previousQuestion: this.lastQuestionAsked.getValue(),
previousResults: this.lastResults.getValue()
});
}
}

0 comments on commit bf414ad

Please sign in to comment.