Create html_main.html
Browse files- html_main.html +33 -0
html_main.html
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>CyberFuture-3</title>
|
| 5 |
+
</head>
|
| 6 |
+
<body>
|
| 7 |
+
<div id="chat"></div>
|
| 8 |
+
<input type="text" id="input" placeholder="Type your question...">
|
| 9 |
+
<button onclick="sendMessage()">Send</button>
|
| 10 |
+
<button onclick="startVoice()">Voice</button>
|
| 11 |
+
|
| 12 |
+
<script>
|
| 13 |
+
async function sendMessage() {
|
| 14 |
+
const input = document.getElementById('input').value;
|
| 15 |
+
const response = await fetch('http://localhost:8000/chat/', {
|
| 16 |
+
method: 'POST',
|
| 17 |
+
headers: {
|
| 18 |
+
'Content-Type': 'application/x-www-form-urlencoded',
|
| 19 |
+
},
|
| 20 |
+
body: `prompt=${encodeURIComponent(input)}&use_web=true`
|
| 21 |
+
});
|
| 22 |
+
const data = await response.json();
|
| 23 |
+
document.getElementById('chat').innerHTML += `<p>You: ${input}</p>`;
|
| 24 |
+
document.getElementById('chat').innerHTML += `<p>Bot: ${data.response}</p>`;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
async function startVoice() {
|
| 28 |
+
// You would need to add proper voice recording implementation
|
| 29 |
+
alert("Voice recording would be implemented here");
|
| 30 |
+
}
|
| 31 |
+
</script>
|
| 32 |
+
</body>
|
| 33 |
+
</html>
|