feat(chat): Integrate chatbot API for dynamic responses
This commit replaces the static, simulated chat functionality with a live integration to a chatbot backend API. The chat page now sends user messages to a webhook endpoint using the `fetch` API. It implements session management by generating and storing a `sessionId` in `localStorage` to maintain conversation context between requests. Key changes: - Implement `async` `sendMessage` function to post to the chatbot API. - Add session ID generation and persistence. - Dynamically render text and image responses from the API. - Remove hardcoded example messages from the HTML. - Update the virtual assistant's name to "Maya". - Fix navigation links from the dashboard to the chat page.
This commit is contained in:
@@ -4,13 +4,13 @@ const dropdownMenu = document.querySelector('.dropdown-menu');
|
||||
|
||||
if (menuButton && dropdownMenu) {
|
||||
menuButton.addEventListener('click', function() {
|
||||
dropdownMenu.classList.toggle('visible');
|
||||
dropdownMenu.classList.toggle('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener('click', function(event) {
|
||||
if (!event.target.closest('.mobile-header-right') && dropdownMenu) {
|
||||
dropdownMenu.classList.remove('visible');
|
||||
dropdownMenu.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user