rag / index.html
user
modifications for remote development using huggingface resouces
b5553ae
raw
history blame
1.12 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RAG Chatbot</title>
</head>
<body>
<h1>RAG Chatbot</h1>
<div id="chat-container"></div>
<input type="text" id="user-input" placeholder="Ask a question...">
<button onclick="sendMessage()">Send</button>
<script>
async function sendMessage() {
const input = document.getElementById('user-input');
const message = input.value;
input.value = '';
const response = await fetch('/ask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ question: message }),
});
const data = await response.json();
const chatContainer = document.getElementById('chat-container');
chatContainer.innerHTML += `<p><strong>You:</strong> ${message}</p><p><strong>Bot:</strong> ${data.response}</p>`;
}
</script>
</body>
</html>