Create index.html
Browse files- index.html +103 -0
index.html
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Customer Support Chatbot</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root {
|
| 9 |
+
--color-accent: #6366f1;
|
| 10 |
+
--color-background: #0f172a;
|
| 11 |
+
--color-surface: #1e293b;
|
| 12 |
+
--color-text: #e2e8f0;
|
| 13 |
+
--boxSize: 8px;
|
| 14 |
+
--gutter: 4px;
|
| 15 |
+
}
|
| 16 |
+
body {
|
| 17 |
+
margin: 0;
|
| 18 |
+
padding: 0;
|
| 19 |
+
background-color: var(--color-background);
|
| 20 |
+
color: var(--color-text);
|
| 21 |
+
font-family: system-ui, -apple-system, sans-serif;
|
| 22 |
+
min-height: 100vh;
|
| 23 |
+
display: flex;
|
| 24 |
+
flex-direction: column;
|
| 25 |
+
align-items: center;
|
| 26 |
+
justify-content: center;
|
| 27 |
+
}
|
| 28 |
+
.container {
|
| 29 |
+
width: 90%;
|
| 30 |
+
max-width: 800px;
|
| 31 |
+
background-color: var(--color-surface);
|
| 32 |
+
padding: 2rem;
|
| 33 |
+
border-radius: 1rem;
|
| 34 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
| 35 |
+
text-align: center;
|
| 36 |
+
}
|
| 37 |
+
.input-group {
|
| 38 |
+
margin: 1rem 0;
|
| 39 |
+
}
|
| 40 |
+
input {
|
| 41 |
+
padding: 0.75rem;
|
| 42 |
+
border-radius: 0.5rem;
|
| 43 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 44 |
+
background-color: var(--color-background);
|
| 45 |
+
color: var(--color-text);
|
| 46 |
+
font-size: 1rem;
|
| 47 |
+
width: 100%;
|
| 48 |
+
box-sizing: border-box;
|
| 49 |
+
}
|
| 50 |
+
button {
|
| 51 |
+
padding: 1rem 2rem;
|
| 52 |
+
border-radius: 0.5rem;
|
| 53 |
+
border: none;
|
| 54 |
+
background-color: var(--color-accent);
|
| 55 |
+
color: white;
|
| 56 |
+
font-weight: 600;
|
| 57 |
+
cursor: pointer;
|
| 58 |
+
transition: all 0.2s ease;
|
| 59 |
+
}
|
| 60 |
+
button:hover {
|
| 61 |
+
opacity: 0.9;
|
| 62 |
+
transform: translateY(-1px);
|
| 63 |
+
}
|
| 64 |
+
#response {
|
| 65 |
+
margin-top: 1rem;
|
| 66 |
+
background-color: var(--color-surface);
|
| 67 |
+
padding: 1rem;
|
| 68 |
+
border-radius: 0.5rem;
|
| 69 |
+
text-align: left;
|
| 70 |
+
}
|
| 71 |
+
</style>
|
| 72 |
+
</head>
|
| 73 |
+
<body>
|
| 74 |
+
<div class="container">
|
| 75 |
+
<h1>Customer Support Chatbot</h1>
|
| 76 |
+
<p>Ask your question below:</p>
|
| 77 |
+
<div class="input-group">
|
| 78 |
+
<input type="text" id="query" placeholder="Type your question here">
|
| 79 |
+
</div>
|
| 80 |
+
<button id="submit-button">Submit</button>
|
| 81 |
+
<div id="response"></div>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<script>
|
| 85 |
+
document.getElementById('submit-button').addEventListener('click', async () => {
|
| 86 |
+
const query = document.getElementById('query').value;
|
| 87 |
+
const responseDiv = document.getElementById('response');
|
| 88 |
+
responseDiv.innerHTML = "<em>Loading...</em>";
|
| 89 |
+
try {
|
| 90 |
+
const res = await fetch('/chat', {
|
| 91 |
+
method: 'POST',
|
| 92 |
+
headers: {'Content-Type': 'application/json'},
|
| 93 |
+
body: JSON.stringify({question: query})
|
| 94 |
+
});
|
| 95 |
+
const data = await res.json();
|
| 96 |
+
responseDiv.innerHTML = data.answer;
|
| 97 |
+
} catch (err) {
|
| 98 |
+
responseDiv.innerHTML = "<em>Error retrieving answer.</em>";
|
| 99 |
+
}
|
| 100 |
+
});
|
| 101 |
+
</script>
|
| 102 |
+
</body>
|
| 103 |
+
</html>
|