in ChatbotUI/src/app/components/main/chat/chatbar/chatbar.component.ts [387:413]
setSuggestedQuestionInChat(response: Chat, endTime: number) {
if (response.suggested_questions?.length || 0 > 0) {
this.showSuggesstion = true;
this.suggestedQuestionMessage = {
body: "",
type: 'bot',
responseTime: ((endTime - this.botStartTime) / 1000).toString(),
shareable: true,
extras: {
like: false,
dislike: false
},
suggestedQuestion: response.suggested_questions
}
setTimeout(() => {
const botResponseElement = document.getElementById(this.botStartTime.toString());
const parentElement = document.getElementsByClassName('chat-body');
const y = botResponseElement?.offsetTop;
if (y) {
parentElement[0].scroll({
top: y - 30,
behavior: 'smooth'
})
}
}, 1000);
}
}