in frontend/src/app/contact-center-analyst/home/home.component.ts [257:305]
async search(followup: boolean) {
this.clearInsights(false);
this.searchedSummary = "";
this.searchLoading = true;
const contactChannel = this.contactChannelCtrl.value;
let query = this.followUpQuestionCtrl.value;
this.similarConversations = [];
this.similarReviews = [];
this.searchedConversations = [];
this.searchedReviews = [];
if (!followup) {
query = this.similarQuestionCtrl.value;
this.searchReviewsId = "";
this.searchConversationsId = "";
}
this.similarQuestionCtrl.setValue(query);
this.followUpQuestionCtrl.setValue("");
if (contactChannel == "conversations") {
this.searchReviewsId = "";
firstValueFrom(
this.contactCenterAnalystService.searchConversations(
query || "", this.userId, this.searchConversationsId) as Observable<any>
).then((res) => {
this.searchedConversations = res.responses.search_results;
this.dataSourceSearchConvesation = new MatTableDataSource(this.searchedConversations);
this.searchedSummary = res.responses.summary;
this.searchConversationsId = res.conversation_id;
this.searchLoading = false;
})
} else {
this.searchConversationsId = "";
firstValueFrom(this.contactCenterAnalystService.searchReviews(
query || "", this.userId, this.searchReviewsId) as Observable<any>
).then((res) => {
this.searchedReviews = res.responses.search_results;
this.dataSourcesearchedReviews = new MatTableDataSource(this.searchedReviews);
this.searchedSummary = res.responses.summary;
this.searchReviewsId = res.conversation_id;
this.searchLoading = false;
});
}
}