Files
demo-mayagen/chat-page/index.html
emmanuel.rizky 84c7cbd8ce 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.
2025-07-21 14:44:06 +07:00

63 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Halaman Chat</title>
<link rel="stylesheet" href="style.css">
<!-- Tambahkan link Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
</head>
<body>
<div class="chat-container">
<!-- Floating circles background -->
<ul class="floating-circles">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<!-- Header dengan avatar dan nama pengguna -->
<header class="chat-header">
<div class="user-info">
<div class="avatar">M</div>
<div class="user-details">
<h2>Maya</h2>
<span class="user-role">Virtual Assistant - Bake Shop</span>
</div>
</div>
</header>
<!-- Area chat utama -->
<div class="chat-area">
</div>
<!-- Input area with WhatsApp-like design -->
<div class="input-area">
<div class="input-wrapper">
<input type="text" class="message-input" placeholder="Ketik pesan...">
<div class="attachment-icons">
<!-- Hanya ikon kamera yang tersisa -->
<button class="icon-btn attachment-btn">
<i class="bi bi-camera"></i>
</button>
</div>
</div>
<button class="send-btn">
<i class="bi bi-arrow-right-circle"></i>
</button>
</div>
</div>
<script src="script.js"></script>
</body>
</html>