Spaces:
Sleeping
Sleeping
updated index.html
Browse files- templates/index.html +50 -1
templates/index.html
CHANGED
@@ -1 +1,50 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>TIET Assistant</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
max-width: 800px;
|
11 |
+
margin: 0 auto;
|
12 |
+
padding: 20px;
|
13 |
+
}
|
14 |
+
form {
|
15 |
+
margin-bottom: 20px;
|
16 |
+
}
|
17 |
+
input[type="text"] {
|
18 |
+
width: 70%;
|
19 |
+
padding: 10px;
|
20 |
+
}
|
21 |
+
button {
|
22 |
+
padding: 10px 20px;
|
23 |
+
}
|
24 |
+
</style>
|
25 |
+
</head>
|
26 |
+
<body>
|
27 |
+
<h1>TIET Assistant</h1>
|
28 |
+
<form id="queryForm">
|
29 |
+
<input type="text" id="queryInput" placeholder="Ask a question about TIET">
|
30 |
+
<button type="submit">Ask</button>
|
31 |
+
</form>
|
32 |
+
<div id="response"></div>
|
33 |
+
|
34 |
+
<script>
|
35 |
+
document.getElementById('queryForm').addEventListener('submit', async (e) => {
|
36 |
+
e.preventDefault();
|
37 |
+
const query = document.getElementById('queryInput').value;
|
38 |
+
const response = await fetch('/anthropic', {
|
39 |
+
method: 'POST',
|
40 |
+
headers: {
|
41 |
+
'Content-Type': 'application/json',
|
42 |
+
},
|
43 |
+
body: JSON.stringify({ query_text: query }),
|
44 |
+
});
|
45 |
+
const data = await response.json();
|
46 |
+
document.getElementById('response').innerText = data.response;
|
47 |
+
});
|
48 |
+
</script>
|
49 |
+
</body>
|
50 |
+
</html>
|