|  | <!DOCTYPE html> | 
					
						
						|  | <html lang="en"> | 
					
						
						|  | <head> | 
					
						
						|  | <meta charset="UTF-8"> | 
					
						
						|  | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 
					
						
						|  | <title>Chat with Amara</title> | 
					
						
						|  | <style> | 
					
						
						|  | body { font-family: Arial, sans-serif; } | 
					
						
						|  | #chat-box { border: 1px solid #ccc; padding: 10px; margin: 20px; height: 400px; overflow-y: scroll; } | 
					
						
						|  | #user-input { margin: 20px; } | 
					
						
						|  | </style> | 
					
						
						|  | </head> | 
					
						
						|  | <body> | 
					
						
						|  |  | 
					
						
						|  | <h1>Chat with Amara</h1> | 
					
						
						|  | <div id="chat-box"></div> | 
					
						
						|  | <div id="user-input"> | 
					
						
						|  | <input type="text" id="message" placeholder="Type your message here..." /> | 
					
						
						|  | <button onclick="sendMessage()">Send</button> | 
					
						
						|  | </div> | 
					
						
						|  |  | 
					
						
						|  | <script> | 
					
						
						|  | async function sendMessage() { | 
					
						
						|  | const messageInput = document.getElementById('message'); | 
					
						
						|  | const message = messageInput.value; | 
					
						
						|  | messageInput.value = ''; | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  | addMessage(`You: ${message}`); | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  | const response = await fetch('/chat', { | 
					
						
						|  | method: 'POST', | 
					
						
						|  | headers: { | 
					
						
						|  | 'Content-Type': 'application/json', | 
					
						
						|  | }, | 
					
						
						|  | body: JSON.stringify({ message }) | 
					
						
						|  | }); | 
					
						
						|  |  | 
					
						
						|  | const data = await response.json(); | 
					
						
						|  | addMessage(`Amara: ${data.response}`); | 
					
						
						|  | } | 
					
						
						|  |  | 
					
						
						|  | function addMessage(message) { | 
					
						
						|  | const chatBox = document.getElementById('chat-box'); | 
					
						
						|  | chatBox.innerHTML += `<div>${message}</div>`; | 
					
						
						|  | chatBox.scrollTop = chatBox.scrollHeight; | 
					
						
						|  | } | 
					
						
						|  | </script> | 
					
						
						|  |  | 
					
						
						|  | </body> | 
					
						
						|  | </html> | 
					
						
						|  |  |