in frontend/src/app/agent-chat/agent-chat.component.ts [129:152]
thumbsUp(sql: any, ind: any) {
let chats = this.homeService.getChatMsgs();
const sqlExist = this.suggestionList.some((res: { example_user_question: any; example_generated_sql: any; }) => res.example_user_question === chats[ind]?.user_question && res.example_generated_sql === sql);
if (!sqlExist) {
// let concatedUserQuestionsList = chats.map((msg: any) => {
// if (msg.author == 'user') {
// return msg.user_question
// }
// })
// const concatenatedStr = concatedUserQuestionsList.filter((word) => word).reduce((accumulator, currentValue) => accumulator + ' , ' + currentValue);
this.homeService.thumbsUp(sql, chats[ind]?.user_question, this.homeService.getSelectedDbGrouping(), this.homeService.getSessionId()).subscribe((res: any) => {
if (res && res.ResponseCode === 201) {
this.updateLocalMessage(ind, res, "");
this.showSnackbarCssStyles(res?.Message, 'Close', '10000')
this.isOpen = true;
} else {
this.updateLocalMessage(ind, res, "");
this.showSnackbarCssStyles(res?.Error, 'Close', '10000')
}
})
} else {
this.showSnackbarCssStyles('Data is present in the suggestion list', 'Close', '4000')
}
}